From: Victor Julien Date: Tue, 26 May 2015 13:08:35 +0000 (+0200) Subject: counters: s/SCPerfCounterSetUI64/StatsSetUI64/g X-Git-Tag: suricata-3.0RC1~363 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=30cce2bd297ff2c770a3e7b97155c696ced01a11;p=thirdparty%2Fsuricata.git counters: s/SCPerfCounterSetUI64/StatsSetUI64/g --- diff --git a/src/app-layer-htp-mem.c b/src/app-layer-htp-mem.c index 18aa223a6b..f024ef9aa4 100644 --- a/src/app-layer-htp-mem.c +++ b/src/app-layer-htp-mem.c @@ -81,9 +81,9 @@ void HTPDecrMemuse(uint64_t size) void HTPMemuseCounter(ThreadVars *tv, TcpReassemblyThreadCtx *trt) { uint64_t tmpval = SC_ATOMIC_GET(htp_memuse); - SCPerfCounterSetUI64(tv, trt->counter_htp_memuse, tmpval); + StatsSetUI64(tv, trt->counter_htp_memuse, tmpval); tmpval = SC_ATOMIC_GET(htp_memcap); - SCPerfCounterSetUI64(tv, trt->counter_htp_memcap, tmpval); + StatsSetUI64(tv, trt->counter_htp_memcap, tmpval); return; } /** diff --git a/src/app-layer.c b/src/app-layer.c index 5dfd433c61..bc6e986adb 100644 --- a/src/app-layer.c +++ b/src/app-layer.c @@ -78,9 +78,9 @@ static void DNSUpdateCounters(ThreadVars *tv, AppLayerThreadCtx *app_tctx) DNSMemcapGetCounters(&memuse, &memcap_state, &memcap_global); - SCPerfCounterSetUI64(tv, app_tctx->counter_dns_memuse, memuse); - SCPerfCounterSetUI64(tv, app_tctx->counter_dns_memcap_state, memcap_state); - SCPerfCounterSetUI64(tv, app_tctx->counter_dns_memcap_global, memcap_global); + StatsSetUI64(tv, app_tctx->counter_dns_memuse, memuse); + StatsSetUI64(tv, app_tctx->counter_dns_memcap_state, memcap_state); + StatsSetUI64(tv, app_tctx->counter_dns_memcap_global, memcap_global); } /***** L7 layer dispatchers *****/ diff --git a/src/counters.c b/src/counters.c index 6fcd66e23b..3638f2c47f 100644 --- a/src/counters.c +++ b/src/counters.c @@ -162,7 +162,7 @@ void StatsIncr(ThreadVars *tv, uint16_t id) * \param pca Pointer to the SCPerfPrivateContext * \param x The value to set for the counter */ -void SCPerfCounterSetUI64(ThreadVars *tv, uint16_t id, uint64_t x) +void StatsSetUI64(ThreadVars *tv, uint16_t id, uint64_t x) { SCPerfPrivateContext *pca = &tv->perf_private_ctx; #ifdef UNITTESTS diff --git a/src/counters.h b/src/counters.h index 693141fd5d..0a6e830fbf 100644 --- a/src/counters.h +++ b/src/counters.h @@ -125,7 +125,7 @@ void SCPerfReleasePCA(SCPerfPrivateContext *); /* functions used to update local counter values */ void StatsAddUI64(struct ThreadVars_ *, uint16_t, uint64_t); -void SCPerfCounterSetUI64(struct ThreadVars_ *, uint16_t, uint64_t); +void StatsSetUI64(struct ThreadVars_ *, uint16_t, uint64_t); void StatsIncr(struct ThreadVars_ *, uint16_t); #define SCPerfSyncCounters(tv) \ diff --git a/src/flow-manager.c b/src/flow-manager.c index 4076abdca1..c938573ad3 100644 --- a/src/flow-manager.c +++ b/src/flow-manager.c @@ -623,22 +623,22 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data) /* 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); + StatsSetUI64(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); + StatsSetUI64(th_v, flow_mgr_host_spare, (uint64_t)hosts_spare); */ 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); + StatsSetUI64(th_v, ftd->flow_mgr_memuse, (uint64_t)flow_memuse); StatsAddUI64(th_v, ftd->flow_tcp_reuse, (uint64_t)counters.tcp_reuse); uint32_t len = 0; FQLOCK_LOCK(&flow_spare_q); len = flow_spare_q.len; FQLOCK_UNLOCK(&flow_spare_q); - SCPerfCounterSetUI64(th_v, ftd->flow_mgr_spare, (uint64_t)len); + StatsSetUI64(th_v, ftd->flow_mgr_spare, (uint64_t)len); /* Don't fear, FlowManagerThread is here... * clear emergency bit if we have at least xx flows pruned. */ diff --git a/src/source-af-packet.c b/src/source-af-packet.c index be06b4e95e..aed38baba1 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -1856,7 +1856,7 @@ TmEcode DecodeAFP(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packet //StatsIncr(tv, dtv->counter_pkts_per_sec); 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)); + StatsSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p)); /* If suri has set vlan during reading, we increase vlan counter */ if (p->vlan_idx) { diff --git a/src/source-erf-dag.c b/src/source-erf-dag.c index f8b6b16b28..9758b72162 100644 --- a/src/source-erf-dag.c +++ b/src/source-erf-dag.c @@ -625,7 +625,7 @@ DecodeErfDag(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, //StatsIncr(tv, dtv->counter_pkts_per_sec); 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)); + StatsSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p)); /* call the decoder */ switch(p->datalink) { diff --git a/src/source-erf-file.c b/src/source-erf-file.c index b1ab61938d..fd6973f57f 100644 --- a/src/source-erf-file.c +++ b/src/source-erf-file.c @@ -288,7 +288,7 @@ DecodeErfFile(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, PacketQueu //StatsIncr(tv, dtv->counter_pkts_per_sec); 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)); + StatsSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p)); DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq); diff --git a/src/source-ipfw.c b/src/source-ipfw.c index 3fb8ef3361..9e4fd62a5e 100644 --- a/src/source-ipfw.c +++ b/src/source-ipfw.c @@ -455,7 +455,7 @@ TmEcode DecodeIPFW(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe StatsIncr(tv, dtv->counter_pkts); 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)); + StatsSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p)); /* Process IP packets */ if (IPV4_GET_RAW_VER(ip4h) == 4) { diff --git a/src/source-mpipe.c b/src/source-mpipe.c index 511e298f1c..90fc7a0ba6 100644 --- a/src/source-mpipe.c +++ b/src/source-mpipe.c @@ -382,7 +382,7 @@ TmEcode ReceiveMpipeLoop(ThreadVars *tv, void *data, void *slot) __insn_prefetch(&idesc[i]); } if (unlikely(n > max_queued)) { - SCPerfCounterSetUI64(tv, ptv->max_mpipe_depth, + StatsSetUI64(tv, ptv->max_mpipe_depth, (uint64_t)n); max_queued = n; } @@ -1045,7 +1045,7 @@ TmEcode DecodeMpipe(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, 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)); + StatsSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p)); /* call the decoder */ DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq); diff --git a/src/source-napatech.c b/src/source-napatech.c index b508e03ac6..27e4f1cdda 100644 --- a/src/source-napatech.c +++ b/src/source-napatech.c @@ -361,7 +361,7 @@ TmEcode NapatechDecode(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, // StatsIncr(tv, dtv->counter_pkts_per_sec); 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)); + StatsSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p)); switch (p->datalink) { case LINKTYPE_ETHERNET: diff --git a/src/source-netmap.c b/src/source-netmap.c index 0a96a148f0..04508e6c12 100644 --- a/src/source-netmap.c +++ b/src/source-netmap.c @@ -933,7 +933,7 @@ static TmEcode DecodeNetmap(ThreadVars *tv, Packet *p, void *data, PacketQueue * StatsIncr(tv, dtv->counter_pkts); 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)); + StatsSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p)); DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq); diff --git a/src/source-nflog.c b/src/source-nflog.c index d37959807c..583af8545a 100644 --- a/src/source-nflog.c +++ b/src/source-nflog.c @@ -502,7 +502,7 @@ TmEcode DecodeNFLOG(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Pack StatsIncr(tv, dtv->counter_pkts); 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)); + StatsSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p)); if (IPV4_GET_RAW_VER(ip4h) == 4) { SCLogDebug("IPv4 packet"); diff --git a/src/source-nfq.c b/src/source-nfq.c index 9596ed4538..18259afc8e 100644 --- a/src/source-nfq.c +++ b/src/source-nfq.c @@ -1226,7 +1226,7 @@ TmEcode DecodeNFQ(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packet StatsIncr(tv, dtv->counter_pkts); 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)); + StatsSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p)); if (IPV4_GET_RAW_VER(ip4h) == 4) { SCLogDebug("IPv4 packet"); diff --git a/src/source-pcap-file.c b/src/source-pcap-file.c index c46c8a6bd7..007f89a299 100644 --- a/src/source-pcap-file.c +++ b/src/source-pcap-file.c @@ -405,7 +405,7 @@ TmEcode DecodePcapFile(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, P //StatsIncr(tv, dtv->counter_pkts_per_sec); 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)); + StatsSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p)); double curr_ts = p->ts.tv_sec + p->ts.tv_usec / 1000.0; if (curr_ts < prev_signaled_ts || (curr_ts - prev_signaled_ts) > 60.0) { diff --git a/src/source-pcap.c b/src/source-pcap.c index aa67b60ada..0a1bcaf0ed 100644 --- a/src/source-pcap.c +++ b/src/source-pcap.c @@ -155,10 +155,10 @@ static inline void PcapDumpCounters(PcapThreadVars *ptv) { struct pcap_stat pcap_s; if (likely((pcap_stats(ptv->pcap_handle, &pcap_s) >= 0))) { - SCPerfCounterSetUI64(ptv->tv, ptv->capture_kernel_packets, pcap_s.ps_recv); - SCPerfCounterSetUI64(ptv->tv, ptv->capture_kernel_drops, pcap_s.ps_drop); + StatsSetUI64(ptv->tv, ptv->capture_kernel_packets, pcap_s.ps_recv); + StatsSetUI64(ptv->tv, ptv->capture_kernel_drops, pcap_s.ps_drop); (void) SC_ATOMIC_SET(ptv->livedev->drop, pcap_s.ps_drop); - SCPerfCounterSetUI64(ptv->tv, ptv->capture_kernel_ifdrops, pcap_s.ps_ifdrop); + StatsSetUI64(ptv->tv, ptv->capture_kernel_ifdrops, pcap_s.ps_ifdrop); } } @@ -708,7 +708,7 @@ TmEcode DecodePcap(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe //StatsIncr(tv, dtv->counter_pkts_per_sec); 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)); + StatsSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p)); /* call the decoder */ switch(p->datalink) { diff --git a/src/source-pfring.c b/src/source-pfring.c index 6b60df9add..2b430200b1 100644 --- a/src/source-pfring.c +++ b/src/source-pfring.c @@ -202,8 +202,8 @@ static inline void PfringDumpCounters(PfringThreadVars *ptv) uint64_t th_drops = SCPerfGetLocalCounterValue(ptv->tv, ptv->capture_kernel_drops); SC_ATOMIC_ADD(ptv->livedev->pkts, pfring_s.recv - th_pkts); SC_ATOMIC_ADD(ptv->livedev->drop, pfring_s.drop - th_drops); - SCPerfCounterSetUI64(ptv->tv, ptv->capture_kernel_packets, pfring_s.recv); - SCPerfCounterSetUI64(ptv->tv, ptv->capture_kernel_drops, pfring_s.drop); + StatsSetUI64(ptv->tv, ptv->capture_kernel_packets, pfring_s.recv); + StatsSetUI64(ptv->tv, ptv->capture_kernel_drops, pfring_s.drop); } } @@ -606,7 +606,7 @@ TmEcode DecodePfring(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Pac //StatsIncr(tv, dtv->counter_pkts_per_sec); 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)); + StatsSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p)); /* If suri has set vlan during reading, we increase vlan counter */ if (p->vlan_idx) { diff --git a/src/stream-tcp.c b/src/stream-tcp.c index afc19fc054..6e08f81958 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -148,7 +148,7 @@ void StreamTcpDecrMemuse(uint64_t size) void StreamTcpMemuseCounter(ThreadVars *tv, StreamTcpThread *stt) { uint64_t memusecopy = SC_ATOMIC_GET(st_memuse); - SCPerfCounterSetUI64(tv, stt->counter_tcp_memuse, memusecopy); + StatsSetUI64(tv, stt->counter_tcp_memuse, memusecopy); return; }