suricata
util-profiling.c File Reference
#include "suricata-common.h"
#include "decode.h"
#include "detect.h"
#include "detect-engine-prefilter.h"
#include "conf.h"
#include "flow-worker.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.c:

Go to the source code of this file.

Data Structures

struct  SCProfilePacketData_
 
struct  ProfileProtoRecords
 

Macros

#define DEFAULT_LOG_FILENAME   "profile.log"
 
#define DEFAULT_LOG_MODE_APPEND   "yes"
 
#define CASE_CODE(E)   case E: return #E
 
#define TEST_RUNS   1024
 

Typedefs

typedef struct SCProfilePacketData_ SCProfilePacketData
 

Functions

void SCProfilingDumpPacketStats (void)
 
const char * PacketProfileDetectIdToString (PacketProfileDetectId id)
 Maps the PacketProfileDetectId, to its string equivalent. More...
 
const char * PacketProfileLoggertIdToString (LoggerId id)
 Maps the LoggerId's to its string equivalent for profiling output. More...
 
void SCProfilingInit (void)
 Initialize profiling. More...
 
void SCProfilingDestroy (void)
 Free resources used by profiling. More...
 
void SCProfilingDump (void)
 
void SCProfilingPrintPacketProfile (Packet *p)
 
void SCProfilingAddPacket (Packet *p)
 
PktProfilingSCProfilePacketStart (void)
 
int SCProfileRuleStart (Packet *p)
 
void SCProfilingRegisterTests (void)
 

Variables

int profiling_locks_enabled
 
int profiling_locks_output_to_file
 
char * profiling_locks_file_name
 
const char * profiling_locks_file_mode
 
SCProfilePacketData packet_profile_data4 [257]
 
SCProfilePacketData packet_profile_data6 [257]
 
SCProfilePacketData packet_profile_tmm_data4 [TMM_SIZE][257]
 
SCProfilePacketData packet_profile_tmm_data6 [TMM_SIZE][257]
 
SCProfilePacketData packet_profile_app_data4 [TMM_SIZE][257]
 
SCProfilePacketData packet_profile_app_data6 [TMM_SIZE][257]
 
SCProfilePacketData packet_profile_app_pd_data4 [257]
 
SCProfilePacketData packet_profile_app_pd_data6 [257]
 
SCProfilePacketData packet_profile_detect_data4 [PROF_DETECT_SIZE][257]
 
SCProfilePacketData packet_profile_detect_data6 [PROF_DETECT_SIZE][257]
 
SCProfilePacketData packet_profile_log_data4 [LOGGER_SIZE][256]
 
SCProfilePacketData packet_profile_log_data6 [LOGGER_SIZE][256]
 
struct ProfileProtoRecords packet_profile_flowworker_data [PROFILE_FLOWWORKER_SIZE]
 
int profiling_packets_enabled = 0
 
int profiling_output_to_file = 0
 
__thread int profiling_rules_entered = 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 profiling operations.

Really just a wrapper around the existing perf counters.

Definition in file util-profiling.c.

Macro Definition Documentation

#define CASE_CODE (   E)    case E: return #E
#define DEFAULT_LOG_FILENAME   "profile.log"

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

#define DEFAULT_LOG_MODE_APPEND   "yes"

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

#define TEST_RUNS   1024

Typedef Documentation

Function Documentation

const char * PacketProfileDetectIdToString ( PacketProfileDetectId  id)

Maps the PacketProfileDetectId, to its string equivalent.

Parameters
idPacketProfileDetectId id
Return values
stringequivalent for the PacketProfileDetectId id

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

References CASE_CODE, PROF_DETECT_ALERT, PROF_DETECT_CLEANUP, PROF_DETECT_GETSGH, PROF_DETECT_IPONLY, PROF_DETECT_NONMPMLIST, PROF_DETECT_PF_PAYLOAD, PROF_DETECT_PF_PKT, PROF_DETECT_PF_SORT1, PROF_DETECT_PF_SORT2, PROF_DETECT_PF_TX, PROF_DETECT_RULES, PROF_DETECT_SETUP, PROF_DETECT_TX, and PROF_DETECT_TX_UPDATE.

Referenced by SCProfilingDumpPacketStats().

Here is the caller graph for this function:

PktProfiling* SCProfilePacketStart ( void  )

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

References SC_ATOMIC_ADD, and SCCalloc.

int SCProfileRuleStart ( Packet p)

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

References Packet_::flags, PKT_PROFILE, Packet_::profile, and SC_ATOMIC_ADD.

void SCProfilingDestroy ( void  )

Free resources used by profiling.

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

References LockRecordFreeHash(), profiling_packets_enabled, and SCFree.

Referenced by PostRunDeinit().

Here is the call graph for this function:

Here is the caller graph for this function:

void SCProfilingRegisterTests ( void  )

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

References UtRegisterTest().

Here is the call graph for this function:

Variable Documentation

SCProfilePacketData packet_profile_app_data4[TMM_SIZE][257]

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

SCProfilePacketData packet_profile_app_data6[TMM_SIZE][257]

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

SCProfilePacketData packet_profile_app_pd_data4[257]

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

SCProfilePacketData packet_profile_app_pd_data6[257]

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

SCProfilePacketData packet_profile_data4[257]

all proto's + tunnel

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

SCProfilePacketData packet_profile_data6[257]

all proto's + tunnel

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

SCProfilePacketData packet_profile_detect_data4[PROF_DETECT_SIZE][257]

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

SCProfilePacketData packet_profile_detect_data6[PROF_DETECT_SIZE][257]

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

struct ProfileProtoRecords packet_profile_flowworker_data[PROFILE_FLOWWORKER_SIZE]

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

Referenced by SCProfilingAddPacket(), SCProfilingDump(), and SCProfilingInit().

SCProfilePacketData packet_profile_log_data4[LOGGER_SIZE][256]

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

SCProfilePacketData packet_profile_log_data6[LOGGER_SIZE][256]

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

SCProfilePacketData packet_profile_tmm_data4[TMM_SIZE][257]

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

SCProfilePacketData packet_profile_tmm_data6[TMM_SIZE][257]

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

int profiling_locks_enabled

Referenced by SCProfilingInit().

const char* profiling_locks_file_mode

Referenced by SCProfilingInit().

char* profiling_locks_file_name

Referenced by SCProfilingInit().

int profiling_locks_output_to_file

Referenced by SCProfilingInit().

int profiling_output_to_file = 0

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

Referenced by SCProfilingRulesGlobalInit().

int profiling_packets_enabled = 0
__thread int profiling_rules_entered = 0

Used as a check so we don't double enter a profiling run.

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