counters: threadvars s/sc_perf_pca/perf_private_ctx/g

pull/1508/head
Victor Julien 11 years ago
parent 50bb995458
commit 9a8bff7d96

@ -81,9 +81,9 @@ void HTPDecrMemuse(uint64_t size)
void HTPMemuseCounter(ThreadVars *tv, TcpReassemblyThreadCtx *trt)
{
uint64_t tmpval = SC_ATOMIC_GET(htp_memuse);
SCPerfCounterSetUI64(trt->counter_htp_memuse, tv->sc_perf_pca, tmpval);
SCPerfCounterSetUI64(trt->counter_htp_memuse, tv->perf_private_ctx, tmpval);
tmpval = SC_ATOMIC_GET(htp_memcap);
SCPerfCounterSetUI64(trt->counter_htp_memcap, tv->sc_perf_pca, tmpval);
SCPerfCounterSetUI64(trt->counter_htp_memcap, tv->perf_private_ctx, tmpval);
return;
}
/**

@ -79,11 +79,11 @@ static void DNSUpdateCounters(ThreadVars *tv, AppLayerThreadCtx *app_tctx)
DNSMemcapGetCounters(&memuse, &memcap_state, &memcap_global);
SCPerfCounterSetUI64(app_tctx->counter_dns_memuse,
tv->sc_perf_pca, memuse);
tv->perf_private_ctx, memuse);
SCPerfCounterSetUI64(app_tctx->counter_dns_memcap_state,
tv->sc_perf_pca, memcap_state);
tv->perf_private_ctx, memcap_state);
SCPerfCounterSetUI64(app_tctx->counter_dns_memcap_global,
tv->sc_perf_pca, memcap_global);
tv->perf_private_ctx, memcap_global);
}
/***** L7 layer dispatchers *****/

@ -1392,9 +1392,9 @@ static int SCPerfTestGetCntArray05()
return 0;
}
tv.sc_perf_pca = SCPerfGetAllCountersArray(NULL);
tv.perf_private_ctx = SCPerfGetAllCountersArray(NULL);
return (!tv.sc_perf_pca)?1:0;
return (!tv.perf_private_ctx)?1:0;
}
static int SCPerfTestGetCntArray06()
@ -1410,12 +1410,12 @@ static int SCPerfTestGetCntArray06()
if (id != 1)
return 0;
tv.sc_perf_pca = SCPerfGetAllCountersArray(&tv.perf_public_ctx);
tv.perf_private_ctx = SCPerfGetAllCountersArray(&tv.perf_public_ctx);
result = (tv.sc_perf_pca)?1:0;
result = (tv.perf_private_ctx)?1:0;
SCPerfReleasePerfCounterS(tv.perf_public_ctx.head);
SCPerfReleasePCA(tv.sc_perf_pca);
SCPerfReleasePCA(tv.perf_private_ctx);
return result;
}
@ -1428,7 +1428,7 @@ static int SCPerfTestCntArraySize07()
memset(&tv, 0, sizeof(ThreadVars));
//pca = (SCPerfPrivateContext *)&tv.sc_perf_pca;
//pca = (SCPerfPrivateContext *)&tv.perf_private_ctx;
SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64, NULL,
&tv.perf_public_ctx);

@ -180,12 +180,12 @@ void SCPerfRegisterTests(void);
void SCPerfCounterAddUI64(uint16_t, SCPerfPrivateContext *, uint64_t);
#define SCPerfSyncCounters(tv) \
SCPerfUpdateCounterArray((tv)->sc_perf_pca, &(tv)->perf_public_ctx); \
SCPerfUpdateCounterArray((tv)->perf_private_ctx, &(tv)->perf_public_ctx); \
#define SCPerfSyncCountersIfSignalled(tv) \
do { \
if ((tv)->perf_public_ctx.perf_flag == 1) { \
SCPerfUpdateCounterArray((tv)->sc_perf_pca, &(tv)->perf_public_ctx); \
SCPerfUpdateCounterArray((tv)->perf_private_ctx, &(tv)->perf_public_ctx); \
} \
} while (0)

