mirror of
https://github.com/OISF/suricata.git
synced 2026-05-28 04:32:12 -04:00
counters: remove ThreadVars from counter registration
Just pass the StatsThreadContext pointer directly.
This commit is contained in:
parent
419bbc79cc
commit
7c0776abeb
21 changed files with 254 additions and 233 deletions
|
|
@ -585,8 +585,10 @@ static void *NapatechStatsLoop(void *arg)
|
|||
#ifdef NAPATECH_ENABLE_BYPASS
|
||||
FlowStatsCounters flow_counters;
|
||||
if (bypass_supported) {
|
||||
flow_counters.active_bypass_flows = StatsRegisterCounter("napa_bypass.active_flows", tv);
|
||||
flow_counters.total_bypass_flows = StatsRegisterCounter("napa_bypass.total_flows", tv);
|
||||
flow_counters.active_bypass_flows =
|
||||
StatsRegisterCounter("napa_bypass.active_flows", &tv->stats);
|
||||
flow_counters.total_bypass_flows =
|
||||
StatsRegisterCounter("napa_bypass.total_flows", &tv->stats);
|
||||
}
|
||||
#endif /* NAPATECH_ENABLE_BYPASS */
|
||||
|
||||
|
|
|
|||
|
|
@ -573,10 +573,10 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, const void *initdata, void **dat
|
|||
}
|
||||
}
|
||||
|
||||
ptv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets", ptv->tv);
|
||||
ptv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops", ptv->tv);
|
||||
ptv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets", &ptv->tv->stats);
|
||||
ptv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops", &ptv->tv->stats);
|
||||
#ifdef HAVE_PF_RING_FLOW_OFFLOAD
|
||||
ptv->capture_bypassed = StatsRegisterCounter("capture.bypassed", ptv->tv);
|
||||
ptv->capture_bypassed = StatsRegisterCounter("capture.bypassed", &ptv->tv->stats);
|
||||
#endif
|
||||
|
||||
/* If kernel is older than 3.0, VLAN is not stripped so we don't
|
||||
|
|
|
|||
|
|
@ -1312,7 +1312,7 @@ void AppLayerRegisterThreadCounters(ThreadVars *tv)
|
|||
for (enum ExceptionPolicy i = EXCEPTION_POLICY_NOT_SET + 1; i < EXCEPTION_POLICY_MAX; i++) {
|
||||
if (IsAppLayerErrorExceptionPolicyStatsValid(i)) {
|
||||
eps_error_summary.eps_id[i] =
|
||||
StatsRegisterCounter(app_layer_error_eps_stats.eps_name[i], tv);
|
||||
StatsRegisterCounter(app_layer_error_eps_stats.eps_name[i], &tv->stats);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1323,25 +1323,25 @@ void AppLayerRegisterThreadCounters(ThreadVars *tv)
|
|||
|
||||
for (AppProto alproto = 0; alproto < g_alproto_max; alproto++) {
|
||||
if (alprotos[alproto] == 1) {
|
||||
applayer_counters[alproto][ipproto_map].counter_id =
|
||||
StatsRegisterCounter(applayer_counter_names[alproto][ipproto_map].name, tv);
|
||||
applayer_counters[alproto][ipproto_map].counter_id = StatsRegisterCounter(
|
||||
applayer_counter_names[alproto][ipproto_map].name, &tv->stats);
|
||||
|
||||
if (AppLayerParserProtoIsRegistered(ipproto, alproto) != 1)
|
||||
continue;
|
||||
|
||||
applayer_counters[alproto][ipproto_map].counter_tx_id = StatsRegisterCounter(
|
||||
applayer_counter_names[alproto][ipproto_map].tx_name, tv);
|
||||
applayer_counter_names[alproto][ipproto_map].tx_name, &tv->stats);
|
||||
|
||||
if (ipproto == IPPROTO_TCP) {
|
||||
applayer_counters[alproto][ipproto_map].gap_error_id = StatsRegisterCounter(
|
||||
applayer_counter_names[alproto][ipproto_map].gap_error, tv);
|
||||
applayer_counter_names[alproto][ipproto_map].gap_error, &tv->stats);
|
||||
}
|
||||
applayer_counters[alproto][ipproto_map].alloc_error_id = StatsRegisterCounter(
|
||||
applayer_counter_names[alproto][ipproto_map].alloc_error, tv);
|
||||
applayer_counter_names[alproto][ipproto_map].alloc_error, &tv->stats);
|
||||
applayer_counters[alproto][ipproto_map].parser_error_id = StatsRegisterCounter(
|
||||
applayer_counter_names[alproto][ipproto_map].parser_error, tv);
|
||||
applayer_counter_names[alproto][ipproto_map].parser_error, &tv->stats);
|
||||
applayer_counters[alproto][ipproto_map].internal_error_id = StatsRegisterCounter(
|
||||
applayer_counter_names[alproto][ipproto_map].internal_error, tv);
|
||||
applayer_counter_names[alproto][ipproto_map].internal_error, &tv->stats);
|
||||
/* We don't log stats counters if exception policy is `ignore`/`not set` */
|
||||
if (g_stats_eps_per_app_proto_errors &&
|
||||
g_applayerparser_error_policy != EXCEPTION_POLICY_NOT_SET) {
|
||||
|
|
@ -1350,17 +1350,18 @@ void AppLayerRegisterThreadCounters(ThreadVars *tv)
|
|||
if (IsAppLayerErrorExceptionPolicyStatsValid(i)) {
|
||||
applayer_counters[alproto][ipproto_map]
|
||||
.eps_error.eps_id[i] = StatsRegisterCounter(
|
||||
applayer_counter_names[alproto][ipproto_map].eps_name[i], tv);
|
||||
applayer_counter_names[alproto][ipproto_map].eps_name[i],
|
||||
&tv->stats);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (alproto == ALPROTO_FAILED) {
|
||||
applayer_counters[alproto][ipproto_map].counter_id =
|
||||
StatsRegisterCounter(applayer_counter_names[alproto][ipproto_map].name, tv);
|
||||
applayer_counters[alproto][ipproto_map].counter_id = StatsRegisterCounter(
|
||||
applayer_counter_names[alproto][ipproto_map].name, &tv->stats);
|
||||
|
||||
if (ipproto == IPPROTO_TCP) {
|
||||
applayer_counters[alproto][ipproto_map].gap_error_id = StatsRegisterCounter(
|
||||
applayer_counter_names[alproto][ipproto_map].gap_error, tv);
|
||||
applayer_counter_names[alproto][ipproto_map].gap_error, &tv->stats);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -998,9 +998,9 @@ void StatsSpawnThreads(void)
|
|||
* \retval id Counter id for the newly registered counter, or the already
|
||||
* present counter
|
||||
*/
|
||||
StatsCounterId StatsRegisterCounter(const char *name, struct ThreadVars_ *tv)
|
||||
StatsCounterId StatsRegisterCounter(const char *name, StatsThreadContext *stats)
|
||||
{
|
||||
uint16_t id = StatsRegisterQualifiedCounter(name, &tv->stats.pub, STATS_TYPE_NORMAL, NULL);
|
||||
uint16_t id = StatsRegisterQualifiedCounter(name, &stats->pub, STATS_TYPE_NORMAL, NULL);
|
||||
StatsCounterId s = { .id = id };
|
||||
return s;
|
||||
}
|
||||
|
|
@ -1016,9 +1016,9 @@ StatsCounterId StatsRegisterCounter(const char *name, struct ThreadVars_ *tv)
|
|||
* \retval id Counter id for the newly registered counter, or the already
|
||||
* present counter
|
||||
*/
|
||||
StatsCounterAvgId StatsRegisterAvgCounter(const char *name, struct ThreadVars_ *tv)
|
||||
StatsCounterAvgId StatsRegisterAvgCounter(const char *name, StatsThreadContext *stats)
|
||||
{
|
||||
uint16_t id = StatsRegisterQualifiedCounter(name, &tv->stats.pub, STATS_TYPE_AVERAGE, NULL);
|
||||
uint16_t id = StatsRegisterQualifiedCounter(name, &stats->pub, STATS_TYPE_AVERAGE, NULL);
|
||||
StatsCounterAvgId s = { .id = id };
|
||||
return s;
|
||||
}
|
||||
|
|
@ -1034,9 +1034,9 @@ StatsCounterAvgId StatsRegisterAvgCounter(const char *name, struct ThreadVars_ *
|
|||
* \retval the counter id for the newly registered counter, or the already
|
||||
* present counter
|
||||
*/
|
||||
StatsCounterMaxId StatsRegisterMaxCounter(const char *name, struct ThreadVars_ *tv)
|
||||
StatsCounterMaxId StatsRegisterMaxCounter(const char *name, StatsThreadContext *stats)
|
||||
{
|
||||
uint16_t id = StatsRegisterQualifiedCounter(name, &tv->stats.pub, STATS_TYPE_MAXIMUM, NULL);
|
||||
uint16_t id = StatsRegisterQualifiedCounter(name, &stats->pub, STATS_TYPE_MAXIMUM, NULL);
|
||||
StatsCounterMaxId s = { .id = id };
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2007-2015 Open Information Security Foundation
|
||||
/* Copyright (C) 2007-2025 Open Information Security Foundation
|
||||
*
|
||||
* You can copy, redistribute or modify this Program under the terms of
|
||||
* the GNU General Public License version 2 as published by the Free
|
||||
|
|
@ -27,9 +27,6 @@
|
|||
|
||||
#include "threads.h"
|
||||
|
||||
/* forward declaration of the ThreadVars structure */
|
||||
struct ThreadVars_;
|
||||
|
||||
typedef struct StatsCounterId {
|
||||
uint16_t id;
|
||||
} StatsCounterId;
|
||||
|
|
@ -133,9 +130,9 @@ bool StatsEnabled(void);
|
|||
void StatsReleaseResources(void);
|
||||
|
||||
/* counter registration functions */
|
||||
StatsCounterId StatsRegisterCounter(const char *, struct ThreadVars_ *);
|
||||
StatsCounterAvgId StatsRegisterAvgCounter(const char *, struct ThreadVars_ *);
|
||||
StatsCounterMaxId StatsRegisterMaxCounter(const char *, struct ThreadVars_ *);
|
||||
StatsCounterId StatsRegisterCounter(const char *, StatsThreadContext *);
|
||||
StatsCounterAvgId StatsRegisterAvgCounter(const char *, StatsThreadContext *);
|
||||
StatsCounterMaxId StatsRegisterMaxCounter(const char *, StatsThreadContext *);
|
||||
StatsCounterGlobalId StatsRegisterGlobalCounter(const char *cname, uint64_t (*Func)(void));
|
||||
|
||||
/* functions used to update local counter values */
|
||||
|
|
|
|||
178
src/decode.c
178
src/decode.c
|
|
@ -632,90 +632,100 @@ static bool IsFlowMemcapExceptionPolicyStatsValid(enum ExceptionPolicy policy)
|
|||
void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
|
||||
{
|
||||
/* register counters */
|
||||
dtv->counter_pkts = StatsRegisterCounter("decoder.pkts", tv);
|
||||
dtv->counter_bytes = StatsRegisterCounter("decoder.bytes", tv);
|
||||
dtv->counter_invalid = StatsRegisterCounter("decoder.invalid", tv);
|
||||
dtv->counter_ipv4 = StatsRegisterCounter("decoder.ipv4", tv);
|
||||
dtv->counter_ipv6 = StatsRegisterCounter("decoder.ipv6", tv);
|
||||
dtv->counter_eth = StatsRegisterCounter("decoder.ethernet", tv);
|
||||
dtv->counter_arp = StatsRegisterCounter("decoder.arp", tv);
|
||||
dtv->counter_ethertype_unknown = StatsRegisterCounter("decoder.unknown_ethertype", tv);
|
||||
dtv->counter_chdlc = StatsRegisterCounter("decoder.chdlc", tv);
|
||||
dtv->counter_raw = StatsRegisterCounter("decoder.raw", tv);
|
||||
dtv->counter_null = StatsRegisterCounter("decoder.null", tv);
|
||||
dtv->counter_sll = StatsRegisterCounter("decoder.sll", tv);
|
||||
dtv->counter_sll2 = StatsRegisterCounter("decoder.sll2", tv);
|
||||
dtv->counter_tcp = StatsRegisterCounter("decoder.tcp", tv);
|
||||
dtv->counter_pkts = StatsRegisterCounter("decoder.pkts", &tv->stats);
|
||||
dtv->counter_bytes = StatsRegisterCounter("decoder.bytes", &tv->stats);
|
||||
dtv->counter_invalid = StatsRegisterCounter("decoder.invalid", &tv->stats);
|
||||
dtv->counter_ipv4 = StatsRegisterCounter("decoder.ipv4", &tv->stats);
|
||||
dtv->counter_ipv6 = StatsRegisterCounter("decoder.ipv6", &tv->stats);
|
||||
dtv->counter_eth = StatsRegisterCounter("decoder.ethernet", &tv->stats);
|
||||
dtv->counter_arp = StatsRegisterCounter("decoder.arp", &tv->stats);
|
||||
dtv->counter_ethertype_unknown = StatsRegisterCounter("decoder.unknown_ethertype", &tv->stats);
|
||||
dtv->counter_chdlc = StatsRegisterCounter("decoder.chdlc", &tv->stats);
|
||||
dtv->counter_raw = StatsRegisterCounter("decoder.raw", &tv->stats);
|
||||
dtv->counter_null = StatsRegisterCounter("decoder.null", &tv->stats);
|
||||
dtv->counter_sll = StatsRegisterCounter("decoder.sll", &tv->stats);
|
||||
dtv->counter_sll2 = StatsRegisterCounter("decoder.sll2", &tv->stats);
|
||||
dtv->counter_tcp = StatsRegisterCounter("decoder.tcp", &tv->stats);
|
||||
|
||||
dtv->counter_tcp_syn = StatsRegisterCounter("tcp.syn", tv);
|
||||
dtv->counter_tcp_synack = StatsRegisterCounter("tcp.synack", tv);
|
||||
dtv->counter_tcp_rst = StatsRegisterCounter("tcp.rst", tv);
|
||||
dtv->counter_tcp_urg = StatsRegisterCounter("tcp.urg", tv);
|
||||
dtv->counter_tcp_syn = StatsRegisterCounter("tcp.syn", &tv->stats);
|
||||
dtv->counter_tcp_synack = StatsRegisterCounter("tcp.synack", &tv->stats);
|
||||
dtv->counter_tcp_rst = StatsRegisterCounter("tcp.rst", &tv->stats);
|
||||
dtv->counter_tcp_urg = StatsRegisterCounter("tcp.urg", &tv->stats);
|
||||
|
||||
dtv->counter_udp = StatsRegisterCounter("decoder.udp", tv);
|
||||
dtv->counter_sctp = StatsRegisterCounter("decoder.sctp", tv);
|
||||
dtv->counter_esp = StatsRegisterCounter("decoder.esp", tv);
|
||||
dtv->counter_icmpv4 = StatsRegisterCounter("decoder.icmpv4", tv);
|
||||
dtv->counter_icmpv6 = StatsRegisterCounter("decoder.icmpv6", tv);
|
||||
dtv->counter_ppp = StatsRegisterCounter("decoder.ppp", tv);
|
||||
dtv->counter_pppoe = StatsRegisterCounter("decoder.pppoe", tv);
|
||||
dtv->counter_geneve = StatsRegisterCounter("decoder.geneve", tv);
|
||||
dtv->counter_gre = StatsRegisterCounter("decoder.gre", tv);
|
||||
dtv->counter_vlan = StatsRegisterCounter("decoder.vlan", tv);
|
||||
dtv->counter_vlan_qinq = StatsRegisterCounter("decoder.vlan_qinq", tv);
|
||||
dtv->counter_vlan_qinqinq = StatsRegisterCounter("decoder.vlan_qinqinq", tv);
|
||||
dtv->counter_vxlan = StatsRegisterCounter("decoder.vxlan", tv);
|
||||
dtv->counter_vntag = StatsRegisterCounter("decoder.vntag", tv);
|
||||
dtv->counter_etag = StatsRegisterCounter("decoder.etag", tv);
|
||||
dtv->counter_ieee8021ah = StatsRegisterCounter("decoder.ieee8021ah", tv);
|
||||
dtv->counter_teredo = StatsRegisterCounter("decoder.teredo", tv);
|
||||
dtv->counter_ipv4inipv4 = StatsRegisterCounter("decoder.ipv4_in_ipv4", tv);
|
||||
dtv->counter_ipv6inipv4 = StatsRegisterCounter("decoder.ipv6_in_ipv4", tv);
|
||||
dtv->counter_ipv4inipv6 = StatsRegisterCounter("decoder.ipv4_in_ipv6", tv);
|
||||
dtv->counter_ipv6inipv6 = StatsRegisterCounter("decoder.ipv6_in_ipv6", tv);
|
||||
dtv->counter_mpls = StatsRegisterCounter("decoder.mpls", tv);
|
||||
dtv->counter_avg_pkt_size = StatsRegisterAvgCounter("decoder.avg_pkt_size", tv);
|
||||
dtv->counter_max_pkt_size = StatsRegisterMaxCounter("decoder.max_pkt_size", tv);
|
||||
dtv->counter_max_mac_addrs_src = StatsRegisterMaxCounter("decoder.max_mac_addrs_src", tv);
|
||||
dtv->counter_max_mac_addrs_dst = StatsRegisterMaxCounter("decoder.max_mac_addrs_dst", tv);
|
||||
dtv->counter_erspan = StatsRegisterCounter("decoder.erspan", tv);
|
||||
dtv->counter_nsh = StatsRegisterCounter("decoder.nsh", tv);
|
||||
dtv->counter_flow_memcap = StatsRegisterCounter("flow.memcap", tv);
|
||||
dtv->counter_udp = StatsRegisterCounter("decoder.udp", &tv->stats);
|
||||
dtv->counter_sctp = StatsRegisterCounter("decoder.sctp", &tv->stats);
|
||||
dtv->counter_esp = StatsRegisterCounter("decoder.esp", &tv->stats);
|
||||
dtv->counter_icmpv4 = StatsRegisterCounter("decoder.icmpv4", &tv->stats);
|
||||
dtv->counter_icmpv6 = StatsRegisterCounter("decoder.icmpv6", &tv->stats);
|
||||
dtv->counter_ppp = StatsRegisterCounter("decoder.ppp", &tv->stats);
|
||||
dtv->counter_pppoe = StatsRegisterCounter("decoder.pppoe", &tv->stats);
|
||||
dtv->counter_geneve = StatsRegisterCounter("decoder.geneve", &tv->stats);
|
||||
dtv->counter_gre = StatsRegisterCounter("decoder.gre", &tv->stats);
|
||||
dtv->counter_vlan = StatsRegisterCounter("decoder.vlan", &tv->stats);
|
||||
dtv->counter_vlan_qinq = StatsRegisterCounter("decoder.vlan_qinq", &tv->stats);
|
||||
dtv->counter_vlan_qinqinq = StatsRegisterCounter("decoder.vlan_qinqinq", &tv->stats);
|
||||
dtv->counter_vxlan = StatsRegisterCounter("decoder.vxlan", &tv->stats);
|
||||
dtv->counter_vntag = StatsRegisterCounter("decoder.vntag", &tv->stats);
|
||||
dtv->counter_etag = StatsRegisterCounter("decoder.etag", &tv->stats);
|
||||
dtv->counter_ieee8021ah = StatsRegisterCounter("decoder.ieee8021ah", &tv->stats);
|
||||
dtv->counter_teredo = StatsRegisterCounter("decoder.teredo", &tv->stats);
|
||||
dtv->counter_ipv4inipv4 = StatsRegisterCounter("decoder.ipv4_in_ipv4", &tv->stats);
|
||||
dtv->counter_ipv6inipv4 = StatsRegisterCounter("decoder.ipv6_in_ipv4", &tv->stats);
|
||||
dtv->counter_ipv4inipv6 = StatsRegisterCounter("decoder.ipv4_in_ipv6", &tv->stats);
|
||||
dtv->counter_ipv6inipv6 = StatsRegisterCounter("decoder.ipv6_in_ipv6", &tv->stats);
|
||||
dtv->counter_mpls = StatsRegisterCounter("decoder.mpls", &tv->stats);
|
||||
dtv->counter_avg_pkt_size = StatsRegisterAvgCounter("decoder.avg_pkt_size", &tv->stats);
|
||||
dtv->counter_max_pkt_size = StatsRegisterMaxCounter("decoder.max_pkt_size", &tv->stats);
|
||||
dtv->counter_max_mac_addrs_src =
|
||||
StatsRegisterMaxCounter("decoder.max_mac_addrs_src", &tv->stats);
|
||||
dtv->counter_max_mac_addrs_dst =
|
||||
StatsRegisterMaxCounter("decoder.max_mac_addrs_dst", &tv->stats);
|
||||
dtv->counter_erspan = StatsRegisterCounter("decoder.erspan", &tv->stats);
|
||||
dtv->counter_nsh = StatsRegisterCounter("decoder.nsh", &tv->stats);
|
||||
dtv->counter_flow_memcap = StatsRegisterCounter("flow.memcap", &tv->stats);
|
||||
ExceptionPolicySetStatsCounters(tv, &dtv->counter_flow_memcap_eps, &flow_memcap_eps_stats,
|
||||
FlowGetMemcapExceptionPolicy(), "exception_policy.flow.memcap.",
|
||||
IsFlowMemcapExceptionPolicyStatsValid);
|
||||
|
||||
dtv->counter_tcp_active_sessions = StatsRegisterCounter("tcp.active_sessions", tv);
|
||||
dtv->counter_flow_total = StatsRegisterCounter("flow.total", tv);
|
||||
dtv->counter_flow_active = StatsRegisterCounter("flow.active", tv);
|
||||
dtv->counter_flow_tcp = StatsRegisterCounter("flow.tcp", tv);
|
||||
dtv->counter_flow_udp = StatsRegisterCounter("flow.udp", tv);
|
||||
dtv->counter_flow_icmp4 = StatsRegisterCounter("flow.icmpv4", tv);
|
||||
dtv->counter_flow_icmp6 = StatsRegisterCounter("flow.icmpv6", tv);
|
||||
dtv->counter_flow_tcp_reuse = StatsRegisterCounter("flow.tcp_reuse", tv);
|
||||
dtv->counter_flow_elephant = StatsRegisterCounter("flow.elephant", tv);
|
||||
dtv->counter_flow_get_used = StatsRegisterCounter("flow.get_used", tv);
|
||||
dtv->counter_flow_get_used_eval = StatsRegisterCounter("flow.get_used_eval", tv);
|
||||
dtv->counter_flow_get_used_eval_reject = StatsRegisterCounter("flow.get_used_eval_reject", tv);
|
||||
dtv->counter_flow_get_used_eval_busy = StatsRegisterCounter("flow.get_used_eval_busy", tv);
|
||||
dtv->counter_flow_get_used_failed = StatsRegisterCounter("flow.get_used_failed", tv);
|
||||
dtv->counter_tcp_active_sessions = StatsRegisterCounter("tcp.active_sessions", &tv->stats);
|
||||
dtv->counter_flow_total = StatsRegisterCounter("flow.total", &tv->stats);
|
||||
dtv->counter_flow_active = StatsRegisterCounter("flow.active", &tv->stats);
|
||||
dtv->counter_flow_tcp = StatsRegisterCounter("flow.tcp", &tv->stats);
|
||||
dtv->counter_flow_udp = StatsRegisterCounter("flow.udp", &tv->stats);
|
||||
dtv->counter_flow_icmp4 = StatsRegisterCounter("flow.icmpv4", &tv->stats);
|
||||
dtv->counter_flow_icmp6 = StatsRegisterCounter("flow.icmpv6", &tv->stats);
|
||||
dtv->counter_flow_tcp_reuse = StatsRegisterCounter("flow.tcp_reuse", &tv->stats);
|
||||
dtv->counter_flow_elephant = StatsRegisterCounter("flow.elephant", &tv->stats);
|
||||
dtv->counter_flow_get_used = StatsRegisterCounter("flow.get_used", &tv->stats);
|
||||
dtv->counter_flow_get_used_eval = StatsRegisterCounter("flow.get_used_eval", &tv->stats);
|
||||
dtv->counter_flow_get_used_eval_reject =
|
||||
StatsRegisterCounter("flow.get_used_eval_reject", &tv->stats);
|
||||
dtv->counter_flow_get_used_eval_busy =
|
||||
StatsRegisterCounter("flow.get_used_eval_busy", &tv->stats);
|
||||
dtv->counter_flow_get_used_failed = StatsRegisterCounter("flow.get_used_failed", &tv->stats);
|
||||
|
||||
dtv->counter_flow_spare_sync_avg = StatsRegisterAvgCounter("flow.wrk.spare_sync_avg", tv);
|
||||
dtv->counter_flow_spare_sync = StatsRegisterCounter("flow.wrk.spare_sync", tv);
|
||||
dtv->counter_flow_spare_sync_incomplete = StatsRegisterCounter("flow.wrk.spare_sync_incomplete", tv);
|
||||
dtv->counter_flow_spare_sync_empty = StatsRegisterCounter("flow.wrk.spare_sync_empty", tv);
|
||||
dtv->counter_flow_spare_sync_avg =
|
||||
StatsRegisterAvgCounter("flow.wrk.spare_sync_avg", &tv->stats);
|
||||
dtv->counter_flow_spare_sync = StatsRegisterCounter("flow.wrk.spare_sync", &tv->stats);
|
||||
dtv->counter_flow_spare_sync_incomplete =
|
||||
StatsRegisterCounter("flow.wrk.spare_sync_incomplete", &tv->stats);
|
||||
dtv->counter_flow_spare_sync_empty =
|
||||
StatsRegisterCounter("flow.wrk.spare_sync_empty", &tv->stats);
|
||||
|
||||
dtv->counter_defrag_ipv4_fragments =
|
||||
StatsRegisterCounter("defrag.ipv4.fragments", tv);
|
||||
dtv->counter_defrag_ipv4_reassembled = StatsRegisterCounter("defrag.ipv4.reassembled", tv);
|
||||
dtv->counter_defrag_ipv6_fragments =
|
||||
StatsRegisterCounter("defrag.ipv6.fragments", tv);
|
||||
dtv->counter_defrag_ipv6_reassembled = StatsRegisterCounter("defrag.ipv6.reassembled", tv);
|
||||
dtv->counter_defrag_max_hit = StatsRegisterCounter("defrag.max_trackers_reached", tv);
|
||||
dtv->counter_defrag_no_frags = StatsRegisterCounter("defrag.max_frags_reached", tv);
|
||||
dtv->counter_defrag_tracker_soft_reuse = StatsRegisterCounter("defrag.tracker_soft_reuse", tv);
|
||||
dtv->counter_defrag_tracker_hard_reuse = StatsRegisterCounter("defrag.tracker_hard_reuse", tv);
|
||||
dtv->counter_defrag_tracker_timeout = StatsRegisterCounter("defrag.wrk.tracker_timeout", tv);
|
||||
dtv->counter_defrag_ipv4_fragments = StatsRegisterCounter("defrag.ipv4.fragments", &tv->stats);
|
||||
dtv->counter_defrag_ipv4_reassembled =
|
||||
StatsRegisterCounter("defrag.ipv4.reassembled", &tv->stats);
|
||||
dtv->counter_defrag_ipv6_fragments = StatsRegisterCounter("defrag.ipv6.fragments", &tv->stats);
|
||||
dtv->counter_defrag_ipv6_reassembled =
|
||||
StatsRegisterCounter("defrag.ipv6.reassembled", &tv->stats);
|
||||
dtv->counter_defrag_max_hit = StatsRegisterCounter("defrag.max_trackers_reached", &tv->stats);
|
||||
dtv->counter_defrag_no_frags = StatsRegisterCounter("defrag.max_frags_reached", &tv->stats);
|
||||
dtv->counter_defrag_tracker_soft_reuse =
|
||||
StatsRegisterCounter("defrag.tracker_soft_reuse", &tv->stats);
|
||||
dtv->counter_defrag_tracker_hard_reuse =
|
||||
StatsRegisterCounter("defrag.tracker_hard_reuse", &tv->stats);
|
||||
dtv->counter_defrag_tracker_timeout =
|
||||
StatsRegisterCounter("defrag.wrk.tracker_timeout", &tv->stats);
|
||||
|
||||
ExceptionPolicySetStatsCounters(tv, &dtv->counter_defrag_memcap_eps, &defrag_memcap_eps_stats,
|
||||
DefragGetMemcapExceptionPolicy(), "exception_policy.defrag.memcap.",
|
||||
|
|
@ -761,13 +771,11 @@ void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
|
|||
"table name add failed");
|
||||
found = add;
|
||||
}
|
||||
dtv->counter_engine_events[i] = StatsRegisterCounter(
|
||||
found, tv);
|
||||
dtv->counter_engine_events[i] = StatsRegisterCounter(found, &tv->stats);
|
||||
|
||||
SCMutexUnlock(&g_counter_table_mutex);
|
||||
} else {
|
||||
dtv->counter_engine_events[i] = StatsRegisterCounter(
|
||||
DEvents[i].event_name, tv);
|
||||
dtv->counter_engine_events[i] = StatsRegisterCounter(DEvents[i].event_name, &tv->stats);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1039,14 +1047,14 @@ void CaptureStatsSetup(ThreadVars *tv)
|
|||
{
|
||||
if (EngineModeIsIPS()) {
|
||||
CaptureStats *s = &t_capture_stats;
|
||||
s->counter_ips_accepted = StatsRegisterCounter("ips.accepted", tv);
|
||||
s->counter_ips_blocked = StatsRegisterCounter("ips.blocked", tv);
|
||||
s->counter_ips_rejected = StatsRegisterCounter("ips.rejected", tv);
|
||||
s->counter_ips_replaced = StatsRegisterCounter("ips.replaced", tv);
|
||||
s->counter_ips_accepted = StatsRegisterCounter("ips.accepted", &tv->stats);
|
||||
s->counter_ips_blocked = StatsRegisterCounter("ips.blocked", &tv->stats);
|
||||
s->counter_ips_rejected = StatsRegisterCounter("ips.rejected", &tv->stats);
|
||||
s->counter_ips_replaced = StatsRegisterCounter("ips.replaced", &tv->stats);
|
||||
for (int i = PKT_DROP_REASON_NOT_SET; i < PKT_DROP_REASON_MAX; i++) {
|
||||
const char *name = PacketDropReasonToJsonString(i);
|
||||
if (name != NULL)
|
||||
s->counter_drop_reason[i] = StatsRegisterCounter(name, tv);
|
||||
s->counter_drop_reason[i] = StatsRegisterCounter(name, &tv->stats);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3393,31 +3393,34 @@ TmEcode DetectEngineThreadCtxInit(ThreadVars *tv, void *initdata, void **data)
|
|||
}
|
||||
|
||||
/** alert counter setup */
|
||||
det_ctx->counter_alerts = StatsRegisterCounter("detect.alert", tv);
|
||||
det_ctx->counter_alerts_overflow = StatsRegisterCounter("detect.alert_queue_overflow", tv);
|
||||
det_ctx->counter_alerts_suppressed = StatsRegisterCounter("detect.alerts_suppressed", tv);
|
||||
det_ctx->counter_alerts = StatsRegisterCounter("detect.alert", &tv->stats);
|
||||
det_ctx->counter_alerts_overflow =
|
||||
StatsRegisterCounter("detect.alert_queue_overflow", &tv->stats);
|
||||
det_ctx->counter_alerts_suppressed =
|
||||
StatsRegisterCounter("detect.alerts_suppressed", &tv->stats);
|
||||
|
||||
/* Register counter for Lua rule errors. */
|
||||
det_ctx->lua_rule_errors = StatsRegisterCounter("detect.lua.errors", tv);
|
||||
det_ctx->lua_rule_errors = StatsRegisterCounter("detect.lua.errors", &tv->stats);
|
||||
|
||||
/* Register a counter for Lua blocked function attempts. */
|
||||
det_ctx->lua_blocked_function_errors =
|
||||
StatsRegisterCounter("detect.lua.blocked_function_errors", tv);
|
||||
StatsRegisterCounter("detect.lua.blocked_function_errors", &tv->stats);
|
||||
|
||||
/* Register a counter for Lua instruction limit errors. */
|
||||
det_ctx->lua_instruction_limit_errors =
|
||||
StatsRegisterCounter("detect.lua.instruction_limit_errors", tv);
|
||||
StatsRegisterCounter("detect.lua.instruction_limit_errors", &tv->stats);
|
||||
|
||||
/* Register a counter for Lua memory limit errors. */
|
||||
det_ctx->lua_memory_limit_errors = StatsRegisterCounter("detect.lua.memory_limit_errors", tv);
|
||||
det_ctx->lua_memory_limit_errors =
|
||||
StatsRegisterCounter("detect.lua.memory_limit_errors", &tv->stats);
|
||||
|
||||
det_ctx->json_content = NULL;
|
||||
det_ctx->json_content_capacity = 0;
|
||||
det_ctx->json_content_len = 0;
|
||||
|
||||
#ifdef PROFILING
|
||||
det_ctx->counter_mpm_list = StatsRegisterAvgCounter("detect.mpm_list", tv);
|
||||
det_ctx->counter_match_list = StatsRegisterAvgCounter("detect.match_list", tv);
|
||||
det_ctx->counter_mpm_list = StatsRegisterAvgCounter("detect.mpm_list", &tv->stats);
|
||||
det_ctx->counter_match_list = StatsRegisterAvgCounter("detect.match_list", &tv->stats);
|
||||
#endif
|
||||
|
||||
if (DetectEngineMultiTenantEnabled()) {
|
||||
|
|
@ -3473,12 +3476,14 @@ DetectEngineThreadCtx *DetectEngineThreadCtxInitForReload(
|
|||
}
|
||||
|
||||
/** alert counter setup */
|
||||
det_ctx->counter_alerts = StatsRegisterCounter("detect.alert", tv);
|
||||
det_ctx->counter_alerts_overflow = StatsRegisterCounter("detect.alert_queue_overflow", tv);
|
||||
det_ctx->counter_alerts_suppressed = StatsRegisterCounter("detect.alerts_suppressed", tv);
|
||||
det_ctx->counter_alerts = StatsRegisterCounter("detect.alert", &tv->stats);
|
||||
det_ctx->counter_alerts_overflow =
|
||||
StatsRegisterCounter("detect.alert_queue_overflow", &tv->stats);
|
||||
det_ctx->counter_alerts_suppressed =
|
||||
StatsRegisterCounter("detect.alerts_suppressed", &tv->stats);
|
||||
#ifdef PROFILING
|
||||
det_ctx->counter_mpm_list = StatsRegisterAvgCounter("detect.mpm_list", tv);
|
||||
det_ctx->counter_match_list = StatsRegisterAvgCounter("detect.match_list", tv);
|
||||
det_ctx->counter_mpm_list = StatsRegisterAvgCounter("detect.mpm_list", &tv->stats);
|
||||
det_ctx->counter_match_list = StatsRegisterAvgCounter("detect.match_list", &tv->stats);
|
||||
#endif
|
||||
|
||||
if (mt && DetectEngineMultiTenantEnabledWithLock()) {
|
||||
|
|
|
|||
|
|
@ -139,9 +139,9 @@ static TmEcode BypassedFlowManagerThreadInit(ThreadVars *t, const void *initdata
|
|||
|
||||
*data = ftd;
|
||||
|
||||
ftd->flow_bypassed_cnt_clo = StatsRegisterCounter("flow_bypassed.closed", t);
|
||||
ftd->flow_bypassed_pkts = StatsRegisterCounter("flow_bypassed.pkts", t);
|
||||
ftd->flow_bypassed_bytes = StatsRegisterCounter("flow_bypassed.bytes", t);
|
||||
ftd->flow_bypassed_cnt_clo = StatsRegisterCounter("flow_bypassed.closed", &t->stats);
|
||||
ftd->flow_bypassed_pkts = StatsRegisterCounter("flow_bypassed.pkts", &t->stats);
|
||||
ftd->flow_bypassed_bytes = StatsRegisterCounter("flow_bypassed.bytes", &t->stats);
|
||||
|
||||
return TM_ECODE_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -679,26 +679,27 @@ typedef struct FlowManagerThreadData_ {
|
|||
|
||||
static void FlowCountersInit(ThreadVars *t, FlowCounters *fc)
|
||||
{
|
||||
fc->flow_mgr_full_pass = StatsRegisterCounter("flow.mgr.full_hash_pass", t);
|
||||
fc->flow_mgr_rows_sec = StatsRegisterCounter("flow.mgr.rows_per_sec", t);
|
||||
fc->flow_mgr_full_pass = StatsRegisterCounter("flow.mgr.full_hash_pass", &t->stats);
|
||||
fc->flow_mgr_rows_sec = StatsRegisterCounter("flow.mgr.rows_per_sec", &t->stats);
|
||||
|
||||
fc->flow_mgr_spare = StatsRegisterCounter("flow.spare", t);
|
||||
fc->flow_emerg_mode_enter = StatsRegisterCounter("flow.emerg_mode_entered", t);
|
||||
fc->flow_emerg_mode_over = StatsRegisterCounter("flow.emerg_mode_over", t);
|
||||
fc->flow_mgr_spare = StatsRegisterCounter("flow.spare", &t->stats);
|
||||
fc->flow_emerg_mode_enter = StatsRegisterCounter("flow.emerg_mode_entered", &t->stats);
|
||||
fc->flow_emerg_mode_over = StatsRegisterCounter("flow.emerg_mode_over", &t->stats);
|
||||
|
||||
fc->flow_mgr_rows_maxlen = StatsRegisterMaxCounter("flow.mgr.rows_maxlen", t);
|
||||
fc->flow_mgr_flows_checked = StatsRegisterCounter("flow.mgr.flows_checked", t);
|
||||
fc->flow_mgr_flows_notimeout = StatsRegisterCounter("flow.mgr.flows_notimeout", t);
|
||||
fc->flow_mgr_flows_timeout = StatsRegisterCounter("flow.mgr.flows_timeout", t);
|
||||
fc->flow_mgr_flows_aside = StatsRegisterCounter("flow.mgr.flows_evicted", t);
|
||||
fc->flow_mgr_flows_aside_needs_work = StatsRegisterCounter("flow.mgr.flows_evicted_needs_work", t);
|
||||
fc->flow_mgr_rows_maxlen = StatsRegisterMaxCounter("flow.mgr.rows_maxlen", &t->stats);
|
||||
fc->flow_mgr_flows_checked = StatsRegisterCounter("flow.mgr.flows_checked", &t->stats);
|
||||
fc->flow_mgr_flows_notimeout = StatsRegisterCounter("flow.mgr.flows_notimeout", &t->stats);
|
||||
fc->flow_mgr_flows_timeout = StatsRegisterCounter("flow.mgr.flows_timeout", &t->stats);
|
||||
fc->flow_mgr_flows_aside = StatsRegisterCounter("flow.mgr.flows_evicted", &t->stats);
|
||||
fc->flow_mgr_flows_aside_needs_work =
|
||||
StatsRegisterCounter("flow.mgr.flows_evicted_needs_work", &t->stats);
|
||||
|
||||
fc->flow_bypassed_cnt_clo = StatsRegisterCounter("flow_bypassed.closed", t);
|
||||
fc->flow_bypassed_pkts = StatsRegisterCounter("flow_bypassed.pkts", t);
|
||||
fc->flow_bypassed_bytes = StatsRegisterCounter("flow_bypassed.bytes", t);
|
||||
fc->flow_bypassed_cnt_clo = StatsRegisterCounter("flow_bypassed.closed", &t->stats);
|
||||
fc->flow_bypassed_pkts = StatsRegisterCounter("flow_bypassed.pkts", &t->stats);
|
||||
fc->flow_bypassed_bytes = StatsRegisterCounter("flow_bypassed.bytes", &t->stats);
|
||||
|
||||
fc->memcap_pressure = StatsRegisterCounter("memcap.pressure", t);
|
||||
fc->memcap_pressure_max = StatsRegisterMaxCounter("memcap.pressure_max", t);
|
||||
fc->memcap_pressure = StatsRegisterCounter("memcap.pressure", &t->stats);
|
||||
fc->memcap_pressure_max = StatsRegisterMaxCounter("memcap.pressure_max", &t->stats);
|
||||
}
|
||||
|
||||
static void FlowCountersUpdate(
|
||||
|
|
@ -753,8 +754,8 @@ static TmEcode FlowManagerThreadInit(ThreadVars *t, const void *initdata, void *
|
|||
*data = ftd;
|
||||
|
||||
FlowCountersInit(t, &ftd->cnt);
|
||||
ftd->counter_defrag_timeout = StatsRegisterCounter("defrag.mgr.tracker_timeout", t);
|
||||
ftd->counter_defrag_memuse = StatsRegisterCounter("defrag.memuse", t);
|
||||
ftd->counter_defrag_timeout = StatsRegisterCounter("defrag.mgr.tracker_timeout", &t->stats);
|
||||
ftd->counter_defrag_memuse = StatsRegisterCounter("defrag.memuse", &t->stats);
|
||||
|
||||
PacketPoolInit();
|
||||
return TM_ECODE_OK;
|
||||
|
|
@ -1060,12 +1061,12 @@ static TmEcode FlowRecyclerThreadInit(ThreadVars *t, const void *initdata, void
|
|||
}
|
||||
SCLogDebug("output_thread_data %p", ftd->output_thread_data);
|
||||
|
||||
ftd->counter_flows = StatsRegisterCounter("flow.recycler.recycled", t);
|
||||
ftd->counter_queue_avg = StatsRegisterAvgCounter("flow.recycler.queue_avg", t);
|
||||
ftd->counter_queue_max = StatsRegisterMaxCounter("flow.recycler.queue_max", t);
|
||||
ftd->counter_flows = StatsRegisterCounter("flow.recycler.recycled", &t->stats);
|
||||
ftd->counter_queue_avg = StatsRegisterAvgCounter("flow.recycler.queue_avg", &t->stats);
|
||||
ftd->counter_queue_max = StatsRegisterMaxCounter("flow.recycler.queue_max", &t->stats);
|
||||
|
||||
ftd->counter_flow_active = StatsRegisterCounter("flow.active", t);
|
||||
ftd->counter_tcp_active_sessions = StatsRegisterCounter("tcp.active_sessions", t);
|
||||
ftd->counter_flow_active = StatsRegisterCounter("flow.active", &t->stats);
|
||||
ftd->counter_tcp_active_sessions = StatsRegisterCounter("tcp.active_sessions", &t->stats);
|
||||
|
||||
FlowEndCountersRegister(t, &ftd->fec);
|
||||
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ void FlowEndCountersRegister(ThreadVars *t, FlowEndCounters *fec)
|
|||
#endif
|
||||
}
|
||||
if (name) {
|
||||
fec->flow_state[i] = StatsRegisterCounter(name, t);
|
||||
fec->flow_state[i] = StatsRegisterCounter(name, &t->stats);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -303,7 +303,7 @@ void FlowEndCountersRegister(ThreadVars *t, FlowEndCounters *fec)
|
|||
break;
|
||||
}
|
||||
|
||||
fec->flow_tcp_state[i] = StatsRegisterCounter(name, t);
|
||||
fec->flow_tcp_state[i] = StatsRegisterCounter(name, &t->stats);
|
||||
}
|
||||
fec->flow_tcp_liberal = StatsRegisterCounter("flow.end.tcp_liberal", t);
|
||||
fec->flow_tcp_liberal = StatsRegisterCounter("flow.end.tcp_liberal", &t->stats);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -253,16 +253,18 @@ static TmEcode FlowWorkerThreadInit(ThreadVars *tv, const void *initdata, void *
|
|||
SC_ATOMIC_INITPTR(fw->detect_thread);
|
||||
SC_ATOMIC_SET(fw->detect_thread, NULL);
|
||||
|
||||
fw->local_bypass_pkts = StatsRegisterCounter("flow_bypassed.local_pkts", tv);
|
||||
fw->local_bypass_bytes = StatsRegisterCounter("flow_bypassed.local_bytes", tv);
|
||||
fw->both_bypass_pkts = StatsRegisterCounter("flow_bypassed.local_capture_pkts", tv);
|
||||
fw->both_bypass_bytes = StatsRegisterCounter("flow_bypassed.local_capture_bytes", tv);
|
||||
fw->local_bypass_pkts = StatsRegisterCounter("flow_bypassed.local_pkts", &tv->stats);
|
||||
fw->local_bypass_bytes = StatsRegisterCounter("flow_bypassed.local_bytes", &tv->stats);
|
||||
fw->both_bypass_pkts = StatsRegisterCounter("flow_bypassed.local_capture_pkts", &tv->stats);
|
||||
fw->both_bypass_bytes = StatsRegisterCounter("flow_bypassed.local_capture_bytes", &tv->stats);
|
||||
|
||||
fw->cnt.flows_aside_needs_work = StatsRegisterCounter("flow.wrk.flows_evicted_needs_work", tv);
|
||||
fw->cnt.flows_aside_pkt_inject = StatsRegisterCounter("flow.wrk.flows_evicted_pkt_inject", tv);
|
||||
fw->cnt.flows_removed = StatsRegisterCounter("flow.wrk.flows_evicted", tv);
|
||||
fw->cnt.flows_injected = StatsRegisterCounter("flow.wrk.flows_injected", tv);
|
||||
fw->cnt.flows_injected_max = StatsRegisterMaxCounter("flow.wrk.flows_injected_max", tv);
|
||||
fw->cnt.flows_aside_needs_work =
|
||||
StatsRegisterCounter("flow.wrk.flows_evicted_needs_work", &tv->stats);
|
||||
fw->cnt.flows_aside_pkt_inject =
|
||||
StatsRegisterCounter("flow.wrk.flows_evicted_pkt_inject", &tv->stats);
|
||||
fw->cnt.flows_removed = StatsRegisterCounter("flow.wrk.flows_evicted", &tv->stats);
|
||||
fw->cnt.flows_injected = StatsRegisterCounter("flow.wrk.flows_injected", &tv->stats);
|
||||
fw->cnt.flows_injected_max = StatsRegisterMaxCounter("flow.wrk.flows_injected_max", &tv->stats);
|
||||
|
||||
fw->fls.dtv = fw->dtv = DecodeThreadVarsAlloc(tv);
|
||||
if (fw->dtv == NULL) {
|
||||
|
|
|
|||
|
|
@ -1053,8 +1053,8 @@ static TmEcode PcapLogDataInit(ThreadVars *t, const void *initdata, void **data)
|
|||
if (unlikely(td == NULL))
|
||||
return TM_ECODE_FAILED;
|
||||
|
||||
td->counter_written = StatsRegisterCounter("pcap_log.written", t);
|
||||
td->counter_filtered_bpf = StatsRegisterCounter("pcap_log.filtered_bpf", t);
|
||||
td->counter_written = StatsRegisterCounter("pcap_log.written", &t->stats);
|
||||
td->counter_filtered_bpf = StatsRegisterCounter("pcap_log.filtered_bpf", &t->stats);
|
||||
|
||||
if (pl->mode == LOGMODE_MULTI)
|
||||
td->pcap_log = PcapLogDataCopy(pl);
|
||||
|
|
|
|||
|
|
@ -294,12 +294,12 @@ static TmEcode OutputFilestoreLogThreadInit(ThreadVars *t, const void *initdata,
|
|||
OutputFilestoreCtx *ctx = ((OutputCtx *)initdata)->data;
|
||||
aft->ctx = ctx;
|
||||
|
||||
aft->counter_max_hits = StatsRegisterCounter("file_store.open_files_max_hit", t);
|
||||
aft->counter_max_hits = StatsRegisterCounter("file_store.open_files_max_hit", &t->stats);
|
||||
|
||||
/* File system type errors (open, write, rename) will only be
|
||||
* logged once. But this stat will be incremented for every
|
||||
* occurrence. */
|
||||
aft->fs_error_counter = StatsRegisterCounter("file_store.fs_errors", t);
|
||||
aft->fs_error_counter = StatsRegisterCounter("file_store.fs_errors", &t->stats);
|
||||
|
||||
*data = (void *)aft;
|
||||
return TM_ECODE_OK;
|
||||
|
|
|
|||
|
|
@ -2634,21 +2634,23 @@ TmEcode ReceiveAFPThreadInit(ThreadVars *tv, const void *initdata, void **data)
|
|||
#endif
|
||||
|
||||
#ifdef PACKET_STATISTICS
|
||||
ptv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets",
|
||||
ptv->tv);
|
||||
ptv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops",
|
||||
ptv->tv);
|
||||
ptv->capture_errors = StatsRegisterCounter("capture.errors",
|
||||
ptv->tv);
|
||||
ptv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets", &ptv->tv->stats);
|
||||
ptv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops", &ptv->tv->stats);
|
||||
ptv->capture_errors = StatsRegisterCounter("capture.errors", &ptv->tv->stats);
|
||||
|
||||
ptv->afpacket_spin = StatsRegisterAvgCounter("capture.afpacket.busy_loop_avg", ptv->tv);
|
||||
ptv->afpacket_spin = StatsRegisterAvgCounter("capture.afpacket.busy_loop_avg", &ptv->tv->stats);
|
||||
|
||||
ptv->capture_afp_poll = StatsRegisterCounter("capture.afpacket.polls", ptv->tv);
|
||||
ptv->capture_afp_poll_signal = StatsRegisterCounter("capture.afpacket.poll_signal", ptv->tv);
|
||||
ptv->capture_afp_poll_timeout = StatsRegisterCounter("capture.afpacket.poll_timeout", ptv->tv);
|
||||
ptv->capture_afp_poll_data = StatsRegisterCounter("capture.afpacket.poll_data", ptv->tv);
|
||||
ptv->capture_afp_poll_err = StatsRegisterCounter("capture.afpacket.poll_errors", ptv->tv);
|
||||
ptv->capture_afp_send_err = StatsRegisterCounter("capture.afpacket.send_errors", ptv->tv);
|
||||
ptv->capture_afp_poll = StatsRegisterCounter("capture.afpacket.polls", &ptv->tv->stats);
|
||||
ptv->capture_afp_poll_signal =
|
||||
StatsRegisterCounter("capture.afpacket.poll_signal", &ptv->tv->stats);
|
||||
ptv->capture_afp_poll_timeout =
|
||||
StatsRegisterCounter("capture.afpacket.poll_timeout", &ptv->tv->stats);
|
||||
ptv->capture_afp_poll_data =
|
||||
StatsRegisterCounter("capture.afpacket.poll_data", &ptv->tv->stats);
|
||||
ptv->capture_afp_poll_err =
|
||||
StatsRegisterCounter("capture.afpacket.poll_errors", &ptv->tv->stats);
|
||||
ptv->capture_afp_send_err =
|
||||
StatsRegisterCounter("capture.afpacket.send_errors", &ptv->tv->stats);
|
||||
#endif
|
||||
|
||||
ptv->copy_mode = afpconfig->copy_mode;
|
||||
|
|
|
|||
|
|
@ -660,15 +660,19 @@ static TmEcode ReceiveAFXDPThreadInit(ThreadVars *tv, const void *initdata, void
|
|||
ptv->napi_defer_hard_irqs = afxdpconfig->napi_defer_hard_irqs;
|
||||
|
||||
/* Stats registration */
|
||||
ptv->capture_afxdp_packets = StatsRegisterCounter("capture.afxdp_packets", ptv->tv);
|
||||
ptv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops", ptv->tv);
|
||||
ptv->capture_afxdp_poll = StatsRegisterCounter("capture.afxdp.poll", ptv->tv);
|
||||
ptv->capture_afxdp_poll_timeout = StatsRegisterCounter("capture.afxdp.poll_timeout", ptv->tv);
|
||||
ptv->capture_afxdp_poll_failed = StatsRegisterCounter("capture.afxdp.poll_failed", ptv->tv);
|
||||
ptv->capture_afxdp_empty_reads = StatsRegisterCounter("capture.afxdp.empty_reads", ptv->tv);
|
||||
ptv->capture_afxdp_failed_reads = StatsRegisterCounter("capture.afxdp.failed_reads", ptv->tv);
|
||||
ptv->capture_afxdp_packets = StatsRegisterCounter("capture.afxdp_packets", &ptv->tv->stats);
|
||||
ptv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops", &ptv->tv->stats);
|
||||
ptv->capture_afxdp_poll = StatsRegisterCounter("capture.afxdp.poll", &ptv->tv->stats);
|
||||
ptv->capture_afxdp_poll_timeout =
|
||||
StatsRegisterCounter("capture.afxdp.poll_timeout", &ptv->tv->stats);
|
||||
ptv->capture_afxdp_poll_failed =
|
||||
StatsRegisterCounter("capture.afxdp.poll_failed", &ptv->tv->stats);
|
||||
ptv->capture_afxdp_empty_reads =
|
||||
StatsRegisterCounter("capture.afxdp.empty_reads", &ptv->tv->stats);
|
||||
ptv->capture_afxdp_failed_reads =
|
||||
StatsRegisterCounter("capture.afxdp.failed_reads", &ptv->tv->stats);
|
||||
ptv->capture_afxdp_acquire_pkt_failed =
|
||||
StatsRegisterCounter("capture.afxdp.acquire_pkt_failed", ptv->tv);
|
||||
StatsRegisterCounter("capture.afxdp.acquire_pkt_failed", &ptv->tv->stats);
|
||||
|
||||
/* Reserve memory for umem */
|
||||
if (AcquireBuffer(ptv) != TM_ECODE_OK) {
|
||||
|
|
|
|||
|
|
@ -594,12 +594,12 @@ static TmEcode ReceiveDPDKThreadInit(ThreadVars *tv, const void *initdata, void
|
|||
ptv->bytes = 0;
|
||||
ptv->livedev = LiveGetDevice(dpdk_config->iface);
|
||||
|
||||
ptv->capture_dpdk_packets = StatsRegisterCounter("capture.packets", ptv->tv);
|
||||
ptv->capture_dpdk_rx_errs = StatsRegisterCounter("capture.rx_errors", ptv->tv);
|
||||
ptv->capture_dpdk_tx_errs = StatsRegisterCounter("capture.tx_errors", ptv->tv);
|
||||
ptv->capture_dpdk_imissed = StatsRegisterCounter("capture.dpdk.imissed", ptv->tv);
|
||||
ptv->capture_dpdk_rx_no_mbufs = StatsRegisterCounter("capture.dpdk.no_mbufs", ptv->tv);
|
||||
ptv->capture_dpdk_ierrors = StatsRegisterCounter("capture.dpdk.ierrors", ptv->tv);
|
||||
ptv->capture_dpdk_packets = StatsRegisterCounter("capture.packets", &ptv->tv->stats);
|
||||
ptv->capture_dpdk_rx_errs = StatsRegisterCounter("capture.rx_errors", &ptv->tv->stats);
|
||||
ptv->capture_dpdk_tx_errs = StatsRegisterCounter("capture.tx_errors", &ptv->tv->stats);
|
||||
ptv->capture_dpdk_imissed = StatsRegisterCounter("capture.dpdk.imissed", &ptv->tv->stats);
|
||||
ptv->capture_dpdk_rx_no_mbufs = StatsRegisterCounter("capture.dpdk.no_mbufs", &ptv->tv->stats);
|
||||
ptv->capture_dpdk_ierrors = StatsRegisterCounter("capture.dpdk.ierrors", &ptv->tv->stats);
|
||||
|
||||
ptv->copy_mode = dpdk_config->copy_mode;
|
||||
ptv->checksum_mode = dpdk_config->checksum_mode;
|
||||
|
|
|
|||
|
|
@ -550,10 +550,8 @@ static TmEcode ReceiveNetmapThreadInit(ThreadVars *tv, const void *initdata, voi
|
|||
}
|
||||
|
||||
/* basic counters */
|
||||
ntv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets",
|
||||
ntv->tv);
|
||||
ntv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops",
|
||||
ntv->tv);
|
||||
ntv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets", &ntv->tv->stats);
|
||||
ntv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops", &ntv->tv->stats);
|
||||
|
||||
if (aconf->in.bpf_filter) {
|
||||
SCLogConfig("%s: using BPF '%s'", ntv->ifsrc->ifname, aconf->in.bpf_filter);
|
||||
|
|
|
|||
|
|
@ -308,10 +308,8 @@ TmEcode ReceiveNFLOGThreadInit(ThreadVars *tv, const void *initdata, void **data
|
|||
}
|
||||
|
||||
#ifdef PACKET_STATISTICS
|
||||
ntv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets",
|
||||
ntv->tv);
|
||||
ntv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops",
|
||||
ntv->tv);
|
||||
ntv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets", &ntv->tv->stats);
|
||||
ntv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops", &ntv->tv->stats);
|
||||
#endif
|
||||
|
||||
char *active_runmode = RunmodeGetActive();
|
||||
|
|
|
|||
|
|
@ -533,12 +533,9 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void
|
|||
|
||||
pcapconfig->DerefFunc(pcapconfig);
|
||||
|
||||
ptv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets",
|
||||
ptv->tv);
|
||||
ptv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops",
|
||||
ptv->tv);
|
||||
ptv->capture_kernel_ifdrops = StatsRegisterCounter("capture.kernel_ifdrops",
|
||||
ptv->tv);
|
||||
ptv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets", &ptv->tv->stats);
|
||||
ptv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops", &ptv->tv->stats);
|
||||
ptv->capture_kernel_ifdrops = StatsRegisterCounter("capture.kernel_ifdrops", &ptv->tv->stats);
|
||||
|
||||
*data = (void *)ptv;
|
||||
SCReturnInt(TM_ECODE_OK);
|
||||
|
|
|
|||
|
|
@ -6111,18 +6111,18 @@ TmEcode StreamTcpThreadInit(ThreadVars *tv, void *initdata, void **data)
|
|||
|
||||
*data = (void *)stt;
|
||||
|
||||
stt->counter_tcp_active_sessions = StatsRegisterCounter("tcp.active_sessions", tv);
|
||||
stt->counter_tcp_sessions = StatsRegisterCounter("tcp.sessions", tv);
|
||||
stt->counter_tcp_ssn_memcap = StatsRegisterCounter("tcp.ssn_memcap_drop", tv);
|
||||
stt->counter_tcp_ssn_from_cache = StatsRegisterCounter("tcp.ssn_from_cache", tv);
|
||||
stt->counter_tcp_ssn_from_pool = StatsRegisterCounter("tcp.ssn_from_pool", tv);
|
||||
stt->counter_tcp_active_sessions = StatsRegisterCounter("tcp.active_sessions", &tv->stats);
|
||||
stt->counter_tcp_sessions = StatsRegisterCounter("tcp.sessions", &tv->stats);
|
||||
stt->counter_tcp_ssn_memcap = StatsRegisterCounter("tcp.ssn_memcap_drop", &tv->stats);
|
||||
stt->counter_tcp_ssn_from_cache = StatsRegisterCounter("tcp.ssn_from_cache", &tv->stats);
|
||||
stt->counter_tcp_ssn_from_pool = StatsRegisterCounter("tcp.ssn_from_pool", &tv->stats);
|
||||
ExceptionPolicySetStatsCounters(tv, &stt->counter_tcp_ssn_memcap_eps, &stream_memcap_eps_stats,
|
||||
stream_config.ssn_memcap_policy, "exception_policy.tcp.ssn_memcap.",
|
||||
IsStreamTcpSessionMemcapExceptionPolicyStatsValid);
|
||||
|
||||
stt->counter_tcp_pseudo = StatsRegisterCounter("tcp.pseudo", tv);
|
||||
stt->counter_tcp_invalid_checksum = StatsRegisterCounter("tcp.invalid_checksum", tv);
|
||||
stt->counter_tcp_midstream_pickups = StatsRegisterCounter("tcp.midstream_pickups", tv);
|
||||
stt->counter_tcp_pseudo = StatsRegisterCounter("tcp.pseudo", &tv->stats);
|
||||
stt->counter_tcp_invalid_checksum = StatsRegisterCounter("tcp.invalid_checksum", &tv->stats);
|
||||
stt->counter_tcp_midstream_pickups = StatsRegisterCounter("tcp.midstream_pickups", &tv->stats);
|
||||
if (stream_config.midstream) {
|
||||
ExceptionPolicySetStatsCounters(tv, &stt->counter_tcp_midstream_eps,
|
||||
&stream_midstream_enabled_eps_stats, stream_config.midstream_policy,
|
||||
|
|
@ -6133,31 +6133,37 @@ TmEcode StreamTcpThreadInit(ThreadVars *tv, void *initdata, void **data)
|
|||
"exception_policy.tcp.midstream.", IsMidstreamExceptionPolicyStatsValid);
|
||||
}
|
||||
|
||||
stt->counter_tcp_wrong_thread = StatsRegisterCounter("tcp.pkt_on_wrong_thread", tv);
|
||||
stt->counter_tcp_ack_unseen_data = StatsRegisterCounter("tcp.ack_unseen_data", tv);
|
||||
stt->counter_tcp_wrong_thread = StatsRegisterCounter("tcp.pkt_on_wrong_thread", &tv->stats);
|
||||
stt->counter_tcp_ack_unseen_data = StatsRegisterCounter("tcp.ack_unseen_data", &tv->stats);
|
||||
|
||||
/* init reassembly ctx */
|
||||
stt->ra_ctx = StreamTcpReassembleInitThreadCtx(tv);
|
||||
if (stt->ra_ctx == NULL)
|
||||
SCReturnInt(TM_ECODE_FAILED);
|
||||
|
||||
stt->ra_ctx->counter_tcp_segment_memcap = StatsRegisterCounter("tcp.segment_memcap_drop", tv);
|
||||
stt->ra_ctx->counter_tcp_segment_memcap =
|
||||
StatsRegisterCounter("tcp.segment_memcap_drop", &tv->stats);
|
||||
|
||||
ExceptionPolicySetStatsCounters(tv, &stt->ra_ctx->counter_tcp_reas_eps,
|
||||
&stream_reassembly_memcap_eps_stats, stream_config.reassembly_memcap_policy,
|
||||
"exception_policy.tcp.reassembly.", IsReassemblyMemcapExceptionPolicyStatsValid);
|
||||
|
||||
stt->ra_ctx->counter_tcp_segment_from_cache =
|
||||
StatsRegisterCounter("tcp.segment_from_cache", tv);
|
||||
stt->ra_ctx->counter_tcp_segment_from_pool = StatsRegisterCounter("tcp.segment_from_pool", tv);
|
||||
stt->ra_ctx->counter_tcp_stream_depth = StatsRegisterCounter("tcp.stream_depth_reached", tv);
|
||||
stt->ra_ctx->counter_tcp_reass_gap = StatsRegisterCounter("tcp.reassembly_gap", tv);
|
||||
stt->ra_ctx->counter_tcp_reass_overlap = StatsRegisterCounter("tcp.overlap", tv);
|
||||
stt->ra_ctx->counter_tcp_reass_overlap_diff_data = StatsRegisterCounter("tcp.overlap_diff_data", tv);
|
||||
StatsRegisterCounter("tcp.segment_from_cache", &tv->stats);
|
||||
stt->ra_ctx->counter_tcp_segment_from_pool =
|
||||
StatsRegisterCounter("tcp.segment_from_pool", &tv->stats);
|
||||
stt->ra_ctx->counter_tcp_stream_depth =
|
||||
StatsRegisterCounter("tcp.stream_depth_reached", &tv->stats);
|
||||
stt->ra_ctx->counter_tcp_reass_gap = StatsRegisterCounter("tcp.reassembly_gap", &tv->stats);
|
||||
stt->ra_ctx->counter_tcp_reass_overlap = StatsRegisterCounter("tcp.overlap", &tv->stats);
|
||||
stt->ra_ctx->counter_tcp_reass_overlap_diff_data =
|
||||
StatsRegisterCounter("tcp.overlap_diff_data", &tv->stats);
|
||||
|
||||
stt->ra_ctx->counter_tcp_reass_data_normal_fail = StatsRegisterCounter("tcp.insert_data_normal_fail", tv);
|
||||
stt->ra_ctx->counter_tcp_reass_data_overlap_fail = StatsRegisterCounter("tcp.insert_data_overlap_fail", tv);
|
||||
stt->ra_ctx->counter_tcp_urgent_oob = StatsRegisterCounter("tcp.urgent_oob_data", tv);
|
||||
stt->ra_ctx->counter_tcp_reass_data_normal_fail =
|
||||
StatsRegisterCounter("tcp.insert_data_normal_fail", &tv->stats);
|
||||
stt->ra_ctx->counter_tcp_reass_data_overlap_fail =
|
||||
StatsRegisterCounter("tcp.insert_data_overlap_fail", &tv->stats);
|
||||
stt->ra_ctx->counter_tcp_urgent_oob = StatsRegisterCounter("tcp.urgent_oob_data", &tv->stats);
|
||||
|
||||
SCLogDebug("StreamTcp thread specific ctx online at %p, reassembly ctx %p",
|
||||
stt, stt->ra_ctx);
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ void ExceptionPolicySetStatsCounters(ThreadVars *tv, ExceptionPolicyCounters *co
|
|||
if (isExceptionPolicyValid(i)) {
|
||||
snprintf(setting->eps_name[i], sizeof(setting->eps_name[i]), "%s%s", default_str,
|
||||
ExceptionPolicyEnumToString(i, true));
|
||||
counter->eps_id[i] = StatsRegisterCounter(setting->eps_name[i], tv);
|
||||
counter->eps_id[i] = StatsRegisterCounter(setting->eps_name[i], &tv->stats);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue