counters: s/SCPerfCounterAddUI64/StatsAddUI64/g

pull/1508/head
Victor Julien 11 years ago
parent 60d9eb6790
commit 8992275b0c

@ -119,7 +119,7 @@ void SCPerfOutputCounters(ThreadVars *tv)
* \param pca Counter array that holds the local counter for this TM
* \param x Value to add to this local counter
*/
void SCPerfCounterAddUI64(ThreadVars *tv, uint16_t id, uint64_t x)
void StatsAddUI64(ThreadVars *tv, uint16_t id, uint64_t x)
{
SCPerfPrivateContext *pca = &tv->perf_private_ctx;
#ifdef UNITTESTS
@ -1458,7 +1458,7 @@ static int SCPerfTestUpdateCounter08()
pca = &tv.perf_private_ctx;
SCPerfCounterIncr(&tv, id);
SCPerfCounterAddUI64(&tv, id, 100);
StatsAddUI64(&tv, id, 100);
result = pca->head[id].value;
@ -1487,7 +1487,7 @@ static int SCPerfTestUpdateCounter09()
pca = &tv.perf_private_ctx;
SCPerfCounterIncr(&tv, id2);
SCPerfCounterAddUI64(&tv, id2, 100);
StatsAddUI64(&tv, id2, 100);
result = (pca->head[id1].value == 0) && (pca->head[id2].value == 101);
@ -1515,9 +1515,9 @@ static int SCPerfTestUpdateGlobalCounter10()
pca = &tv.perf_private_ctx;
SCPerfCounterIncr(&tv, id1);
SCPerfCounterAddUI64(&tv, id2, 100);
StatsAddUI64(&tv, id2, 100);
SCPerfCounterIncr(&tv, id3);
SCPerfCounterAddUI64(&tv, id3, 100);
StatsAddUI64(&tv, id3, 100);
SCPerfUpdateCounterArray(pca, &tv.perf_public_ctx);
@ -1550,9 +1550,9 @@ static int SCPerfTestCounterValues11()
pca = &tv.perf_private_ctx;
SCPerfCounterIncr(&tv, id1);
SCPerfCounterAddUI64(&tv, id2, 256);
SCPerfCounterAddUI64(&tv, id3, 257);
SCPerfCounterAddUI64(&tv, id4, 16843024);
StatsAddUI64(&tv, id2, 256);
StatsAddUI64(&tv, id3, 257);
StatsAddUI64(&tv, id4, 16843024);
SCPerfUpdateCounterArray(pca, &tv.perf_public_ctx);

@ -124,7 +124,7 @@ void SCPerfReleaseResources(void);
void SCPerfReleasePCA(SCPerfPrivateContext *);
/* functions used to update local counter values */
void SCPerfCounterAddUI64(struct ThreadVars_ *, uint16_t, uint64_t);
void StatsAddUI64(struct ThreadVars_ *, uint16_t, uint64_t);
void SCPerfCounterSetUI64(struct ThreadVars_ *, uint16_t, uint64_t);
void SCPerfCounterIncr(struct ThreadVars_ *, uint16_t);

@ -1437,12 +1437,12 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh
PACKET_PROFILING_DETECT_END(p, PROF_DETECT_MPM);
#ifdef PROFILING
if (th_v) {
SCPerfCounterAddUI64(th_v, det_ctx->counter_mpm_list,
StatsAddUI64(th_v, det_ctx->counter_mpm_list,
(uint64_t)det_ctx->pmq.rule_id_array_cnt);
SCPerfCounterAddUI64(th_v, det_ctx->counter_nonmpm_list,
StatsAddUI64(th_v, det_ctx->counter_nonmpm_list,
(uint64_t)det_ctx->sgh->non_mpm_store_cnt);
/* non mpm sigs after mask prefilter */
SCPerfCounterAddUI64(th_v, det_ctx->counter_fnonmpm_list,
StatsAddUI64(th_v, det_ctx->counter_fnonmpm_list,
(uint64_t)det_ctx->non_mpm_id_cnt);
}
#endif
@ -1457,7 +1457,7 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh
SigIntId match_cnt = det_ctx->match_array_cnt;
#ifdef PROFILING
if (th_v) {
SCPerfCounterAddUI64(th_v, det_ctx->counter_match_list,
StatsAddUI64(th_v, det_ctx->counter_match_list,
(uint64_t)match_cnt);
}
#endif
@ -1790,7 +1790,7 @@ end:
PACKET_PROFILING_DETECT_START(p, PROF_DETECT_ALERT);
PacketAlertFinalize(de_ctx, det_ctx, p);
if (p->alerts.cnt > 0) {
SCPerfCounterAddUI64(th_v, det_ctx->counter_alerts, (uint64_t)p->alerts.cnt);
StatsAddUI64(th_v, det_ctx->counter_alerts, (uint64_t)p->alerts.cnt);
}
PACKET_PROFILING_DETECT_END(p, PROF_DETECT_ALERT);

@ -621,18 +621,18 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
IPPairTimeoutHash(&ts);
}
/*
SCPerfCounterAddUI64(th_v, flow_mgr_host_prune, (uint64_t)hosts_pruned);
StatsAddUI64(th_v, flow_mgr_host_prune, (uint64_t)hosts_pruned);
uint32_t hosts_active = HostGetActiveCount();
SCPerfCounterSetUI64(th_v, flow_mgr_host_active, (uint64_t)hosts_active);
uint32_t hosts_spare = HostGetSpareCount();
SCPerfCounterSetUI64(th_v, flow_mgr_host_spare, (uint64_t)hosts_spare);
*/
SCPerfCounterAddUI64(th_v, ftd->flow_mgr_cnt_clo, (uint64_t)counters.clo);
SCPerfCounterAddUI64(th_v, ftd->flow_mgr_cnt_new, (uint64_t)counters.new);
SCPerfCounterAddUI64(th_v, ftd->flow_mgr_cnt_est, (uint64_t)counters.est);
StatsAddUI64(th_v, ftd->flow_mgr_cnt_clo, (uint64_t)counters.clo);
StatsAddUI64(th_v, ftd->flow_mgr_cnt_new, (uint64_t)counters.new);
StatsAddUI64(th_v, ftd->flow_mgr_cnt_est, (uint64_t)counters.est);
long long unsigned int flow_memuse = SC_ATOMIC_GET(flow_memuse);
SCPerfCounterSetUI64(th_v, ftd->flow_mgr_memuse, (uint64_t)flow_memuse);
SCPerfCounterAddUI64(th_v, ftd->flow_tcp_reuse, (uint64_t)counters.tcp_reuse);
StatsAddUI64(th_v, ftd->flow_tcp_reuse, (uint64_t)counters.tcp_reuse);
uint32_t len = 0;
FQLOCK_LOCK(&flow_spare_q);

@ -511,8 +511,8 @@ static inline void AFPDumpCounters(AFPThreadVars *ptv)
SCLogDebug("(%s) Kernel: Packets %" PRIu32 ", dropped %" PRIu32 "",
ptv->tv->name,
kstats.tp_packets, kstats.tp_drops);
SCPerfCounterAddUI64(ptv->tv, ptv->capture_kernel_packets, kstats.tp_packets);
SCPerfCounterAddUI64(ptv->tv, ptv->capture_kernel_drops, kstats.tp_drops);
StatsAddUI64(ptv->tv, ptv->capture_kernel_packets, kstats.tp_packets);
StatsAddUI64(ptv->tv, ptv->capture_kernel_drops, kstats.tp_drops);
(void) SC_ATOMIC_ADD(ptv->livedev->drop, (uint64_t) kstats.tp_drops);
(void) SC_ATOMIC_ADD(ptv->livedev->pkts, (uint64_t) kstats.tp_packets);
}
@ -1854,8 +1854,8 @@ TmEcode DecodeAFP(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packet
/* update counters */
SCPerfCounterIncr(tv, dtv->counter_pkts);
//SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
/* If suri has set vlan during reading, we increase vlan counter */

@ -442,7 +442,7 @@ ProcessErfDagRecords(ErfDagThreadVars *ewtn, uint8_t *top, uint32_t *pkts_read)
break;
case TYPE_ETH:
if (dr->lctr) {
SCPerfCounterAddUI64(tv, ewtn->drops, ntohs(dr->lctr));
StatsAddUI64(tv, ewtn->drops, ntohs(dr->lctr));
}
break;
default:
@ -623,8 +623,8 @@ DecodeErfDag(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq,
/* update counters */
SCPerfCounterIncr(tv, dtv->counter_pkts);
//SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
/* call the decoder */

@ -286,8 +286,8 @@ DecodeErfFile(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, PacketQueu
/* Update counters. */
SCPerfCounterIncr(tv, dtv->counter_pkts);
//SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq);

@ -453,8 +453,8 @@ TmEcode DecodeIPFW(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe
/* update counters */
SCPerfCounterIncr(tv, dtv->counter_pkts);
SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
/* Process IP packets */

@ -1042,9 +1042,9 @@ TmEcode DecodeMpipe(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq,
SCPerfCounterIncr(tv, dtv->counter_pkts);
// SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
/* call the decoder */

@ -359,8 +359,8 @@ TmEcode NapatechDecode(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq,
/* update counters */
SCPerfCounterIncr(tv, dtv->counter_pkts);
// SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
switch (p->datalink) {

@ -483,8 +483,8 @@ static int NetmapClose(NetmapDevice *dev)
*/
static inline void NetmapDumpCounters(NetmapThreadVars *ntv)
{
SCPerfCounterAddUI64(ntv->tv, ntv->capture_kernel_packets, ntv->pkts);
SCPerfCounterAddUI64(ntv->tv, ntv->capture_kernel_drops, ntv->drops);
StatsAddUI64(ntv->tv, ntv->capture_kernel_packets, ntv->pkts);
StatsAddUI64(ntv->tv, ntv->capture_kernel_drops, ntv->drops);
(void) SC_ATOMIC_ADD(ntv->livedev->drop, ntv->drops);
(void) SC_ATOMIC_ADD(ntv->livedev->pkts, ntv->pkts);
ntv->drops = 0;
@ -931,8 +931,8 @@ static TmEcode DecodeNetmap(ThreadVars *tv, Packet *p, void *data, PacketQueue *
/* update counters */
SCPerfCounterIncr(tv, dtv->counter_pkts);
SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq);

@ -500,8 +500,8 @@ TmEcode DecodeNFLOG(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Pack
DecodeThreadVars *dtv = (DecodeThreadVars *)data;
SCPerfCounterIncr(tv, dtv->counter_pkts);
SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
if (IPV4_GET_RAW_VER(ip4h) == 4) {

@ -1224,8 +1224,8 @@ TmEcode DecodeNFQ(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packet
return TM_ECODE_OK;
SCPerfCounterIncr(tv, dtv->counter_pkts);
SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
if (IPV4_GET_RAW_VER(ip4h) == 4) {

@ -403,8 +403,8 @@ TmEcode DecodePcapFile(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, P
/* update counters */
SCPerfCounterIncr(tv, dtv->counter_pkts);
//SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
double curr_ts = p->ts.tv_sec + p->ts.tv_usec / 1000.0;

@ -706,8 +706,8 @@ TmEcode DecodePcap(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe
/* update counters */
SCPerfCounterIncr(tv, dtv->counter_pkts);
//SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
/* call the decoder */

@ -604,8 +604,8 @@ TmEcode DecodePfring(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Pac
/* update counters */
SCPerfCounterIncr(tv, dtv->counter_pkts);
//SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
StatsAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
/* If suri has set vlan during reading, we increase vlan counter */

Loading…
Cancel
Save