@ -41,7 +41,7 @@
int DecodeEthernet(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
SCPerfCounterIncr(dtv->counter_eth, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_eth, tv->perf_private_ctx);
if (unlikely(len < ETHERNET_HEADER_LEN)) {
ENGINE_SET_INVALID_EVENT(p, ETHERNET_PKT_TOO_SMALL);

@ -48,7 +48,7 @@ int DecodeGRE(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, ui
uint16_t header_len = GRE_HDR_LEN;
GRESreHdr *gsre = NULL;
SCPerfCounterIncr(dtv->counter_gre, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_gre, tv->perf_private_ctx);
if(len < GRE_HDR_LEN) {
ENGINE_SET_INVALID_EVENT(p, GRE_PKT_TOO_SMALL);

@ -153,7 +153,7 @@ void DecodePartialIPV4( Packet* p, uint8_t* partial_packet, uint16_t len )
*/
int DecodeICMPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
SCPerfCounterIncr(dtv->counter_icmpv4, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_icmpv4, tv->perf_private_ctx);
if (len < ICMPV4_HEADER_LEN) {
ENGINE_SET_INVALID_EVENT(p, ICMPV4_PKT_TOO_SMALL);

@ -168,7 +168,7 @@ int DecodeICMPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
int full_hdr = 0;
SCPerfCounterIncr(dtv->counter_icmpv6, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_icmpv6, tv->perf_private_ctx);
if (len < ICMPV6_HEADER_LEN) {
SCLogDebug("ICMPV6_PKT_TOO_SMALL");

@ -519,7 +519,7 @@ static int DecodeIPV4Packet(Packet *p, uint8_t *pkt, uint16_t len)
int DecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
SCPerfCounterIncr(dtv->counter_ipv4, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_ipv4, tv->perf_private_ctx);
SCLogDebug("pkt %p len %"PRIu16"", pkt, len);

@ -65,7 +65,7 @@ static void DecodeIPv4inIPv6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, u
PKT_SET_SRC(tp, PKT_SRC_DECODER_IPV6);
/* add the tp to the packet queue. */
PacketEnqueue(pq,tp);
SCPerfCounterIncr(dtv->counter_ipv4inipv6, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_ipv4inipv6, tv->perf_private_ctx);
return;
}
}
@ -92,7 +92,7 @@ static int DecodeIP6inIP6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint
if (tp != NULL) {
PKT_SET_SRC(tp, PKT_SRC_DECODER_IPV6);
PacketEnqueue(pq,tp);
SCPerfCounterIncr(dtv->counter_ipv6inipv6, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_ipv6inipv6, tv->perf_private_ctx);
}
}
} else {
@ -601,7 +601,7 @@ int DecodeIPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, u
{
int ret;
SCPerfCounterIncr(dtv->counter_ipv6, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_ipv6, tv->perf_private_ctx);
/* do the actual decoding */
ret = DecodeIPV6Packet (tv, dtv, p, pkt, len);

@ -51,7 +51,7 @@ int DecodeMPLS(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt,
int label;
int event = 0;
SCPerfCounterIncr(dtv->counter_mpls, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_mpls, tv->perf_private_ctx);
do {
if (len < MPLS_HEADER_LEN) {

@ -47,7 +47,7 @@
int DecodeNull(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
SCPerfCounterIncr(dtv->counter_null, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_null, tv->perf_private_ctx);
if (unlikely(len < HDR_SIZE)) {
ENGINE_SET_INVALID_EVENT(p, LTNULL_PKT_TOO_SMALL);

@ -42,7 +42,7 @@
int DecodePPP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
SCPerfCounterIncr(dtv->counter_ppp, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_ppp, tv->perf_private_ctx);
if (unlikely(len < PPP_HEADER_LEN)) {
ENGINE_SET_INVALID_EVENT(p, PPP_PKT_TOO_SMALL);

@ -49,7 +49,7 @@
*/
int DecodePPPOEDiscovery(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
SCPerfCounterIncr(dtv->counter_pppoe, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_pppoe, tv->perf_private_ctx);
if (len < PPPOE_DISCOVERY_HEADER_MIN_LEN) {
ENGINE_SET_INVALID_EVENT(p, PPPOE_PKT_TOO_SMALL);
@ -128,7 +128,7 @@ int DecodePPPOEDiscovery(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8
*/
int DecodePPPOESession(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
SCPerfCounterIncr(dtv->counter_pppoe, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_pppoe, tv->perf_private_ctx);
if (len < PPPOE_SESSION_HEADER_LEN) {
ENGINE_SET_INVALID_EVENT(p, PPPOE_PKT_TOO_SMALL);

@ -45,7 +45,7 @@
int DecodeRaw(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
SCPerfCounterIncr(dtv->counter_raw, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_raw, tv->perf_private_ctx);
/* If it is ipv4 or ipv6 it should at least be the size of ipv4 */
if (unlikely(len < IPV4_HEADER_LEN)) {

@ -61,7 +61,7 @@ static int DecodeSCTPPacket(ThreadVars *tv, Packet *p, uint8_t *pkt, uint16_t le
int DecodeSCTP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
SCPerfCounterIncr(dtv->counter_sctp, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_sctp, tv->perf_private_ctx);
if (unlikely(DecodeSCTPPacket(tv, p,pkt,len) < 0)) {
p->sctph = NULL;

@ -38,7 +38,7 @@
int DecodeSll(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
SCPerfCounterIncr(dtv->counter_sll, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_sll, tv->perf_private_ctx);
if (unlikely(len < SLL_HEADER_LEN)) {
ENGINE_SET_INVALID_EVENT(p, SLL_PKT_TOO_SMALL);

@ -186,7 +186,7 @@ static int DecodeTCPPacket(ThreadVars *tv, Packet *p, uint8_t *pkt, uint16_t len
int DecodeTCP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
SCPerfCounterIncr(dtv->counter_tcp, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_tcp, tv->perf_private_ctx);
if (unlikely(DecodeTCPPacket(tv, p,pkt,len) < 0)) {
SCLogDebug("invalid TCP packet");

@ -96,7 +96,7 @@ int DecodeTeredo(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt,
PKT_SET_SRC(tp, PKT_SRC_DECODER_TEREDO);
/* add the tp to the packet queue. */
PacketEnqueue(pq,tp);
SCPerfCounterIncr(dtv->counter_teredo, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_teredo, tv->perf_private_ctx);
return TM_ECODE_OK;
}
}

@ -72,7 +72,7 @@ static int DecodeUDPPacket(ThreadVars *t, Packet *p, uint8_t *pkt, uint16_t len)
int DecodeUDP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{
SCPerfCounterIncr(dtv->counter_udp, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_udp, tv->perf_private_ctx);
if (unlikely(DecodeUDPPacket(tv, p,pkt,len) < 0)) {
p->udph = NULL;

@ -61,9 +61,9 @@ int DecodeVLAN(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, u
uint32_t proto;
if (p->vlan_idx == 0)
SCPerfCounterIncr(dtv->counter_vlan, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_vlan, tv->perf_private_ctx);
else if (p->vlan_idx == 1)
SCPerfCounterIncr(dtv->counter_vlan_qinq, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_vlan_qinq, tv->perf_private_ctx);
if(len < VLAN_HEADER_LEN) {
ENGINE_SET_INVALID_EVENT(p, VLAN_HEADER_TOO_SMALL);

@ -106,7 +106,7 @@ void PacketDecodeFinalize(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p)
{
if (p->flags & PKT_IS_INVALID)
SCPerfCounterIncr(dtv->counter_invalid, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_invalid, tv->perf_private_ctx);
#ifdef __SC_CUDA_SUPPORT__
if (dtv->cuda_vars.mpm_is_cuda)

@ -772,7 +772,7 @@ insert:
r = Defrag4Reassemble(tv, tracker, p);
if (r != NULL && tv != NULL && dtv != NULL) {
SCPerfCounterIncr(dtv->counter_defrag_ipv4_reassembled,
tv->sc_perf_pca);
tv->perf_private_ctx);
if (pq && DecodeIPV4(tv, dtv, r, (void *)r->ip4h,
IPV4_GET_IPLEN(r), pq) != TM_ECODE_OK) {
TmqhOutputPacketpool(tv, r);
@ -785,7 +785,7 @@ insert:
r = Defrag6Reassemble(tv, tracker, p);
if (r != NULL && tv != NULL && dtv != NULL) {
SCPerfCounterIncr(dtv->counter_defrag_ipv6_reassembled,
tv->sc_perf_pca);
tv->perf_private_ctx);
if (pq && DecodeIPV6(tv, dtv, r, (uint8_t *)r->ip6h,
IPV6_GET_PLEN(r) + IPV6_HEADER_LEN,
pq) != TM_ECODE_OK) {
@ -926,11 +926,11 @@ Defrag(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, PacketQueue *pq)
if (tv != NULL && dtv != NULL) {
if (af == AF_INET) {
SCPerfCounterIncr(dtv->counter_defrag_ipv4_fragments,
tv->sc_perf_pca);
tv->perf_private_ctx);
}
else if (af == AF_INET6) {
SCPerfCounterIncr(dtv->counter_defrag_ipv6_fragments,
tv->sc_perf_pca);
tv->perf_private_ctx);
}
}

@ -1437,13 +1437,13 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh
PACKET_PROFILING_DETECT_END(p, PROF_DETECT_MPM);
#ifdef PROFILING
if (th_v) {
SCPerfCounterAddUI64(det_ctx->counter_mpm_list, th_v->sc_perf_pca,
SCPerfCounterAddUI64(det_ctx->counter_mpm_list, th_v->perf_private_ctx,
(uint64_t)det_ctx->pmq.rule_id_array_cnt);
SCPerfCounterAddUI64(det_ctx->counter_nonmpm_list, th_v->sc_perf_pca,
SCPerfCounterAddUI64(det_ctx->counter_nonmpm_list, th_v->perf_private_ctx,
(uint64_t)det_ctx->sgh->non_mpm_store_cnt);
/* non mpm sigs after mask prefilter */
SCPerfCounterAddUI64(det_ctx->counter_fnonmpm_list,
th_v->sc_perf_pca, (uint64_t)det_ctx->non_mpm_id_cnt);
th_v->perf_private_ctx, (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(det_ctx->counter_match_list, th_v->sc_perf_pca,
SCPerfCounterAddUI64(det_ctx->counter_match_list, th_v->perf_private_ctx,
(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(det_ctx->counter_alerts, det_ctx->tv->sc_perf_pca, (uint64_t)p->alerts.cnt);
SCPerfCounterAddUI64(det_ctx->counter_alerts, det_ctx->tv->perf_private_ctx, (uint64_t)p->alerts.cnt);
}
PACKET_PROFILING_DETECT_END(p, PROF_DETECT_ALERT);
@ -11263,26 +11263,26 @@ static int SigTestDetectAlertCounter(void)
DetectEngineThreadCtxInit(&tv, de_ctx, (void *)&det_ctx);
/* init counters */
tv.sc_perf_pca = SCPerfGetAllCountersArray(&tv.perf_public_ctx);
tv.perf_private_ctx = SCPerfGetAllCountersArray(&tv.perf_public_ctx);
SCPerfAddToClubbedTMTable((tv.thread_group_name != NULL) ?
tv.thread_group_name : tv.name, &tv.perf_public_ctx);
p = UTHBuildPacket((uint8_t *)"boo", strlen("boo"), IPPROTO_TCP);
Detect(&tv, p, det_ctx, NULL, NULL);
result = (SCPerfGetLocalCounterValue(det_ctx->counter_alerts, tv.sc_perf_pca) == 1);
result = (SCPerfGetLocalCounterValue(det_ctx->counter_alerts, tv.perf_private_ctx) == 1);
Detect(&tv, p, det_ctx, NULL, NULL);
result &= (SCPerfGetLocalCounterValue(det_ctx->counter_alerts, tv.sc_perf_pca) == 2);
result &= (SCPerfGetLocalCounterValue(det_ctx->counter_alerts, tv.perf_private_ctx) == 2);
UTHFreePackets(&p, 1);
p = UTHBuildPacket((uint8_t *)"roo", strlen("roo"), IPPROTO_TCP);
Detect(&tv, p, det_ctx, NULL, NULL);
result &= (SCPerfGetLocalCounterValue(det_ctx->counter_alerts, tv.sc_perf_pca) == 2);
result &= (SCPerfGetLocalCounterValue(det_ctx->counter_alerts, tv.perf_private_ctx) == 2);
UTHFreePackets(&p, 1);
p = UTHBuildPacket((uint8_t *)"laboosa", strlen("laboosa"), IPPROTO_TCP);
Detect(&tv, p, det_ctx, NULL, NULL);
result &= (SCPerfGetLocalCounterValue(det_ctx->counter_alerts, tv.sc_perf_pca) == 3);
result &= (SCPerfGetLocalCounterValue(det_ctx->counter_alerts, tv.perf_private_ctx) == 3);
UTHFreePackets(&p, 1);
end:

@ -605,7 +605,7 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
SCLogDebug("Flow emergency mode entered...");
SCPerfCounterIncr(ftd->flow_emerg_mode_enter, th_v->sc_perf_pca);
SCPerfCounterIncr(ftd->flow_emerg_mode_enter, th_v->perf_private_ctx);
}
}
@ -635,24 +635,24 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
IPPairTimeoutHash(&ts);
}
/*
SCPerfCounterAddUI64(flow_mgr_host_prune, th_v->sc_perf_pca, (uint64_t)hosts_pruned);
SCPerfCounterAddUI64(flow_mgr_host_prune, th_v->perf_private_ctx, (uint64_t)hosts_pruned);
uint32_t hosts_active = HostGetActiveCount();
SCPerfCounterSetUI64(flow_mgr_host_active, th_v->sc_perf_pca, (uint64_t)hosts_active);
SCPerfCounterSetUI64(flow_mgr_host_active, th_v->perf_private_ctx, (uint64_t)hosts_active);
uint32_t hosts_spare = HostGetSpareCount();
SCPerfCounterSetUI64(flow_mgr_host_spare, th_v->sc_perf_pca, (uint64_t)hosts_spare);
SCPerfCounterSetUI64(flow_mgr_host_spare, th_v->perf_private_ctx, (uint64_t)hosts_spare);
*/
SCPerfCounterAddUI64(ftd->flow_mgr_cnt_clo, th_v->sc_perf_pca, (uint64_t)counters.clo);
SCPerfCounterAddUI64(ftd->flow_mgr_cnt_new, th_v->sc_perf_pca, (uint64_t)counters.new);
SCPerfCounterAddUI64(ftd->flow_mgr_cnt_est, th_v->sc_perf_pca, (uint64_t)counters.est);
SCPerfCounterAddUI64(ftd->flow_mgr_cnt_clo, th_v->perf_private_ctx, (uint64_t)counters.clo);
SCPerfCounterAddUI64(ftd->flow_mgr_cnt_new, th_v->perf_private_ctx, (uint64_t)counters.new);
SCPerfCounterAddUI64(ftd->flow_mgr_cnt_est, th_v->perf_private_ctx, (uint64_t)counters.est);
long long unsigned int flow_memuse = SC_ATOMIC_GET(flow_memuse);
SCPerfCounterSetUI64(ftd->flow_mgr_memuse, th_v->sc_perf_pca, (uint64_t)flow_memuse);
SCPerfCounterAddUI64(ftd->flow_tcp_reuse, th_v->sc_perf_pca, (uint64_t)counters.tcp_reuse);
SCPerfCounterSetUI64(ftd->flow_mgr_memuse, th_v->perf_private_ctx, (uint64_t)flow_memuse);
SCPerfCounterAddUI64(ftd->flow_tcp_reuse, th_v->perf_private_ctx, (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(ftd->flow_mgr_spare, th_v->sc_perf_pca, (uint64_t)len);
SCPerfCounterSetUI64(ftd->flow_mgr_spare, th_v->perf_private_ctx, (uint64_t)len);
/* Don't fear, FlowManagerThread is here...
* clear emergency bit if we have at least xx flows pruned. */
@ -676,7 +676,7 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
"%% flows at the queue", (uintmax_t)ts.tv_sec,
(uintmax_t)ts.tv_usec, len * 100 / flow_config.prealloc);
SCPerfCounterIncr(ftd->flow_emerg_mode_over, th_v->sc_perf_pca);
SCPerfCounterIncr(ftd->flow_emerg_mode_over, th_v->perf_private_ctx);
} else {
flow_update_delay_sec = FLOW_EMERG_MODE_UPDATE_DELAY_SEC;
flow_update_delay_nsec = FLOW_EMERG_MODE_UPDATE_DELAY_NSEC;

@ -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->capture_kernel_packets, ptv->tv->sc_perf_pca, kstats.tp_packets);
SCPerfCounterAddUI64(ptv->capture_kernel_drops, ptv->tv->sc_perf_pca, kstats.tp_drops);
SCPerfCounterAddUI64(ptv->capture_kernel_packets, ptv->tv->perf_private_ctx, kstats.tp_packets);
SCPerfCounterAddUI64(ptv->capture_kernel_drops, ptv->tv->perf_private_ctx, 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);
}
@ -1805,8 +1805,8 @@ void ReceiveAFPThreadExitStats(ThreadVars *tv, void *data)
AFPDumpCounters(ptv);
SCLogInfo("(%s) Kernel: Packets %" PRIu64 ", dropped %" PRIu64 "",
tv->name,
(uint64_t) SCPerfGetLocalCounterValue(ptv->capture_kernel_packets, tv->sc_perf_pca),
(uint64_t) SCPerfGetLocalCounterValue(ptv->capture_kernel_drops, tv->sc_perf_pca));
(uint64_t) SCPerfGetLocalCounterValue(ptv->capture_kernel_packets, tv->perf_private_ctx),
(uint64_t) SCPerfGetLocalCounterValue(ptv->capture_kernel_drops, tv->perf_private_ctx));
#endif
SCLogInfo("(%s) Packets %" PRIu64 ", bytes %" PRIu64 "", tv->name, ptv->pkts, ptv->bytes);
@ -1856,22 +1856,22 @@ TmEcode DecodeAFP(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packet
return TM_ECODE_OK;
/* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->sc_perf_pca);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p));
#if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->sc_perf_pca,
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0);
#endif
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
/* If suri has set vlan during reading, we increase vlan counter */
if (p->vlan_idx) {
SCPerfCounterIncr(dtv->counter_vlan, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_vlan, tv->perf_private_ctx);
}
/* call the decoder */

@ -444,7 +444,7 @@ ProcessErfDagRecords(ErfDagThreadVars *ewtn, uint8_t *top, uint32_t *pkts_read)
break;
case TYPE_ETH:
if (dr->lctr) {
SCPerfCounterAddUI64(ewtn->drops, ewtn->tv->sc_perf_pca,
SCPerfCounterAddUI64(ewtn->drops, ewtn->tv->perf_private_ctx,
ntohs(dr->lctr));
}
break;
@ -538,7 +538,7 @@ ProcessErfDagRecord(ErfDagThreadVars *ewtn, char *prec)
p->ts.tv_sec++;
}
SCPerfCounterIncr(ewtn->packets, ewtn->tv->sc_perf_pca);
SCPerfCounterIncr(ewtn->packets, ewtn->tv->perf_private_ctx);
ewtn->bytes += wlen;
if (TmThreadsSlotProcessPkt(ewtn->tv, ewtn->slot, p) != TM_ECODE_OK) {
@ -561,16 +561,16 @@ ReceiveErfDagThreadExitStats(ThreadVars *tv, void *data)
ErfDagThreadVars *ewtn = (ErfDagThreadVars *)data;
(void)SC_ATOMIC_SET(ewtn->livedev->pkts,
(uint64_t)SCPerfGetLocalCounterValue(ewtn->packets, tv->sc_perf_pca));
(uint64_t)SCPerfGetLocalCounterValue(ewtn->packets, tv->perf_private_ctx));
(void)SC_ATOMIC_SET(ewtn->livedev->drop,
(uint64_t)SCPerfGetLocalCounterValue(ewtn->drops, tv->sc_perf_pca));
(uint64_t)SCPerfGetLocalCounterValue(ewtn->drops, tv->perf_private_ctx));
SCLogInfo("Stream: %d; Bytes: %"PRIu64"; Packets: %"PRIu64
"; Drops: %"PRIu64,
ewtn->dagstream,
ewtn->bytes,
(uint64_t)SCPerfGetLocalCounterValue(ewtn->packets, tv->sc_perf_pca),
(uint64_t)SCPerfGetLocalCounterValue(ewtn->drops, tv->sc_perf_pca));
(uint64_t)SCPerfGetLocalCounterValue(ewtn->packets, tv->perf_private_ctx),
(uint64_t)SCPerfGetLocalCounterValue(ewtn->drops, tv->perf_private_ctx));
}
/**
@ -624,19 +624,19 @@ DecodeErfDag(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq,
return TM_ECODE_OK;
/* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->sc_perf_pca);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p));
#if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->sc_perf_pca,
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0);
#endif
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca,
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx,
GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca,
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx,
GET_PKT_LEN(p));
/* call the decoder */

@ -284,18 +284,18 @@ DecodeErfFile(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, PacketQueu
return TM_ECODE_OK;
/* Update counters. */
SCPerfCounterIncr(dtv->counter_pkts, tv->sc_perf_pca);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p));
#if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->sc_perf_pca,
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0 );
#endif
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq);

@ -452,10 +452,10 @@ TmEcode DecodeIPFW(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe
return TM_ECODE_OK;
/* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->sc_perf_pca);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
/* Process IP packets */
if (IPV4_GET_RAW_VER(ip4h) == 4) {

@ -383,7 +383,7 @@ TmEcode ReceiveMpipeLoop(ThreadVars *tv, void *data, void *slot)
}
if (unlikely(n > max_queued)) {
SCPerfCounterSetUI64(ptv->max_mpipe_depth,
tv->sc_perf_pca,
tv->perf_private_ctx,
(uint64_t)n);
max_queued = n;
}
@ -400,10 +400,10 @@ TmEcode ReceiveMpipeLoop(ThreadVars *tv, void *data, void *slot)
/* Buffer Error - No buffer available, so mPipe
* dropped the packet. */
SCPerfCounterIncr(XlateStack(ptv, idesc->stack_idx),
tv->sc_perf_pca);
tv->perf_private_ctx);
} else {
/* Bad packet. CRC error */
SCPerfCounterIncr(ptv->mpipe_drop, tv->sc_perf_pca);
SCPerfCounterIncr(ptv->mpipe_drop, tv->perf_private_ctx);
gxio_mpipe_iqueue_drop(iqueue, idesc);
}
gxio_mpipe_iqueue_release(iqueue, idesc);
@ -1063,13 +1063,13 @@ TmEcode DecodeMpipe(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq,
return TM_ECODE_OK;
/* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->sc_perf_pca);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
/* call the decoder */
DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq);

@ -357,11 +357,11 @@ TmEcode NapatechDecode(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq,
return TM_ECODE_OK;
/* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->sc_perf_pca);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->sc_perf_pca);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
switch (p->datalink) {
case LINKTYPE_ETHERNET:

@ -483,8 +483,8 @@ static int NetmapClose(NetmapDevice *dev)
*/
static inline void NetmapDumpCounters(NetmapThreadVars *ntv)
{
SCPerfCounterAddUI64(ntv->capture_kernel_packets, ntv->tv->sc_perf_pca, ntv->pkts);
SCPerfCounterAddUI64(ntv->capture_kernel_drops, ntv->tv->sc_perf_pca, ntv->drops);
SCPerfCounterAddUI64(ntv->capture_kernel_packets, ntv->tv->perf_private_ctx, ntv->pkts);
SCPerfCounterAddUI64(ntv->capture_kernel_drops, ntv->tv->perf_private_ctx, ntv->drops);
(void) SC_ATOMIC_ADD(ntv->livedev->drop, ntv->drops);
(void) SC_ATOMIC_ADD(ntv->livedev->pkts, ntv->pkts);
ntv->drops = 0;
@ -851,8 +851,8 @@ static void ReceiveNetmapThreadExitStats(ThreadVars *tv, void *data)
NetmapDumpCounters(ntv);
SCLogInfo("(%s) Kernel: Packets %" PRIu64 ", dropped %" PRIu64 ", bytes %" PRIu64 "",
tv->name,
(uint64_t) SCPerfGetLocalCounterValue(ntv->capture_kernel_packets, tv->sc_perf_pca),
(uint64_t) SCPerfGetLocalCounterValue(ntv->capture_kernel_drops, tv->sc_perf_pca),
(uint64_t) SCPerfGetLocalCounterValue(ntv->capture_kernel_packets, tv->perf_private_ctx),
(uint64_t) SCPerfGetLocalCounterValue(ntv->capture_kernel_drops, tv->perf_private_ctx),
ntv->bytes);
}
@ -934,10 +934,10 @@ static TmEcode DecodeNetmap(ThreadVars *tv, Packet *p, void *data, PacketQueue *
SCReturnInt(TM_ECODE_OK);
/* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->sc_perf_pca);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq);

@ -503,10 +503,10 @@ TmEcode DecodeNFLOG(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Pack
IPV6Hdr *ip6h = (IPV6Hdr *)GET_PKT_DATA(p);
DecodeThreadVars *dtv = (DecodeThreadVars *)data;
SCPerfCounterIncr(dtv->counter_pkts, tv->sc_perf_pca);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
if (IPV4_GET_RAW_VER(ip4h) == 4) {
SCLogDebug("IPv4 packet");

@ -1223,13 +1223,13 @@ TmEcode DecodeNFQ(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packet
if (p->flags & PKT_PSEUDO_STREAM_END)
return TM_ECODE_OK;
SCPerfCounterIncr(dtv->counter_pkts, tv->sc_perf_pca);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
#if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->sc_perf_pca,
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0);
#endif

@ -401,17 +401,17 @@ TmEcode DecodePcapFile(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, P
return TM_ECODE_OK;
/* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->sc_perf_pca);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p));
#if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->sc_perf_pca,
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0 );
#endif
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, 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) {

@ -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->capture_kernel_packets, ptv->tv->sc_perf_pca, pcap_s.ps_recv);
SCPerfCounterSetUI64(ptv->capture_kernel_drops, ptv->tv->sc_perf_pca, pcap_s.ps_drop);
SCPerfCounterSetUI64(ptv->capture_kernel_packets, ptv->tv->perf_private_ctx, pcap_s.ps_recv);
SCPerfCounterSetUI64(ptv->capture_kernel_drops, ptv->tv->perf_private_ctx, pcap_s.ps_drop);
(void) SC_ATOMIC_SET(ptv->livedev->drop, pcap_s.ps_drop);
SCPerfCounterSetUI64(ptv->capture_kernel_ifdrops, ptv->tv->sc_perf_pca, pcap_s.ps_ifdrop);
SCPerfCounterSetUI64(ptv->capture_kernel_ifdrops, ptv->tv->perf_private_ctx, pcap_s.ps_ifdrop);
}
}
@ -716,18 +716,18 @@ TmEcode DecodePcap(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe
return TM_ECODE_OK;
/* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->sc_perf_pca);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p));
#if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->sc_perf_pca,
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0);
#endif
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
/* call the decoder */
switch(p->datalink) {

@ -199,13 +199,13 @@ static inline void PfringDumpCounters(PfringThreadVars *ptv)
* the newly seen packets and drops for this thread and add it
* to the interface counter */
uint64_t th_pkts = SCPerfGetLocalCounterValue(ptv->capture_kernel_packets,
ptv->tv->sc_perf_pca);
ptv->tv->perf_private_ctx);
uint64_t th_drops = SCPerfGetLocalCounterValue(ptv->capture_kernel_drops,
ptv->tv->sc_perf_pca);
ptv->tv->perf_private_ctx);
SC_ATOMIC_ADD(ptv->livedev->pkts, pfring_s.recv - th_pkts);
SC_ATOMIC_ADD(ptv->livedev->drop, pfring_s.drop - th_drops);
SCPerfCounterSetUI64(ptv->capture_kernel_packets, ptv->tv->sc_perf_pca, pfring_s.recv);
SCPerfCounterSetUI64(ptv->capture_kernel_drops, ptv->tv->sc_perf_pca, pfring_s.drop);
SCPerfCounterSetUI64(ptv->capture_kernel_packets, ptv->tv->perf_private_ctx, pfring_s.recv);
SCPerfCounterSetUI64(ptv->capture_kernel_drops, ptv->tv->perf_private_ctx, pfring_s.drop);
}
}
@ -554,8 +554,8 @@ void ReceivePfringThreadExitStats(ThreadVars *tv, void *data)
PfringDumpCounters(ptv);
SCLogInfo("(%s) Kernel: Packets %" PRIu64 ", dropped %" PRIu64 "",
tv->name,
(uint64_t) SCPerfGetLocalCounterValue(ptv->capture_kernel_packets, tv->sc_perf_pca),
(uint64_t) SCPerfGetLocalCounterValue(ptv->capture_kernel_drops, tv->sc_perf_pca));
(uint64_t) SCPerfGetLocalCounterValue(ptv->capture_kernel_packets, tv->perf_private_ctx),
(uint64_t) SCPerfGetLocalCounterValue(ptv->capture_kernel_drops, tv->perf_private_ctx));
SCLogInfo("(%s) Packets %" PRIu64 ", bytes %" PRIu64 "", tv->name, ptv->pkts, ptv->bytes);
}
@ -608,22 +608,22 @@ TmEcode DecodePfring(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Pac
return TM_ECODE_OK;
/* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->sc_perf_pca);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p));
#if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->sc_perf_pca,
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0 );
#endif
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p));
/* If suri has set vlan during reading, we increase vlan counter */
if (p->vlan_idx) {
SCPerfCounterIncr(dtv->counter_vlan, tv->sc_perf_pca);
SCPerfCounterIncr(dtv->counter_vlan, tv->perf_private_ctx);
}
DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq);

@ -139,7 +139,7 @@ void StreamTcpReassembleMemuseCounter(ThreadVars *tv, TcpReassemblyThreadCtx *rt
{
uint64_t smemuse = SC_ATOMIC_GET(ra_memuse);
if (tv != NULL && rtv != NULL)
SCPerfCounterSetUI64(rtv->counter_tcp_reass_memuse, tv->sc_perf_pca, smemuse);
SCPerfCounterSetUI64(rtv->counter_tcp_reass_memuse, tv->perf_private_ctx, smemuse);
return;
}
@ -1905,7 +1905,7 @@ int StreamTcpReassembleHandleSegmentHandleData(ThreadVars *tv, TcpReassemblyThre
if (stream->flags & STREAMTCP_STREAM_FLAG_DEPTH_REACHED) {
/* increment stream depth counter */
SCPerfCounterIncr(ra_ctx->counter_tcp_stream_depth, tv->sc_perf_pca);
SCPerfCounterIncr(ra_ctx->counter_tcp_stream_depth, tv->perf_private_ctx);
stream->flags |= STREAMTCP_STREAM_FLAG_NOREASSEMBLY;
SCLogDebug("ssn %p: reassembly depth reached, "
@ -2606,7 +2606,7 @@ int DoHandleGap(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
stream->flags |= STREAMTCP_STREAM_FLAG_GAP;
StreamTcpSetEvent(p, STREAM_REASSEMBLY_SEQ_GAP);
SCPerfCounterIncr(ra_ctx->counter_tcp_reass_gap, tv->sc_perf_pca);
SCPerfCounterIncr(ra_ctx->counter_tcp_reass_gap, tv->perf_private_ctx);
#ifdef DEBUG
dbg_app_layer_gap++;
#endif
@ -2952,7 +2952,7 @@ int StreamTcpReassembleAppLayer (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
stream->flags |= STREAMTCP_STREAM_FLAG_GAP;
StreamTcpSetEvent(p, STREAM_REASSEMBLY_SEQ_GAP);
SCPerfCounterIncr(ra_ctx->counter_tcp_reass_gap, tv->sc_perf_pca);
SCPerfCounterIncr(ra_ctx->counter_tcp_reass_gap, tv->perf_private_ctx);
#ifdef DEBUG
dbg_app_layer_gap++;
#endif
@ -3596,7 +3596,7 @@ TcpSegment* StreamTcpGetSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
segment_pool[idx]->allocated);
/* Increment the counter to show that we are not able to serve the
segment request due to memcap limit */
SCPerfCounterIncr(ra_ctx->counter_tcp_segment_memcap, tv->sc_perf_pca);
SCPerfCounterIncr(ra_ctx->counter_tcp_segment_memcap, tv->perf_private_ctx);
} else {
seg->flags = stream_config.segment_init_flags;
seg->next = NULL;

@ -147,7 +147,7 @@ void StreamTcpDecrMemuse(uint64_t size)
void StreamTcpMemuseCounter(ThreadVars *tv, StreamTcpThread *stt)
{
uint64_t memusecopy = SC_ATOMIC_GET(st_memuse);
SCPerfCounterSetUI64(stt->counter_tcp_memuse, tv->sc_perf_pca, memusecopy);
SCPerfCounterSetUI64(stt->counter_tcp_memuse, tv->perf_private_ctx, memusecopy);
return;
}
@ -843,10 +843,10 @@ static int StreamTcpPacketStateNone(ThreadVars *tv, Packet *p,
if (ssn == NULL) {
ssn = StreamTcpNewSession(p, stt->ssn_pool_id);
if (ssn == NULL) {
SCPerfCounterIncr(stt->counter_tcp_ssn_memcap, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_ssn_memcap, tv->perf_private_ctx);
return -1;
}
SCPerfCounterIncr(stt->counter_tcp_sessions, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_sessions, tv->perf_private_ctx);
}
/* set the state */
StreamTcpPacketSetState(p, ssn, TCP_SYN_RECV);
@ -924,11 +924,11 @@ static int StreamTcpPacketStateNone(ThreadVars *tv, Packet *p,
if (ssn == NULL) {
ssn = StreamTcpNewSession(p, stt->ssn_pool_id);
if (ssn == NULL) {
SCPerfCounterIncr(stt->counter_tcp_ssn_memcap, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_ssn_memcap, tv->perf_private_ctx);
return -1;
}
SCPerfCounterIncr(stt->counter_tcp_sessions, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_sessions, tv->perf_private_ctx);
}
/* set the state */
@ -977,10 +977,10 @@ static int StreamTcpPacketStateNone(ThreadVars *tv, Packet *p,
if (ssn == NULL) {
ssn = StreamTcpNewSession(p, stt->ssn_pool_id);
if (ssn == NULL) {
SCPerfCounterIncr(stt->counter_tcp_ssn_memcap, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_ssn_memcap, tv->perf_private_ctx);
return -1;
}
SCPerfCounterIncr(stt->counter_tcp_sessions, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_sessions, tv->perf_private_ctx);
}
/* set the state */
StreamTcpPacketSetState(p, ssn, TCP_ESTABLISHED);
@ -4460,12 +4460,12 @@ int StreamTcpPacket (ThreadVars *tv, Packet *p, StreamTcpThread *stt,
/* update counters */
if ((p->tcph->th_flags & (TH_SYN|TH_ACK)) == (TH_SYN|TH_ACK)) {
SCPerfCounterIncr(stt->counter_tcp_synack, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_synack, tv->perf_private_ctx);
} else if (p->tcph->th_flags & (TH_SYN)) {
SCPerfCounterIncr(stt->counter_tcp_syn, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_syn, tv->perf_private_ctx);
}
if (p->tcph->th_flags & (TH_RST)) {
SCPerfCounterIncr(stt->counter_tcp_rst, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_rst, tv->perf_private_ctx);
}
/* broken TCP http://ask.wireshark.org/questions/3183/acknowledgment-number-broken-tcp-the-acknowledge-field-is-nonzero-while-the-ack-flag-is-not-set */
@ -5019,13 +5019,13 @@ TmEcode StreamTcp (ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe
return TM_ECODE_OK;
if (p->flow == NULL) {
SCPerfCounterIncr(stt->counter_tcp_no_flow, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_no_flow, tv->perf_private_ctx);
return TM_ECODE_OK;
}
if (stream_config.flags & STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION) {
if (StreamTcpValidateChecksum(p) == 0) {
SCPerfCounterIncr(stt->counter_tcp_invalid_checksum, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_invalid_checksum, tv->perf_private_ctx);
return TM_ECODE_OK;
}
} else {
@ -5896,7 +5896,7 @@ void StreamTcpPseudoPacketCreateStreamEndPacket(ThreadVars *tv, StreamTcpThread
Packet *np = StreamTcpPseudoSetup(p, GET_PKT_DATA(p), GET_PKT_LEN(p));
if (np == NULL) {
SCLogDebug("The packet received from packet allocation is NULL");
SCPerfCounterIncr(stt->counter_tcp_pseudo_failed, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_pseudo_failed, tv->perf_private_ctx);
SCReturn;
}
PKT_SET_SRC(np, PKT_SRC_STREAM_TCP_STREAM_END_PSEUDO);
@ -5931,7 +5931,7 @@ void StreamTcpPseudoPacketCreateStreamEndPacket(ThreadVars *tv, StreamTcpThread
PacketEnqueue(pq, np);
SCPerfCounterIncr(stt->counter_tcp_pseudo, tv->sc_perf_pca);
SCPerfCounterIncr(stt->counter_tcp_pseudo, tv->perf_private_ctx);
SCReturn;
}

@ -107,7 +107,7 @@ typedef struct ThreadVars_ {
SCPerfPublicContext perf_public_ctx;
/** private counter store: counter updates modify this */
SCPerfPrivateContext *sc_perf_pca;
SCPerfPrivateContext *perf_private_ctx;
SCCtrlMutex *ctrl_mutex;
SCCtrlCondT *ctrl_cond;

@ -322,7 +322,7 @@ void *TmThreadsSlotPktAcqLoop(void *td)
}
}
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->perf_public_ctx);
tv->perf_private_ctx = SCPerfGetAllCountersArray(&tv->perf_public_ctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ?
tv->thread_group_name : tv->name, &tv->perf_public_ctx);
@ -455,7 +455,7 @@ void *TmThreadsSlotVar(void *td)
}
}
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->perf_public_ctx);
tv->perf_private_ctx = SCPerfGetAllCountersArray(&tv->perf_public_ctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ?
tv->thread_group_name : tv->name, &tv->perf_public_ctx);
@ -597,7 +597,7 @@ static void *TmThreadsManagement(void *td)
memset(&s->slot_pre_pq, 0, sizeof(PacketQueue));
memset(&s->slot_post_pq, 0, sizeof(PacketQueue));
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->perf_public_ctx);
tv->perf_private_ctx = SCPerfGetAllCountersArray(&tv->perf_public_ctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ?
tv->thread_group_name : tv->name, &tv->perf_public_ctx);

@ -868,7 +868,7 @@ static TmEcode UnixManager(ThreadVars *th_v, void *thread_data)
/* set the thread name */
SCLogDebug("%s started...", th_v->name);
th_v->sc_perf_pca = SCPerfGetAllCountersArray(&th_v->perf_public_ctx);
th_v->perf_private_ctx = SCPerfGetAllCountersArray(&th_v->perf_public_ctx);
SCPerfAddToClubbedTMTable(th_v->name, &th_v->perf_public_ctx);
if (UnixNew(&command) == 0) {

Loading…
Cancel
Save