Also remove 'type' parameter which was always the same.
/* tv is allowed to be NULL in unittests */
if (tv != NULL) {
- app_tctx->counter_dns_memuse = SCPerfTVRegisterCounter("dns.memuse", tv,
- SC_PERF_TYPE_UINT64);
- app_tctx->counter_dns_memcap_state = SCPerfTVRegisterCounter("dns.memcap_state", tv,
- SC_PERF_TYPE_UINT64);
- app_tctx->counter_dns_memcap_global = SCPerfTVRegisterCounter("dns.memcap_global", tv,
- SC_PERF_TYPE_UINT64);
+ app_tctx->counter_dns_memuse = StatsRegisterCounter("dns.memuse", tv);
+ app_tctx->counter_dns_memcap_state = StatsRegisterCounter("dns.memcap_state", tv);
+ app_tctx->counter_dns_memcap_global = StatsRegisterCounter("dns.memcap_global", tv);
}
goto done;
*
* \param cname Name of the counter, to be registered
* \param tm_name Thread module to which this counter belongs
- * \param type Datatype of this counter variable
* \param pctx SCPerfPublicContext for this tm-tv instance
* \param type_q Qualifier describing the type of counter to be registered
*
* present counter on success
* \retval 0 on failure
*/
-static uint16_t SCPerfRegisterQualifiedCounter(char *cname, char *tm_name,
- int type, SCPerfPublicContext *pctx,
- int type_q, uint64_t (*Func)(void))
+static uint16_t StatsRegisterQualifiedCounter(char *cname, char *tm_name,
+ SCPerfPublicContext *pctx,
+ int type_q, uint64_t (*Func)(void))
{
SCPerfCounter **head = &pctx->head;
SCPerfCounter *temp = NULL;
return 0;
}
- if ((type >= SC_PERF_TYPE_MAX) || (type < 0)) {
- SCLogError(SC_ERR_INVALID_ARGUMENTS, "Counters of type %" PRId32 " can't "
- "be registered", type);
- return 0;
- }
-
temp = prev = *head;
while (temp != NULL) {
prev = temp;
* \param cname Name of the counter, to be registered
* \param tv Pointer to the ThreadVars instance for which the counter would
* be registered
- * \param type Datatype of this counter variable
*
* \retval id Counter id for the newly registered counter, or the already
* present counter
*/
-uint16_t SCPerfTVRegisterCounter(char *cname, struct ThreadVars_ *tv, int type)
+uint16_t StatsRegisterCounter(char *cname, struct ThreadVars_ *tv)
{
- uint16_t id = SCPerfRegisterQualifiedCounter(cname,
+ uint16_t id = StatsRegisterQualifiedCounter(cname,
(tv->thread_group_name != NULL) ? tv->thread_group_name : tv->name,
- type,
&tv->perf_public_ctx,
STATS_TYPE_NORMAL, NULL);
* \param cname Name of the counter, to be registered
* \param tv Pointer to the ThreadVars instance for which the counter would
* be registered
- * \param type Datatype of this counter variable
*
* \retval id Counter id for the newly registered counter, or the already
* present counter
*/
-uint16_t SCPerfTVRegisterAvgCounter(char *cname, struct ThreadVars_ *tv,
- int type)
+uint16_t StatsRegisterAvgCounter(char *cname, struct ThreadVars_ *tv)
{
- uint16_t id = SCPerfRegisterQualifiedCounter(cname,
+ uint16_t id = StatsRegisterQualifiedCounter(cname,
(tv->thread_group_name != NULL) ? tv->thread_group_name : tv->name,
- type,
&tv->perf_public_ctx,
STATS_TYPE_AVERAGE, NULL);
* \param cname Name of the counter, to be registered
* \param tv Pointer to the ThreadVars instance for which the counter would
* be registered
- * \param type Datatype of this counter variable
*
* \retval the counter id for the newly registered counter, or the already
* present counter
*/
-uint16_t SCPerfTVRegisterMaxCounter(char *cname, struct ThreadVars_ *tv,
- int type)
+uint16_t StatsRegisterMaxCounter(char *cname, struct ThreadVars_ *tv)
{
- uint16_t id = SCPerfRegisterQualifiedCounter(cname,
+ uint16_t id = StatsRegisterQualifiedCounter(cname,
(tv->thread_group_name != NULL) ? tv->thread_group_name : tv->name,
- type,
&tv->perf_public_ctx,
STATS_TYPE_MAXIMUM, NULL);
* \retval id Counter id for the newly registered counter, or the already
* present counter
*/
-uint16_t SCPerfTVRegisterGlobalCounter(char *cname, uint64_t (*Func)(void))
+uint16_t StatsRegisterGlobalCounter(char *cname, uint64_t (*Func)(void))
{
#ifdef UNITTESTS
if (sc_perf_op_ctx == NULL)
#else
BUG_ON(sc_perf_op_ctx == NULL);
#endif
- uint16_t id = SCPerfRegisterQualifiedCounter(cname, NULL,
- SC_PERF_TYPE_UINT64,
+ uint16_t id = StatsRegisterQualifiedCounter(cname, NULL,
&(sc_perf_op_ctx->global_counter_ctx),
STATS_TYPE_FUNC,
Func);
* \retval id Counter id for the newly registered counter, or the already
* present counter
*/
-static uint16_t SCPerfRegisterCounter(char *cname, char *tm_name, int type,
+static uint16_t SCPerfRegisterCounter(char *cname, char *tm_name,
SCPerfPublicContext *pctx)
{
- uint16_t id = SCPerfRegisterQualifiedCounter(cname, tm_name, type, pctx,
- STATS_TYPE_NORMAL, NULL);
+ uint16_t id = StatsRegisterQualifiedCounter(cname, tm_name, pctx,
+ STATS_TYPE_NORMAL, NULL);
return id;
}
/*----------------------------------Unit_Tests--------------------------------*/
#ifdef UNITTESTS
-static int SCPerfTestCounterReg01()
-{
- SCPerfPublicContext pctx;
-
- memset(&pctx, 0, sizeof(SCPerfPublicContext));
-
- return SCPerfRegisterCounter("t1", "c1", 5, &pctx);
-}
-
static int SCPerfTestCounterReg02()
{
SCPerfPublicContext pctx;
memset(&pctx, 0, sizeof(SCPerfPublicContext));
- return SCPerfRegisterCounter(NULL, NULL, SC_PERF_TYPE_UINT64, &pctx);
+ return SCPerfRegisterCounter(NULL, NULL, &pctx);
}
static int SCPerfTestCounterReg03()
memset(&pctx, 0, sizeof(SCPerfPublicContext));
- result = SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64, &pctx);
+ result = SCPerfRegisterCounter("t1", "c1", &pctx);
SCPerfReleasePerfCounterS(pctx.head);
memset(&pctx, 0, sizeof(SCPerfPublicContext));
- SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64, &pctx);
- SCPerfRegisterCounter("t2", "c2", SC_PERF_TYPE_UINT64, &pctx);
- SCPerfRegisterCounter("t3", "c3", SC_PERF_TYPE_UINT64, &pctx);
+ SCPerfRegisterCounter("t1", "c1", &pctx);
+ SCPerfRegisterCounter("t2", "c2", &pctx);
+ SCPerfRegisterCounter("t3", "c3", &pctx);
- result = SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64, &pctx);
+ result = SCPerfRegisterCounter("t1", "c1", &pctx);
SCPerfReleasePerfCounterS(pctx.head);
memset(&tv, 0, sizeof(ThreadVars));
- id = SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
+ id = SCPerfRegisterCounter("t1", "c1", &tv.perf_public_ctx);
if (id != 1) {
printf("id %d: ", id);
return 0;
memset(&tv, 0, sizeof(ThreadVars));
- id = SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
+ id = SCPerfRegisterCounter("t1", "c1", &tv.perf_public_ctx);
if (id != 1)
return 0;
//pca = (SCPerfPrivateContext *)&tv.perf_private_ctx;
- SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
- SCPerfRegisterCounter("t2", "c2", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
+ SCPerfRegisterCounter("t1", "c1", &tv.perf_public_ctx);
+ SCPerfRegisterCounter("t2", "c2", &tv.perf_public_ctx);
SCPerfGetAllCountersArray(&tv.perf_public_ctx, &tv.perf_private_ctx);
pca = &tv.perf_private_ctx;
memset(&tv, 0, sizeof(ThreadVars));
- id = SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
+ id = SCPerfRegisterCounter("t1", "c1", &tv.perf_public_ctx);
SCPerfGetAllCountersArray(&tv.perf_public_ctx, &tv.perf_private_ctx);
pca = &tv.perf_private_ctx;
memset(&tv, 0, sizeof(ThreadVars));
- id1 = SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
- SCPerfRegisterCounter("t2", "c2", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
- SCPerfRegisterCounter("t3", "c3", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
- SCPerfRegisterCounter("t4", "c4", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
- id2 = SCPerfRegisterCounter("t5", "c5", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
+ id1 = SCPerfRegisterCounter("t1", "c1", &tv.perf_public_ctx);
+ SCPerfRegisterCounter("t2", "c2", &tv.perf_public_ctx);
+ SCPerfRegisterCounter("t3", "c3", &tv.perf_public_ctx);
+ SCPerfRegisterCounter("t4", "c4", &tv.perf_public_ctx);
+ id2 = SCPerfRegisterCounter("t5", "c5", &tv.perf_public_ctx);
SCPerfGetAllCountersArray(&tv.perf_public_ctx, &tv.perf_private_ctx);
pca = &tv.perf_private_ctx;
memset(&tv, 0, sizeof(ThreadVars));
- id1 = SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
- id2 = SCPerfRegisterCounter("t2", "c2", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
- id3 = SCPerfRegisterCounter("t3", "c3", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
+ id1 = SCPerfRegisterCounter("t1", "c1", &tv.perf_public_ctx);
+ id2 = SCPerfRegisterCounter("t2", "c2", &tv.perf_public_ctx);
+ id3 = SCPerfRegisterCounter("t3", "c3", &tv.perf_public_ctx);
SCPerfGetAllCountersArray(&tv.perf_public_ctx, &tv.perf_private_ctx);
pca = &tv.perf_private_ctx;
memset(&tv, 0, sizeof(ThreadVars));
- id1 = SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
- id2 = SCPerfRegisterCounter("t2", "c2", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
- id3 = SCPerfRegisterCounter("t3", "c3", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
- id4 = SCPerfRegisterCounter("t4", "c4", SC_PERF_TYPE_UINT64,
- &tv.perf_public_ctx);
+ id1 = SCPerfRegisterCounter("t1", "c1", &tv.perf_public_ctx);
+ id2 = SCPerfRegisterCounter("t2", "c2", &tv.perf_public_ctx);
+ id3 = SCPerfRegisterCounter("t3", "c3", &tv.perf_public_ctx);
+ id4 = SCPerfRegisterCounter("t4", "c4", &tv.perf_public_ctx);
SCPerfGetAllCountersArray(&tv.perf_public_ctx, &tv.perf_private_ctx);
pca = &tv.perf_private_ctx;
void SCPerfRegisterTests()
{
#ifdef UNITTESTS
- UtRegisterTest("SCPerfTestCounterReg01", SCPerfTestCounterReg01, 0);
UtRegisterTest("SCPerfTestCounterReg02", SCPerfTestCounterReg02, 0);
UtRegisterTest("SCPerfTestCounterReg03", SCPerfTestCounterReg03, 1);
UtRegisterTest("SCPerfTestCounterReg04", SCPerfTestCounterReg04, 1);
/* forward declaration of the ThreadVars structure */
struct ThreadVars_;
-/**
- * \brief Data type for different kind of Perf counters that can be registered
- */
-enum {
- SC_PERF_TYPE_UINT64,
- SC_PERF_TYPE_MAX,
-};
-
/**
* \brief Container to hold the counter variable
*/
void SCPerfRegisterTests(void);
/* counter registration functions */
-uint16_t SCPerfTVRegisterCounter(char *, struct ThreadVars_ *, int);
-uint16_t SCPerfTVRegisterAvgCounter(char *, struct ThreadVars_ *, int);
-uint16_t SCPerfTVRegisterMaxCounter(char *, struct ThreadVars_ *, int);
-uint16_t SCPerfTVRegisterGlobalCounter(char *cname, uint64_t (*Func)(void));
+uint16_t StatsRegisterCounter(char *, struct ThreadVars_ *);
+uint16_t StatsRegisterAvgCounter(char *, struct ThreadVars_ *);
+uint16_t StatsRegisterMaxCounter(char *, struct ThreadVars_ *);
+uint16_t StatsRegisterGlobalCounter(char *cname, uint64_t (*Func)(void));
/* utility functions */
int SCPerfUpdateCounterArray(SCPerfPrivateContext *, SCPerfPublicContext *);
void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
{
/* register counters */
- dtv->counter_pkts = SCPerfTVRegisterCounter("decoder.pkts", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_bytes = SCPerfTVRegisterCounter("decoder.bytes", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_invalid = SCPerfTVRegisterCounter("decoder.invalid", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_ipv4 = SCPerfTVRegisterCounter("decoder.ipv4", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_ipv6 = SCPerfTVRegisterCounter("decoder.ipv6", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_eth = SCPerfTVRegisterCounter("decoder.ethernet", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_raw = SCPerfTVRegisterCounter("decoder.raw", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_null = SCPerfTVRegisterCounter("decoder.null", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_sll = SCPerfTVRegisterCounter("decoder.sll", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_tcp = SCPerfTVRegisterCounter("decoder.tcp", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_udp = SCPerfTVRegisterCounter("decoder.udp", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_sctp = SCPerfTVRegisterCounter("decoder.sctp", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_icmpv4 = SCPerfTVRegisterCounter("decoder.icmpv4", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_icmpv6 = SCPerfTVRegisterCounter("decoder.icmpv6", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_ppp = SCPerfTVRegisterCounter("decoder.ppp", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_pppoe = SCPerfTVRegisterCounter("decoder.pppoe", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_gre = SCPerfTVRegisterCounter("decoder.gre", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_vlan = SCPerfTVRegisterCounter("decoder.vlan", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_vlan_qinq = SCPerfTVRegisterCounter("decoder.vlan_qinq", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_teredo = SCPerfTVRegisterCounter("decoder.teredo", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_ipv4inipv6 = SCPerfTVRegisterCounter("decoder.ipv4_in_ipv6", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_ipv6inipv6 = SCPerfTVRegisterCounter("decoder.ipv6_in_ipv6", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_mpls = SCPerfTVRegisterCounter("decoder.mpls", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_avg_pkt_size = SCPerfTVRegisterAvgCounter("decoder.avg_pkt_size", tv,
- SC_PERF_TYPE_UINT64);
- dtv->counter_max_pkt_size = SCPerfTVRegisterMaxCounter("decoder.max_pkt_size", tv,
- SC_PERF_TYPE_UINT64);
+ 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_raw = StatsRegisterCounter("decoder.raw", tv);
+ dtv->counter_null = StatsRegisterCounter("decoder.null", tv);
+ dtv->counter_sll = StatsRegisterCounter("decoder.sll", tv);
+ dtv->counter_tcp = StatsRegisterCounter("decoder.tcp", tv);
+ dtv->counter_udp = StatsRegisterCounter("decoder.udp", tv);
+ dtv->counter_sctp = StatsRegisterCounter("decoder.sctp", 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_gre = StatsRegisterCounter("decoder.gre", tv);
+ dtv->counter_vlan = StatsRegisterCounter("decoder.vlan", tv);
+ dtv->counter_vlan_qinq = StatsRegisterCounter("decoder.vlan_qinq", tv);
+ dtv->counter_teredo = StatsRegisterCounter("decoder.teredo", 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_defrag_ipv4_fragments =
- SCPerfTVRegisterCounter("defrag.ipv4.fragments", tv,
- SC_PERF_TYPE_UINT64);
+ StatsRegisterCounter("defrag.ipv4.fragments", tv);
dtv->counter_defrag_ipv4_reassembled =
- SCPerfTVRegisterCounter("defrag.ipv4.reassembled", tv,
- SC_PERF_TYPE_UINT64);
+ StatsRegisterCounter("defrag.ipv4.reassembled", tv);
dtv->counter_defrag_ipv4_timeouts =
- SCPerfTVRegisterCounter("defrag.ipv4.timeouts", tv,
- SC_PERF_TYPE_UINT64);
+ StatsRegisterCounter("defrag.ipv4.timeouts", tv);
dtv->counter_defrag_ipv6_fragments =
- SCPerfTVRegisterCounter("defrag.ipv6.fragments", tv,
- SC_PERF_TYPE_UINT64);
+ StatsRegisterCounter("defrag.ipv6.fragments", tv);
dtv->counter_defrag_ipv6_reassembled =
- SCPerfTVRegisterCounter("defrag.ipv6.reassembled", tv,
- SC_PERF_TYPE_UINT64);
+ StatsRegisterCounter("defrag.ipv6.reassembled", tv);
dtv->counter_defrag_ipv6_timeouts =
- SCPerfTVRegisterCounter("defrag.ipv6.timeouts", tv,
- SC_PERF_TYPE_UINT64);
+ StatsRegisterCounter("defrag.ipv6.timeouts", tv);
dtv->counter_defrag_max_hit =
- SCPerfTVRegisterCounter("defrag.max_frag_hits", tv,
- SC_PERF_TYPE_UINT64);
+ StatsRegisterCounter("defrag.max_frag_hits", tv);
return;
}
{
/* first register the counter. In delayed detect mode we exit right after if the
* rules haven't been loaded yet. */
- uint16_t counter_alerts = SCPerfTVRegisterCounter("detect.alert", tv,
- SC_PERF_TYPE_UINT64);
+ uint16_t counter_alerts = StatsRegisterCounter("detect.alert", tv);
#ifdef PROFILING
- uint16_t counter_mpm_list = SCPerfTVRegisterAvgCounter("detect.mpm_list", tv,
- SC_PERF_TYPE_UINT64);
- uint16_t counter_nonmpm_list = SCPerfTVRegisterAvgCounter("detect.nonmpm_list", tv,
- SC_PERF_TYPE_UINT64);
- uint16_t counter_fnonmpm_list = SCPerfTVRegisterAvgCounter("detect.fnonmpm_list", tv,
- SC_PERF_TYPE_UINT64);
- uint16_t counter_match_list = SCPerfTVRegisterAvgCounter("detect.match_list", tv,
- SC_PERF_TYPE_UINT64);
+ uint16_t counter_mpm_list = StatsRegisterAvgCounter("detect.mpm_list", tv);
+ uint16_t counter_nonmpm_list = StatsRegisterAvgCounter("detect.nonmpm_list", tv);
+ uint16_t counter_fnonmpm_list = StatsRegisterAvgCounter("detect.fnonmpm_list", tv);
+ uint16_t counter_match_list = StatsRegisterAvgCounter("detect.match_list", tv);
#endif
DetectEngineThreadCtx *det_ctx = SCMalloc(sizeof(DetectEngineThreadCtx));
if (unlikely(det_ctx == NULL))
}
/** alert counter setup */
- det_ctx->counter_alerts = SCPerfTVRegisterCounter("detect.alert", tv,
- SC_PERF_TYPE_UINT64);
+ det_ctx->counter_alerts = StatsRegisterCounter("detect.alert", tv);
#ifdef PROFILING
- uint16_t counter_mpm_list = SCPerfTVRegisterAvgCounter("detect.mpm_list", tv,
- SC_PERF_TYPE_UINT64);
- uint16_t counter_nonmpm_list = SCPerfTVRegisterAvgCounter("detect.nonmpm_list", tv,
- SC_PERF_TYPE_UINT64);
- uint16_t counter_fnonmpm_list = SCPerfTVRegisterAvgCounter("detect.fnonmpm_list", tv,
- SC_PERF_TYPE_UINT64);
- uint16_t counter_match_list = SCPerfTVRegisterAvgCounter("detect.match_list", tv,
- SC_PERF_TYPE_UINT64);
+ uint16_t counter_mpm_list = StatsRegisterAvgCounter("detect.mpm_list", tv);
+ uint16_t counter_nonmpm_list = StatsRegisterAvgCounter("detect.nonmpm_list", tv);
+ uint16_t counter_fnonmpm_list = StatsRegisterAvgCounter("detect.fnonmpm_list", tv);
+ uint16_t counter_match_list = StatsRegisterAvgCounter("detect.match_list", tv);
det_ctx->counter_mpm_list = counter_mpm_list;
det_ctx->counter_nonmpm_list = counter_nonmpm_list;
det_ctx->counter_fnonmpm_list = counter_fnonmpm_list;
/* pass thread data back to caller */
*data = ftd;
- ftd->flow_mgr_cnt_clo = SCPerfTVRegisterCounter("flow_mgr.closed_pruned", t,
- SC_PERF_TYPE_UINT64);
- ftd->flow_mgr_cnt_new = SCPerfTVRegisterCounter("flow_mgr.new_pruned", t,
- SC_PERF_TYPE_UINT64);
- ftd->flow_mgr_cnt_est = SCPerfTVRegisterCounter("flow_mgr.est_pruned", t,
- SC_PERF_TYPE_UINT64);
- ftd->flow_mgr_memuse = SCPerfTVRegisterCounter("flow.memuse", t,
- SC_PERF_TYPE_UINT64);
- ftd->flow_mgr_spare = SCPerfTVRegisterCounter("flow.spare", t,
- SC_PERF_TYPE_UINT64);
- ftd->flow_emerg_mode_enter = SCPerfTVRegisterCounter("flow.emerg_mode_entered", t,
- SC_PERF_TYPE_UINT64);
- ftd->flow_emerg_mode_over = SCPerfTVRegisterCounter("flow.emerg_mode_over", t,
- SC_PERF_TYPE_UINT64);
- ftd->flow_tcp_reuse = SCPerfTVRegisterCounter("flow.tcp_reuse", t,
- SC_PERF_TYPE_UINT64);
+ ftd->flow_mgr_cnt_clo = StatsRegisterCounter("flow_mgr.closed_pruned", t);
+ ftd->flow_mgr_cnt_new = StatsRegisterCounter("flow_mgr.new_pruned", t);
+ ftd->flow_mgr_cnt_est = StatsRegisterCounter("flow_mgr.est_pruned", t);
+ ftd->flow_mgr_memuse = StatsRegisterCounter("flow.memuse", t);
+ ftd->flow_mgr_spare = StatsRegisterCounter("flow.spare", t);
+ ftd->flow_emerg_mode_enter = StatsRegisterCounter("flow.emerg_mode_entered", t);
+ ftd->flow_emerg_mode_over = StatsRegisterCounter("flow.emerg_mode_over", t);
+ ftd->flow_tcp_reuse = StatsRegisterCounter("flow.tcp_reuse", t);
PacketPoolInit();
return TM_ECODE_OK;
int flow_update_delay_nsec = FLOW_NORMAL_MODE_UPDATE_DELAY_NSEC;
/* VJ leaving disabled for now, as hosts are only used by tags and the numbers
* are really low. Might confuse ppl
- uint16_t flow_mgr_host_prune = SCPerfTVRegisterCounter("hosts.pruned", th_v,
- SC_PERF_TYPE_UINT64);
- uint16_t flow_mgr_host_active = SCPerfTVRegisterCounter("hosts.active", th_v,
- SC_PERF_TYPE_UINT64);
- uint16_t flow_mgr_host_spare = SCPerfTVRegisterCounter("hosts.spare", th_v,
- SC_PERF_TYPE_UINT64);
+ uint16_t flow_mgr_host_prune = StatsRegisterCounter("hosts.pruned", th_v);
+ uint16_t flow_mgr_host_active = StatsRegisterCounter("hosts.active", th_v);
+ uint16_t flow_mgr_host_spare = StatsRegisterCounter("hosts.spare", th_v);
*/
memset(&ts, 0, sizeof(ts));
}
#ifdef PACKET_STATISTICS
- ptv->capture_kernel_packets = SCPerfTVRegisterCounter("capture.kernel_packets",
- ptv->tv, SC_PERF_TYPE_UINT64);
- ptv->capture_kernel_drops = SCPerfTVRegisterCounter("capture.kernel_drops",
- ptv->tv, SC_PERF_TYPE_UINT64);
+ ptv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets",
+ ptv->tv);
+ ptv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops",
+ ptv->tv);
#endif
char *active_runmode = RunmodeGetActive();
SCReturnInt(TM_ECODE_FAILED);
}
- ewtn->packets = SCPerfTVRegisterCounter("capture.dag_packets",
- tv, SC_PERF_TYPE_UINT64);
- ewtn->drops = SCPerfTVRegisterCounter("capture.dag_drops",
- tv, SC_PERF_TYPE_UINT64);
+ ewtn->packets = StatsRegisterCounter("capture.dag_packets", tv);
+ ewtn->drops = StatsRegisterCounter("capture.dag_drops", tv);
ewtn->tv = tv;
*data = (void *)ewtn;
static void MpipeRegisterPerfCounters(MpipeThreadVars *ptv, ThreadVars *tv)
{
/* register counters */
- ptv->max_mpipe_depth = SCPerfTVRegisterCounter("mpipe.max_mpipe_depth",
- tv,
- SC_PERF_TYPE_UINT64);
- ptv->mpipe_drop = SCPerfTVRegisterCounter("mpipe.drop",
- tv,
- SC_PERF_TYPE_UINT64);
- ptv->counter_no_buffers_0 = SCPerfTVRegisterCounter("mpipe.no_buf0", tv,
- SC_PERF_TYPE_UINT64);
- ptv->counter_no_buffers_1 = SCPerfTVRegisterCounter("mpipe.no_buf1", tv,
- SC_PERF_TYPE_UINT64);
- ptv->counter_no_buffers_2 = SCPerfTVRegisterCounter("mpipe.no_buf2", tv,
- SC_PERF_TYPE_UINT64);
- ptv->counter_no_buffers_3 = SCPerfTVRegisterCounter("mpipe.no_buf3", tv,
- SC_PERF_TYPE_UINT64);
- ptv->counter_no_buffers_4 = SCPerfTVRegisterCounter("mpipe.no_buf4", tv,
- SC_PERF_TYPE_UINT64);
- ptv->counter_no_buffers_5 = SCPerfTVRegisterCounter("mpipe.no_buf5", tv,
- SC_PERF_TYPE_UINT64);
- ptv->counter_no_buffers_6 = SCPerfTVRegisterCounter("mpipe.no_buf6", tv,
- SC_PERF_TYPE_UINT64);
- ptv->counter_no_buffers_7 = SCPerfTVRegisterCounter("mpipe.no_buf7", tv,
- SC_PERF_TYPE_UINT64);
+ ptv->max_mpipe_depth = StatsRegisterCounter("mpipe.max_mpipe_depth", tv);
+ ptv->mpipe_drop = StatsRegisterCounter("mpipe.drop", tv);
+ ptv->counter_no_buffers_0 = StatsRegisterCounter("mpipe.no_buf0", tv);
+ ptv->counter_no_buffers_1 = StatsRegisterCounter("mpipe.no_buf1", tv);
+ ptv->counter_no_buffers_2 = StatsRegisterCounter("mpipe.no_buf2", tv);
+ ptv->counter_no_buffers_3 = StatsRegisterCounter("mpipe.no_buf3", tv);
+ ptv->counter_no_buffers_4 = StatsRegisterCounter("mpipe.no_buf4", tv);
+ ptv->counter_no_buffers_5 = StatsRegisterCounter("mpipe.no_buf5", tv);
+ ptv->counter_no_buffers_6 = StatsRegisterCounter("mpipe.no_buf6", tv);
+ ptv->counter_no_buffers_7 = StatsRegisterCounter("mpipe.no_buf7", tv);
}
static const gxio_mpipe_buffer_size_enum_t gxio_buffer_sizes[] = {
}
/* basic counters */
- ntv->capture_kernel_packets = SCPerfTVRegisterCounter("capture.kernel_packets",
- ntv->tv, SC_PERF_TYPE_UINT64);
- ntv->capture_kernel_drops = SCPerfTVRegisterCounter("capture.kernel_drops",
- ntv->tv, SC_PERF_TYPE_UINT64);
+ ntv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets",
+ ntv->tv);
+ ntv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops",
+ ntv->tv);
char const *active_runmode = RunmodeGetActive();
if (active_runmode && !strcmp("workers", active_runmode)) {
}
#ifdef PACKET_STATISTICS
- ntv->capture_kernel_packets = SCPerfTVRegisterCounter("capture.kernel_packets",
- ntv->tv,
- SC_PERF_TYPE_UINT64);
- ntv->capture_kernel_drops = SCPerfTVRegisterCounter("capture.kernel_drops",
- ntv->tv,
- SC_PERF_TYPE_UINT64);
+ ntv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets",
+ ntv->tv);
+ ntv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops",
+ ntv->tv);
#endif
char *active_runmode = RunmodeGetActive();
pcapconfig->DerefFunc(pcapconfig);
- ptv->capture_kernel_packets = SCPerfTVRegisterCounter("capture.kernel_packets",
- ptv->tv, SC_PERF_TYPE_UINT64);
- ptv->capture_kernel_drops = SCPerfTVRegisterCounter("capture.kernel_drops",
- ptv->tv, SC_PERF_TYPE_UINT64);
- ptv->capture_kernel_ifdrops = SCPerfTVRegisterCounter("capture.kernel_ifdrops",
- ptv->tv, SC_PERF_TYPE_UINT64);
+ 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);
*data = (void *)ptv;
SCReturnInt(TM_ECODE_OK);
ptv->datalink = pcap_datalink(ptv->pcap_handle);
- ptv->capture_kernel_packets = SCPerfTVRegisterCounter("capture.kernel_packets",
- ptv->tv, SC_PERF_TYPE_UINT64);
- ptv->capture_kernel_drops = SCPerfTVRegisterCounter("capture.kernel_drops",
- ptv->tv, SC_PERF_TYPE_UINT64);
- ptv->capture_kernel_ifdrops = SCPerfTVRegisterCounter("capture.kernel_ifdrops",
- ptv->tv, SC_PERF_TYPE_UINT64);
+ 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);
*data = (void *)ptv;
}
}
- ptv->capture_kernel_packets = SCPerfTVRegisterCounter("capture.kernel_packets",
- ptv->tv, SC_PERF_TYPE_UINT64);
- ptv->capture_kernel_drops = SCPerfTVRegisterCounter("capture.kernel_drops",
- ptv->tv, SC_PERF_TYPE_UINT64);
+ ptv->capture_kernel_packets = StatsRegisterCounter("capture.kernel_packets",
+ ptv->tv);
+ ptv->capture_kernel_drops = StatsRegisterCounter("capture.kernel_drops",
+ ptv->tv);
/* A bit strange to have this here but we only have vlan information
* during reading so we need to know if we want to keep vlan during
SCMutexInit(&segment_pool_cnt_mutex, NULL);
#endif
- SCPerfTVRegisterGlobalCounter("tcp.reassembly_memuse",
+ StatsRegisterGlobalCounter("tcp.reassembly_memuse",
StreamTcpReassembleMemuseGlobalCounter);
return 0;
}
*data = (void *)stt;
- stt->counter_tcp_sessions = SCPerfTVRegisterCounter("tcp.sessions", tv,
- SC_PERF_TYPE_UINT64);
- stt->counter_tcp_ssn_memcap = SCPerfTVRegisterCounter("tcp.ssn_memcap_drop", tv,
- SC_PERF_TYPE_UINT64);
- stt->counter_tcp_pseudo = SCPerfTVRegisterCounter("tcp.pseudo", tv,
- SC_PERF_TYPE_UINT64);
- stt->counter_tcp_pseudo_failed = SCPerfTVRegisterCounter("tcp.pseudo_failed", tv,
- SC_PERF_TYPE_UINT64);
- stt->counter_tcp_invalid_checksum = SCPerfTVRegisterCounter("tcp.invalid_checksum", tv,
- SC_PERF_TYPE_UINT64);
- stt->counter_tcp_no_flow = SCPerfTVRegisterCounter("tcp.no_flow", tv,
- SC_PERF_TYPE_UINT64);
- stt->counter_tcp_memuse = SCPerfTVRegisterCounter("tcp.memuse", tv,
- SC_PERF_TYPE_UINT64);
- stt->counter_tcp_syn = SCPerfTVRegisterCounter("tcp.syn", tv,
- SC_PERF_TYPE_UINT64);
- stt->counter_tcp_synack = SCPerfTVRegisterCounter("tcp.synack", tv,
- SC_PERF_TYPE_UINT64);
- stt->counter_tcp_rst = SCPerfTVRegisterCounter("tcp.rst", tv,
- SC_PERF_TYPE_UINT64);
+ stt->counter_tcp_sessions = StatsRegisterCounter("tcp.sessions", tv);
+ stt->counter_tcp_ssn_memcap = StatsRegisterCounter("tcp.ssn_memcap_drop", tv);
+ stt->counter_tcp_pseudo = StatsRegisterCounter("tcp.pseudo", tv);
+ stt->counter_tcp_pseudo_failed = StatsRegisterCounter("tcp.pseudo_failed", tv);
+ stt->counter_tcp_invalid_checksum = StatsRegisterCounter("tcp.invalid_checksum", tv);
+ stt->counter_tcp_no_flow = StatsRegisterCounter("tcp.no_flow", tv);
+ stt->counter_tcp_memuse = StatsRegisterCounter("tcp.memuse", tv);
+ stt->counter_tcp_syn = StatsRegisterCounter("tcp.syn", tv);
+ stt->counter_tcp_synack = StatsRegisterCounter("tcp.synack", tv);
+ stt->counter_tcp_rst = StatsRegisterCounter("tcp.rst", tv);
/* init reassembly ctx */
stt->ra_ctx = StreamTcpReassembleInitThreadCtx(tv);
if (stt->ra_ctx == NULL)
SCReturnInt(TM_ECODE_FAILED);
- stt->ra_ctx->counter_tcp_segment_memcap = SCPerfTVRegisterCounter("tcp.segment_memcap_drop", tv,
- SC_PERF_TYPE_UINT64);
- stt->ra_ctx->counter_tcp_stream_depth = SCPerfTVRegisterCounter("tcp.stream_depth_reached", tv,
- SC_PERF_TYPE_UINT64);
- stt->ra_ctx->counter_tcp_reass_gap = SCPerfTVRegisterCounter("tcp.reassembly_gap", tv,
- SC_PERF_TYPE_UINT64);
+ stt->ra_ctx->counter_tcp_segment_memcap = StatsRegisterCounter("tcp.segment_memcap_drop", 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);
/** \fixme Find a better place in 2.1 as it is linked with app layer */
- stt->ra_ctx->counter_htp_memuse = SCPerfTVRegisterCounter("http.memuse", tv,
- SC_PERF_TYPE_UINT64);
- stt->ra_ctx->counter_htp_memcap = SCPerfTVRegisterCounter("http.memcap", tv,
- SC_PERF_TYPE_UINT64);
+ stt->ra_ctx->counter_htp_memuse = StatsRegisterCounter("http.memuse", tv);
+ stt->ra_ctx->counter_htp_memcap = StatsRegisterCounter("http.memcap", tv);
SCLogDebug("StreamTcp thread specific ctx online at %p, reassembly ctx %p",
stt, stt->ra_ctx);