|
|
|
|
@ -29,26 +29,26 @@
|
|
|
|
|
#include "util-cpu.h"
|
|
|
|
|
|
|
|
|
|
extern int profiling_rules_enabled;
|
|
|
|
|
extern __thread int profiling_entered;
|
|
|
|
|
extern __thread int profiling_rules_entered;
|
|
|
|
|
|
|
|
|
|
#define PROFILING_START \
|
|
|
|
|
uint64_t profile_start_ = 0; \
|
|
|
|
|
uint64_t profile_end_ = 0; \
|
|
|
|
|
#define RULE_PROFILING_START \
|
|
|
|
|
uint64_t profile_rule_start_ = 0; \
|
|
|
|
|
uint64_t profile_rule_end_ = 0; \
|
|
|
|
|
if (profiling_rules_enabled) { \
|
|
|
|
|
if (profiling_entered > 0) { \
|
|
|
|
|
if (profiling_rules_entered > 0) { \
|
|
|
|
|
SCLogError(SC_ERR_FATAL, "Re-entered profiling, exiting."); \
|
|
|
|
|
exit(1); \
|
|
|
|
|
} \
|
|
|
|
|
profiling_entered++; \
|
|
|
|
|
profile_start_ = UtilCpuGetTicks(); \
|
|
|
|
|
profiling_rules_entered++; \
|
|
|
|
|
profile_rule_start_ = UtilCpuGetTicks(); \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define RULE_PROFILING_END(r, m) \
|
|
|
|
|
if (profiling_rules_enabled) { \
|
|
|
|
|
profile_end_ = UtilCpuGetTicks(); \
|
|
|
|
|
profile_rule_end_ = UtilCpuGetTicks(); \
|
|
|
|
|
SCProfilingUpdateRuleCounter(r->profiling_id, \
|
|
|
|
|
profile_end_ - profile_start_, m); \
|
|
|
|
|
profiling_entered--; \
|
|
|
|
|
profile_rule_end_ - profile_rule_start_, m); \
|
|
|
|
|
profiling_rules_entered--; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SCProfilingInit(void);
|
|
|
|
|
@ -61,7 +61,7 @@ void SCProfilingUpdateRuleCounter(uint16_t, uint64_t, int);
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
#define PROFILING_START
|
|
|
|
|
#define RULE_PROFILING_START
|
|
|
|
|
#define RULE_PROFILING_END(r, m)
|
|
|
|
|
|
|
|
|
|
#endif /* PROFILING */
|
|
|
|
|
|