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

Go to the source code of this file.

Data Structures

struct  SCProfilePacketData_
struct  ProfileProtoRecords


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


typedef struct SCProfilePacketData_ SCProfilePacketData


void SCProfilingDumpPacketStats (void)
const char * PacketProfileDetectIdToString (PacketProfileDetectId id)
 Maps the PacketProfileDetectId, to its string equivalent. More...
const char * PacketProfileLoggerIdToString (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)
void SCProfileRuleStartCollection (void)
void SCProfileRuleStopCollection (void)


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_local int profiling_rules_entered = 0

Detailed Description

Endace Technology Limited.
Victor Julien

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

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


#define DEFAULT_LOG_FILENAME   "profile.log"

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



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


#define TEST_RUNS   1024

Typedef Documentation

◆ SCProfilePacketData

Function Documentation

◆ PacketProfileDetectIdToString()

const char * PacketProfileDetectIdToString ( PacketProfileDetectId  id)

Maps the PacketProfileDetectId, to its string equivalent.

idPacketProfileDetectId id
Return values
stringequivalent for the PacketProfileDetectId id

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


◆ PacketProfileLoggerIdToString()

◆ SCProfilePacketStart()

PktProfiling* SCProfilePacketStart ( void  )

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

References SC_ATOMIC_ADD.

◆ SCProfileRuleStart()

int SCProfileRuleStart ( Packet p)

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

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

◆ SCProfileRuleStartCollection()

void SCProfileRuleStartCollection ( void  )

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

◆ SCProfileRuleStopCollection()

void SCProfileRuleStopCollection ( void  )

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

◆ SCProfilingAddPacket()

void SCProfilingAddPacket ( Packet p)

◆ SCProfilingDestroy()

void SCProfilingDestroy ( void  )

Free resources used by profiling.

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

References profiling_packets_enabled.

◆ SCProfilingDump()

void SCProfilingDump ( void  )

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

References SCLogPerf, and SCProfilingDumpPacketStats().

Here is the call graph for this function:

◆ SCProfilingDumpPacketStats()

void SCProfilingDumpPacketStats ( void  )

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

References profiling_packets_enabled.

Referenced by SCProfilingDump().

Here is the caller graph for this function:

◆ SCProfilingInit()

void SCProfilingInit ( void  )

Initialize profiling.

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

References ConfGetInt(), and SC_ATOMIC_INIT.

Referenced by PreRunInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SCProfilingPrintPacketProfile()

void SCProfilingPrintPacketProfile ( Packet p)

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

◆ SCProfilingRegisterTests()

void SCProfilingRegisterTests ( void  )

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

References UtRegisterTest().

Here is the call graph for this function:

Variable Documentation

◆ packet_profile_app_data4

SCProfilePacketData packet_profile_app_data4[TMM_SIZE][257]

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

◆ packet_profile_app_data6

SCProfilePacketData packet_profile_app_data6[TMM_SIZE][257]

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

◆ packet_profile_app_pd_data4

SCProfilePacketData packet_profile_app_pd_data4[257]

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

◆ packet_profile_app_pd_data6

SCProfilePacketData packet_profile_app_pd_data6[257]

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

◆ packet_profile_data4

SCProfilePacketData packet_profile_data4[257]

all proto's + tunnel

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

◆ packet_profile_data6

SCProfilePacketData packet_profile_data6[257]

all proto's + tunnel

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

◆ packet_profile_detect_data4

SCProfilePacketData packet_profile_detect_data4[PROF_DETECT_SIZE][257]

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

◆ packet_profile_detect_data6

SCProfilePacketData packet_profile_detect_data6[PROF_DETECT_SIZE][257]

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

◆ packet_profile_flowworker_data

struct ProfileProtoRecords packet_profile_flowworker_data[PROFILE_FLOWWORKER_SIZE]

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

◆ packet_profile_log_data4

SCProfilePacketData packet_profile_log_data4[LOGGER_SIZE][256]

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

◆ packet_profile_log_data6

SCProfilePacketData packet_profile_log_data6[LOGGER_SIZE][256]

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

◆ packet_profile_tmm_data4

SCProfilePacketData packet_profile_tmm_data4[TMM_SIZE][257]

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

◆ packet_profile_tmm_data6

SCProfilePacketData packet_profile_tmm_data6[TMM_SIZE][257]

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

◆ profiling_locks_enabled

int profiling_locks_enabled

◆ profiling_locks_file_mode

const char* profiling_locks_file_mode

◆ profiling_locks_file_name

char* profiling_locks_file_name

◆ profiling_locks_output_to_file

int profiling_locks_output_to_file

◆ profiling_output_to_file

int profiling_output_to_file = 0

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

◆ profiling_packets_enabled

int profiling_packets_enabled = 0

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

Referenced by SCProfilingDestroy(), and SCProfilingDumpPacketStats().

◆ profiling_rules_entered

thread_local int profiling_rules_entered = 0

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

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