unix socket: support profiling

pull/1289/head
Victor Julien 10 years ago
parent f32d79dfe0
commit 485f34134e

@ -43,6 +43,8 @@
#include "host.h"
#include "defrag.h"
#include "util-profiling.h"
static const char *default_mode = NULL;
int unix_socket_mode_is_running = 0;
@ -312,6 +314,11 @@ TmEcode UnixSocketPcapFilesCheck(void *data)
StreamTcpFreeConfig(STREAM_VERBOSE);
DefragDestroy();
TmqResetQueues();
#ifdef PROFILING
if (profiling_rules_enabled)
SCProfilingDump();
SCProfilingDestroy();
#endif
}
if (!TAILQ_EMPTY(&this->files)) {
PcapFiles *cfile = TAILQ_FIRST(&this->files);
@ -337,6 +344,11 @@ TmEcode UnixSocketPcapFilesCheck(void *data)
return TM_ECODE_FAILED;
}
PcapFilesFree(cfile);
#ifdef PROFILING
SCProfilingRulesGlobalInit();
SCProfilingKeywordsGlobalInit();
SCProfilingInit();
#endif /* PROFILING */
DefragInit();
FlowInitConfig(FLOW_QUIET);
StreamTcpInitConfig(STREAM_VERBOSE);

@ -2078,9 +2078,11 @@ static int PostConfLoadedSetup(SCInstance *suri)
CIDRInit();
SigParsePrepare();
#ifdef PROFILING
SCProfilingRulesGlobalInit();
SCProfilingKeywordsGlobalInit();
SCProfilingInit();
if (suri->run_mode != RUNMODE_UNIX_SOCKET) {
SCProfilingRulesGlobalInit();
SCProfilingKeywordsGlobalInit();
SCProfilingInit();
}
#endif /* PROFILING */
SCReputationInitCtx();
SCProtoNameInit();
@ -2491,9 +2493,11 @@ int main(int argc, char **argv)
#endif
#ifdef PROFILING
if (profiling_rules_enabled)
SCProfilingDump();
SCProfilingDestroy();
if (suri.run_mode != RUNMODE_UNIX_SOCKET) {
if (profiling_rules_enabled)
SCProfilingDump();
SCProfilingDestroy();
}
#endif
#ifdef OS_WIN32

@ -279,13 +279,16 @@ SCProfilingDestroy(void)
if (profiling_packets_csv_enabled) {
if (packet_profile_csv_fp != NULL)
fclose(packet_profile_csv_fp);
packet_profile_csv_fp = NULL;
}
if (profiling_csv_file_name != NULL)
SCFree(profiling_csv_file_name);
profiling_csv_file_name = NULL;
if (profiling_file_name != NULL)
SCFree(profiling_file_name);
profiling_file_name = NULL;
#ifdef PROFILE_LOCKING
LockRecordFreeHash();

Loading…
Cancel
Save