]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
counters: s/SCPerfCounterAddUI64/StatsAddUI64/g
authorVictor Julien <victor@inliniac.net>
Tue, 26 May 2015 12:45:43 +0000 (14:45 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 27 May 2015 12:14:46 +0000 (14:14 +0200)
16 files changed:
src/counters.c
src/counters.h
src/detect.c
src/flow-manager.c
src/source-af-packet.c
src/source-erf-dag.c
src/source-erf-file.c
src/source-ipfw.c
src/source-mpipe.c
src/source-napatech.c
src/source-netmap.c
src/source-nflog.c
src/source-nfq.c
src/source-pcap-file.c
src/source-pcap.c
src/source-pfring.c

index 8c2852fd839869381a90678a2404e7e46a050687..5473b01b4a3c99afc5e1e49009dc03715f778d0d 100644 (file)
@@ -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);
 
index 82378c02fec0488cee241697ce325325fac32ca8..7f463d91c6682cef2089373f826882c3e0193f0b 100644 (file)
@@ -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);
 
index b95d5859cb9c274f8277e703df87321a37166b29..2156187c3af9e165663a110e32daa178c4d24ca2 100644 (file)
@@ -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);
 
index 1b5b24c4965e7ee7be0384a979b78ed07075e18f..eca211f09c1b4ed03edaba511b9217ad91239439 100644 (file)
@@ -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);
index 5fdaa80317621b4b7d60fc645b4a763e46a462c2..1fffe2ba0f625c67758c05e01bcc5a39f05cfde7 100644 (file)
@@ -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 */
index 0854a87c57981392b6f6c0e1109f3b6a9eadfdc9..7394ddd04354e446f0d38dd3bd591d57b7f3e407 100644 (file)
@@ -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 */
index 38fa57ca9f7a7a39d2542cf85615ccff037f4d54..5bc4c38f5c6a9b60e1551ae19a5148f169bc09ec 100644 (file)
@@ -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);
index 8163d8387d8b1d19644b1a1408e40d533cb2179c..75965465076c9f254ddf0af047d847dcce8d3f2b 100644 (file)
@@ -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 */
index bb3655afdb39a0d3695626685570dbf4c3904766..5a9d60eeebb7fbf8b75a96c6f3ad2c8a8b8183ce 100644 (file)
@@ -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 */
index f3430d07920998e9a11806742b731af5943e3f63..ed32ded4948bd38e4a318949ccb6f191063c2ed7 100644 (file)
@@ -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) {
index 0b70c6a6c6d6d46c105a9075d30a2546594dbb0d..e0e52977134dd1ed38e752a9f990751ff3941af4 100644 (file)
@@ -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);
index cb462af57e82666d0671c163f8c33b376aa7f838..f8dc318ce928af1943269206fa5478083ca0016b 100644 (file)
@@ -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) {
index a4a6ab73b677ffacd215016382b1df85356f223a..ea2bdf83d39db9ab42a88994db90324c8abca110 100644 (file)
@@ -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) {
index 8e7e0bfd0909cf5f17fb49e7df115a70bf9d52c7..7e7b8ba79b424ef4a51d0a99cf3879f909caf71e 100644 (file)
@@ -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;
index a092a7599e2f914fb338f068549e8b407e82bb63..b9283189951461188658e0e2e8ecead51bf10547 100644 (file)
@@ -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 */
index a9fff4cbe22ede6a1e2ea7ac27aa8aa74510afa2..6e997be920ed323318449b350211c3ff0b045307 100644 (file)
@@ -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 */