suricata
util-profiling-rules.c File Reference
#include "suricata-common.h"
#include "decode.h"
#include "detect.h"
#include "conf.h"
#include "tm-threads.h"
#include "util-unittest.h"
#include "util-byte.h"
#include "util-profiling.h"
#include "util-profiling-locks.h"
Include dependency graph for util-profiling-rules.c:

Go to the source code of this file.

Data Structures

struct  SCProfileData_
 
struct  SCProfileDetectCtx_
 
struct  SCProfileSummary_
 

Macros

#define SET_ONE(x)
 

Typedefs

typedef struct SCProfileData_ SCProfileData
 
typedef struct SCProfileDetectCtx_ SCProfileDetectCtx
 
typedef struct SCProfileSummary_ SCProfileSummary
 

Enumerations

enum  {
  SC_PROFILING_RULES_SORT_BY_TICKS = 0, SC_PROFILING_RULES_SORT_BY_AVG_TICKS, SC_PROFILING_RULES_SORT_BY_CHECKS, SC_PROFILING_RULES_SORT_BY_MATCHES,
  SC_PROFILING_RULES_SORT_BY_MAX_TICKS, SC_PROFILING_RULES_SORT_BY_AVG_TICKS_MATCH, SC_PROFILING_RULES_SORT_BY_AVG_TICKS_NO_MATCH
}
 

Functions

void SCProfilingRulesGlobalInit (void)
 
void SCProfilingRuleUpdateCounter (DetectEngineThreadCtx *det_ctx, uint16_t id, uint64_t ticks, int match)
 Update a rule counter. More...
 
void SCProfilingRuleDestroyCtx (SCProfileDetectCtx *ctx)
 
void SCProfilingRuleThreadSetup (SCProfileDetectCtx *ctx, DetectEngineThreadCtx *det_ctx)
 
void SCProfilingRuleThreadCleanup (DetectEngineThreadCtx *det_ctx)
 
void SCProfilingRuleInitCounters (DetectEngineCtx *de_ctx)
 Register the rule profiling counters. More...
 

Variables

int profiling_output_to_file
 
int profiling_rules_enabled = 0
 

Detailed Description

Author
Endace Technology Limited.
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t

An API for rule profiling operations.

Definition in file util-profiling-rules.c.

Macro Definition Documentation

#define SET_ONE (   x)
Value:
{ \
profiling_rules_sort_orders[0] = (x); \
profiling_rules_sort_orders[1] = -1; \
}

Referenced by SCProfilingRulesGlobalInit().

Typedef Documentation

typedef struct SCProfileData_ SCProfileData

Extra data for rule profiling.

Used for generating the summary data to print.

Enumeration Type Documentation

anonymous enum

Sort orders for dumping profiled rules.

Enumerator
SC_PROFILING_RULES_SORT_BY_TICKS 
SC_PROFILING_RULES_SORT_BY_AVG_TICKS 
SC_PROFILING_RULES_SORT_BY_CHECKS 
SC_PROFILING_RULES_SORT_BY_MATCHES 
SC_PROFILING_RULES_SORT_BY_MAX_TICKS 
SC_PROFILING_RULES_SORT_BY_AVG_TICKS_MATCH 
SC_PROFILING_RULES_SORT_BY_AVG_TICKS_NO_MATCH 

Definition at line 89 of file util-profiling-rules.c.

Function Documentation

void SCProfilingRuleDestroyCtx ( SCProfileDetectCtx ctx)

Definition at line 589 of file util-profiling-rules.c.

References SCProfileDetectCtx_::data, SCProfileDetectCtx_::data_m, and SCFree.

Referenced by DetectEngineCtxFree().

Here is the caller graph for this function:

void SCProfilingRuleInitCounters ( DetectEngineCtx de_ctx)

Register the rule profiling counters.

Parameters
de_ctxThe active DetectEngineCtx, used to get at the loaded rules.

Definition at line 651 of file util-profiling-rules.c.

References BUG_ON, SCProfileDetectCtx_::data, SCProfileData_::gid, Signature_::gid, Signature_::id, Signature_::next, DetectEngineCtx_::profile_ctx, Signature_::profiling_id, profiling_rules_enabled, SCProfileData_::rev, Signature_::rev, SCLogPerf, SCMalloc, SCProfileData_::sid, DetectEngineCtx_::sig_list, and SCProfileDetectCtx_::size.

Referenced by SigGroupBuild().

Here is the caller graph for this function:

void SCProfilingRuleThreadCleanup ( DetectEngineThreadCtx det_ctx)
void SCProfilingRuleUpdateCounter ( DetectEngineThreadCtx det_ctx,
uint16_t  id,
uint64_t  ticks,
int  match 
)

Update a rule counter.

Parameters
idThe ID of this counter.
ticksNumber of CPU ticks for this rule.
matchDid the rule match?

Definition at line 557 of file util-profiling-rules.c.

References SCProfileData_::checks, SCProfileDetectCtx_::data_m, SCProfileData_::matches, SCProfileData_::max, DetectEngineThreadCtx_::rule_perf_data, DetectEngineThreadCtx_::rule_perf_data_size, SC_ERR_MUTEX, SCLogError, SCMalloc, SCProfileData_::ticks_match, and SCProfileData_::ticks_no_match.

Variable Documentation

int profiling_output_to_file

Definition at line 102 of file util-profiling.c.

Referenced by SCProfilingRulesGlobalInit().

int profiling_rules_enabled = 0