#include "flow.h"
#include "flow-private.h"
+#include "util-profiling.h"
+
/** tag signature we use for tag alerts */
static Signature g_tag_signature;
/** tag packet alert structure for tag alerts */
/* handle suppressions first */
if (s->sm_lists[DETECT_SM_LIST_SUPPRESS] != NULL) {
+ KEYWORD_PROFILING_SET_LIST(det_ctx, DETECT_SM_LIST_SUPPRESS);
sm = NULL;
do {
td = SigGetThresholdTypeIter(s, p, &sm, DETECT_SM_LIST_SUPPRESS);
/* PacketAlertThreshold returns 2 if the alert is suppressed but
* we do need to apply rule actions to the packet. */
+ KEYWORD_PROFILING_START;
ret = PacketAlertThreshold(de_ctx, det_ctx, td, p, s);
if (ret == 0 || ret == 2) {
+ KEYWORD_PROFILING_END(det_ctx, DETECT_THRESHOLD, 0);
/* It doesn't match threshold, remove it */
SCReturnInt(ret);
}
+ KEYWORD_PROFILING_END(det_ctx, DETECT_THRESHOLD, 1);
}
} while (sm != NULL);
}
/* if we're still here, consider thresholding */
if (s->sm_lists[DETECT_SM_LIST_THRESHOLD] != NULL) {
+ KEYWORD_PROFILING_SET_LIST(det_ctx, DETECT_SM_LIST_THRESHOLD);
sm = NULL;
do {
td = SigGetThresholdTypeIter(s, p, &sm, DETECT_SM_LIST_THRESHOLD);
/* PacketAlertThreshold returns 2 if the alert is suppressed but
* we do need to apply rule actions to the packet. */
+ KEYWORD_PROFILING_START;
ret = PacketAlertThreshold(de_ctx, det_ctx, td, p, s);
if (ret == 0 || ret == 2) {
+ KEYWORD_PROFILING_END(det_ctx, DETECT_THRESHOLD ,0);
/* It doesn't match threshold, remove it */
SCReturnInt(ret);
}
+ KEYWORD_PROFILING_END(det_ctx, DETECT_THRESHOLD, 1);
}
} while (sm != NULL);
}
if (res > 0) {
/* Now, if we have an alert, we have to check if we want
* to tag this session or src/dst host */
+ KEYWORD_PROFILING_SET_LIST(det_ctx, DETECT_SM_LIST_TMATCH);
sm = s->sm_lists[DETECT_SM_LIST_TMATCH];
while (sm) {
/* tags are set only for alerts */
+ KEYWORD_PROFILING_START;
sigmatch_table[sm->type].Match(NULL, det_ctx, p, s, sm);
+ KEYWORD_PROFILING_END(det_ctx, sm->type, 1);
sm = sm->next;
}
#include "detect-engine-state.h"
#include "stream.h"
#include "detect-engine-apt-event.h"
-
+#include "util-profiling.h"
#include "util-unittest.h"
int DetectEngineAptEventInspect(ThreadVars *tv,
for (sm = s->sm_lists[DETECT_SM_LIST_APP_EVENT]; sm != NULL; sm = sm->next) {
aled = (DetectAppLayerEventData *)sm->ctx;
- if (AppLayerDecoderEventsIsEventSet(decoder_events, aled->event_id))
+ KEYWORD_PROFILING_START;
+ if (AppLayerDecoderEventsIsEventSet(decoder_events, aled->event_id)) {
+ KEYWORD_PROFILING_END(det_ctx, sm->type, 1);
continue;
+ }
+
+ KEYWORD_PROFILING_END(det_ctx, sm->type, 0);
goto end;
}
}
}
}
+
int match = 0;
int store_r = 0;
+ KEYWORD_PROFILING_SET_LIST(det_ctx, DETECT_SM_LIST_FILEMATCH);
SCLogDebug("file inspection... %p", ffc);
if (ffc != NULL) {
SCLogDebug("sm %p, sm->next %p", sm, sm->next);
if (sigmatch_table[sm->type].FileMatch != NULL) {
+ KEYWORD_PROFILING_START;
match = sigmatch_table[sm->type].
FileMatch(tv, det_ctx, f, flags, file, s, sm);
+ KEYWORD_PROFILING_END(det_ctx, sm->type, (match > 0));
if (match == 0) {
r = 2;
break;
{
DetectFilestoreData *fd = sm->ctx;
if (fd->scope > FILESTORE_SCOPE_DEFAULT) {
+ KEYWORD_PROFILING_START;
match = sigmatch_table[sm->type].
FileMatch(tv, det_ctx, f, flags, /* no file */NULL, s, sm);
+ KEYWORD_PROFILING_END(det_ctx, sm->type, (match > 0));
+
if (match == 1) {
r = 1;
}
DetectEngineThreadCtx *det_ctx,
Signature *s, Packet *p)
{
+ KEYWORD_PROFILING_SET_LIST(det_ctx, DETECT_SM_LIST_MATCH);
SigMatch *sm = s->sm_lists[DETECT_SM_LIST_MATCH];
while (sm != NULL) {
u * 8 + i, s->id, s->msg);
if (s->sm_lists[DETECT_SM_LIST_POSTMATCH] != NULL) {
+ KEYWORD_PROFILING_SET_LIST(det_ctx, DETECT_SM_LIST_POSTMATCH);
SigMatch *sm = s->sm_lists[DETECT_SM_LIST_POSTMATCH];
SCLogDebug("running match functions, sm %p", sm);