Split into early ctx initialization and post-config setup.
static void SCPerfInitOPCtx(void)
{
SCEnter();
- if ( (sc_perf_op_ctx = SCMalloc(sizeof(StatsGlobalContext))) == NULL) {
- SCLogError(SC_ERR_FATAL, "Fatal error encountered in SCPerfInitOPCtx. Exiting...");
- exit(EXIT_FAILURE);
- }
- memset(sc_perf_op_ctx, 0, sizeof(StatsGlobalContext));
-
ConfNode *stats = GetConfig();
if (stats != NULL) {
const char *enabled = ConfNodeLookupChildValue(stats, "enabled");
* \brief Initializes the perf counter api. Things are hard coded currently.
* More work to be done when we implement multiple interfaces
*/
-void SCPerfInitCounterApi(void)
+void StatsInit(void)
{
- SCPerfInitOPCtx();
+ BUG_ON(sc_perf_op_ctx != NULL);
+ if ( (sc_perf_op_ctx = SCMalloc(sizeof(StatsGlobalContext))) == NULL) {
+ SCLogError(SC_ERR_FATAL, "Fatal error encountered in SCPerfInitOPCtx. Exiting...");
+ exit(EXIT_FAILURE);
+ }
+ memset(sc_perf_op_ctx, 0, sizeof(StatsGlobalContext));
+}
- return;
+void StatsSetupPostConfig(void)
+{
+ SCPerfInitOPCtx();
}
/**
} SCPerfPrivateContext;
/* the initialization functions */
-void SCPerfInitCounterApi(void);
+void StatsInit(void);
+void StatsSetupPostConfig(void);
void SCPerfSpawnThreads(void);
void SCPerfRegisterTests(void);
return TM_ECODE_FAILED;
}
PcapFilesFree(cfile);
+ StatsInit();
#ifdef PROFILING
SCProfilingRulesGlobalInit();
SCProfilingKeywordsGlobalInit();
IPPairInitConfig(FLOW_QUIET);
StreamTcpInitConfig(STREAM_VERBOSE);
RunModeInitializeOutputs();
- SCPerfInitCounterApi();
+ StatsSetupPostConfig();
RunModeDispatch(RUNMODE_PCAP_FILE, NULL);
FlowManagerThreadSpawn();
FlowRecyclerThreadSpawn();
GlobalInits();
TimeInit();
SupportFastPatternForSigMatchTypes();
+ StatsInit();
if (conf_filename == NULL)
conf_filename = DEFAULT_CONF_FILE;
if (suri.run_mode != RUNMODE_UNIX_SOCKET) {
RunModeInitializeOutputs();
- SCPerfInitCounterApi();
+ StatsSetupPostConfig();
}
if (ParseInterfacesList(suri.run_mode, suri.pcap_dev) != TM_ECODE_OK) {