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

◆ SET_ONE

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

Typedef Documentation

◆ SCProfileData

typedef struct SCProfileData_ SCProfileData

Extra data for rule profiling.

◆ SCProfileDetectCtx

◆ SCProfileSummary

Used for generating the summary data to print.

Enumeration Type Documentation

◆ anonymous enum

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

◆ SCProfilingRuleDestroyCtx()

void SCProfilingRuleDestroyCtx ( SCProfileDetectCtx ctx)

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

Referenced by DetectEngineCtxFree().

Here is the caller graph for this function:

◆ SCProfilingRuleInitCounters()

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 650 of file util-profiling-rules.c.

References de_ctx, DetectEngineCtx_::profile_ctx, and profiling_rules_enabled.

◆ SCProfilingRulesGlobalInit()

◆ SCProfilingRuleThreadCleanup()

◆ SCProfilingRuleThreadSetup()

◆ SCProfilingRuleUpdateCounter()

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, SCProfileData_::matches, SCProfileData_::max, DetectEngineThreadCtx_::rule_perf_data, DetectEngineThreadCtx_::rule_perf_data_size, SCProfileData_::ticks_match, and SCProfileData_::ticks_no_match.

Variable Documentation

◆ profiling_output_to_file

int profiling_output_to_file

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

◆ profiling_rules_enabled

int profiling_rules_enabled = 0