suricata
|
#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 "util-path.h"
Go to the source code of this file.
Data Structures | |
struct | SCProfilePacketData_ |
struct | ProfileProtoRecords |
Macros | |
#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. | |
const char * | PacketProfileLoggerIdToString (LoggerId id) |
Maps the LoggerId's to its string equivalent for profiling output. | |
void | SCProfilingInit (void) |
Initialize profiling. | |
void | SCProfilingDestroy (void) |
Free resources used by profiling. | |
void | SCProfilingDump (void) |
void | SCProfilingPrintPacketProfile (Packet *p) |
void | SCProfilingAddPacket (Packet *p) |
PktProfiling * | SCProfilePacketStart (void) |
int | SCProfileRuleStart (Packet *p) |
void | SCProfilingRegisterTests (void) |
void | SCProfileRuleStartCollection (void) |
void | SCProfileRuleStopCollection (void) |
An API for profiling operations.
Really just a wrapper around the existing perf counters.
Definition in file util-profiling.c.
#define CASE_CODE | ( | E | ) | case E: return #E |
Definition at line 1227 of file util-profiling.c.
#define TEST_RUNS 1024 |
typedef struct SCProfilePacketData_ SCProfilePacketData |
const char * PacketProfileDetectIdToString | ( | PacketProfileDetectId | id | ) |
Maps the PacketProfileDetectId, to its string equivalent.
id | PacketProfileDetectId id |
string | equivalent for the PacketProfileDetectId id |
Definition at line 1236 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_RECORD, 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().
const char * PacketProfileLoggerIdToString | ( | LoggerId | id | ) |
Maps the LoggerId's to its string equivalent for profiling output.
id | LoggerId id |
string | equivalent for the LoggerId id |
Definition at line 1266 of file util-profiling.c.
References CASE_CODE, LOGGER_ALERT_DEBUG, LOGGER_ALERT_FAST, LOGGER_ALERT_SYSLOG, LOGGER_FILE, LOGGER_FILE_STORE, LOGGER_FILEDATA, LOGGER_HTTP, LOGGER_JSON_ALERT, LOGGER_JSON_ANOMALY, LOGGER_JSON_ARP, LOGGER_JSON_DROP, LOGGER_JSON_FILE, LOGGER_JSON_FLOW, LOGGER_JSON_FRAME, LOGGER_JSON_METADATA, LOGGER_JSON_NETFLOW, LOGGER_JSON_STATS, LOGGER_JSON_STREAM, LOGGER_JSON_TX, LOGGER_PCAP, LOGGER_SIZE, LOGGER_STATS, LOGGER_TCP_DATA, LOGGER_TLS, LOGGER_TLS_STORE, LOGGER_TLS_STORE_CLIENT, LOGGER_UNDEFINED, and LOGGER_USER.
Referenced by SCProfilingDumpPacketStats().
PktProfiling * SCProfilePacketStart | ( | void | ) |
Definition at line 1198 of file util-profiling.c.
References g_alproto_max, SC_ATOMIC_ADD, and SCCalloc.
int SCProfileRuleStart | ( | Packet * | p | ) |
Definition at line 1207 of file util-profiling.c.
References Packet_::flags, PKT_PROFILE, Packet_::profile, and SC_ATOMIC_ADD.
void SCProfileRuleStartCollection | ( | void | ) |
Definition at line 1415 of file util-profiling.c.
void SCProfileRuleStopCollection | ( | void | ) |
Definition at line 1419 of file util-profiling.c.
void SCProfilingAddPacket | ( | Packet * | p | ) |
Definition at line 1108 of file util-profiling.c.
References SCProfilePacketData_::cnt, PktProfiling_::flowworker, SCProfilePacketData_::max, SCProfilePacketData_::min, packet_profile_data4, packet_profile_data6, packet_profile_flowworker_data, Packet_::profile, PROFILE_FLOWWORKER_SIZE, Packet_::proto, SCProfilingPrintPacketProfile(), PktProfiling_::ticks_end, PktProfiling_::ticks_start, and SCProfilePacketData_::tot.
void SCProfilingDestroy | ( | void | ) |
Free resources used by profiling.
Definition at line 276 of file util-profiling.c.
References LockRecordFreeHash(), packet_profile_app_data4, packet_profile_app_data6, profiling_packets_enabled, and SCFree.
Referenced by PostRunDeinit().
void SCProfilingDump | ( | void | ) |
Definition at line 311 of file util-profiling.c.
References SCLogPerf, and SCProfilingDumpPacketStats().
Referenced by PostRunDeinit().
void SCProfilingDumpPacketStats | ( | void | ) |
Definition at line 366 of file util-profiling.c.
References AppProtoToString(), SCProfilePacketData_::cnt, g_alproto_max, LOGGER_SIZE, m, SCProfilePacketData_::max, SCProfilePacketData_::min, packet_profile_app_data4, packet_profile_app_data6, packet_profile_app_pd_data4, packet_profile_app_pd_data6, packet_profile_data4, packet_profile_data6, packet_profile_detect_data4, packet_profile_detect_data6, packet_profile_log_data4, packet_profile_log_data6, packet_profile_tmm_data4, packet_profile_tmm_data6, PacketProfileDetectIdToString(), PacketProfileLoggerIdToString(), PROF_DETECT_SIZE, profiling_packets_enabled, SCLogError, TMM_SIZE, TmModuleTmmIdToString(), and SCProfilePacketData_::tot.
Referenced by SCProfilingDump().
void SCProfilingInit | ( | void | ) |
Initialize profiling.
Definition at line 133 of file util-profiling.c.
References FatalError, g_alproto_max, LockRecordInitHash(), packet_profile_app_data4, packet_profile_app_data6, packet_profile_app_pd_data4, packet_profile_app_pd_data6, packet_profile_data4, packet_profile_data6, packet_profile_detect_data4, packet_profile_detect_data6, packet_profile_flowworker_data, packet_profile_log_data4, packet_profile_log_data6, packet_profile_tmm_data4, packet_profile_tmm_data6, PathIsAbsolute(), profiling_locks_enabled, profiling_locks_file_mode, profiling_locks_file_name, profiling_locks_output_to_file, profiling_packets_enabled, SC_ATOMIC_INIT, SCCalloc, SCConfGetInt(), SCConfGetNode(), SCConfigGetLogDirectory(), SCConfNodeChildValueIsTrue(), SCConfNodeLookupChildValue(), SCConfValIsTrue(), SCFree, SCLogInfo, SCLogWarning, SCMalloc, SCStrdup, strlcpy(), and unlikely.
Referenced by PreRunInit().
void SCProfilingPrintPacketProfile | ( | Packet * | p | ) |
Definition at line 780 of file util-profiling.c.
References PktProfiling_::app, PktProfiling_::detect, flags, PktProfiling_::flowworker, g_alproto_max, PktProfiling_::logger, LOGGER_SIZE, Packet_::pcap_cnt, PROF_DETECT_SIZE, Packet_::profile, PROFILE_FLOWWORKER_APPLAYERUDP, PROFILE_FLOWWORKER_SIZE, PROFILE_FLOWWORKER_STREAM, Packet_::proto, PktProfiling_::proto_detect, PktProfilingTmmData_::ticks_end, PktProfilingData_::ticks_end, PktProfiling_::ticks_end, PktProfilingDetectData_::ticks_spent, PktProfilingAppData_::ticks_spent, PktProfilingLoggerData_::ticks_spent, PktProfilingTmmData_::ticks_start, PktProfilingData_::ticks_start, PktProfiling_::ticks_start, TM_FLAG_DECODE_TM, TM_FLAG_RECEIVE_TM, PktProfiling_::tmm, TMM_FLOWWORKER, tmm_modules, and TMM_SIZE.
Referenced by SCProfilingAddPacket().
void SCProfilingRegisterTests | ( | void | ) |
Definition at line 1408 of file util-profiling.c.
References UtRegisterTest().
SCProfilePacketData* packet_profile_app_data4 |
Definition at line 75 of file util-profiling.c.
Referenced by SCProfilingDestroy(), SCProfilingDumpPacketStats(), and SCProfilingInit().
SCProfilePacketData* packet_profile_app_data6 |
Definition at line 76 of file util-profiling.c.
Referenced by SCProfilingDestroy(), SCProfilingDumpPacketStats(), and SCProfilingInit().
SCProfilePacketData packet_profile_app_pd_data4[257] |
Definition at line 78 of file util-profiling.c.
Referenced by SCProfilingDumpPacketStats(), and SCProfilingInit().
SCProfilePacketData packet_profile_app_pd_data6[257] |
Definition at line 79 of file util-profiling.c.
Referenced by SCProfilingDumpPacketStats(), and SCProfilingInit().
SCProfilePacketData packet_profile_data4[257] |
all proto's + tunnel
Definition at line 68 of file util-profiling.c.
Referenced by SCProfilingAddPacket(), SCProfilingDumpPacketStats(), and SCProfilingInit().
SCProfilePacketData packet_profile_data6[257] |
all proto's + tunnel
Definition at line 69 of file util-profiling.c.
Referenced by SCProfilingAddPacket(), SCProfilingDumpPacketStats(), and SCProfilingInit().
SCProfilePacketData packet_profile_detect_data4[PROF_DETECT_SIZE][257] |
Definition at line 81 of file util-profiling.c.
Referenced by SCProfilingDumpPacketStats(), and SCProfilingInit().
SCProfilePacketData packet_profile_detect_data6[PROF_DETECT_SIZE][257] |
Definition at line 82 of file util-profiling.c.
Referenced by SCProfilingDumpPacketStats(), and SCProfilingInit().
struct ProfileProtoRecords packet_profile_flowworker_data[PROFILE_FLOWWORKER_SIZE] |
Definition at line 92 of file util-profiling.c.
Referenced by SCProfilingAddPacket(), and SCProfilingInit().
SCProfilePacketData packet_profile_log_data4[LOGGER_SIZE][256] |
Definition at line 84 of file util-profiling.c.
Referenced by SCProfilingDumpPacketStats(), and SCProfilingInit().
SCProfilePacketData packet_profile_log_data6[LOGGER_SIZE][256] |
Definition at line 85 of file util-profiling.c.
Referenced by SCProfilingDumpPacketStats(), and SCProfilingInit().
SCProfilePacketData packet_profile_tmm_data4[TMM_SIZE][257] |
Definition at line 72 of file util-profiling.c.
Referenced by SCProfilingDumpPacketStats(), and SCProfilingInit().
SCProfilePacketData packet_profile_tmm_data6[TMM_SIZE][257] |
Definition at line 73 of file util-profiling.c.
Referenced by SCProfilingDumpPacketStats(), and SCProfilingInit().
|
extern |
Referenced by SCProfilingInit().
|
extern |
Referenced by SCProfilingInit().
|
extern |
Referenced by SCProfilingInit().
|
extern |
Referenced by SCProfilingInit().
int profiling_output_to_file = 0 |
Definition at line 95 of file util-profiling.c.
int profiling_packets_enabled = 0 |
Definition at line 94 of file util-profiling.c.
Referenced by PostRunDeinit(), SCProfilingDestroy(), SCProfilingDumpPacketStats(), and SCProfilingInit().
thread_local int profiling_rules_entered = 0 |
Used as a check so we don't double enter a profiling run.
Definition at line 110 of file util-profiling.c.