From 41e9dba20bdf74344f352e05431aa27d9550e527 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 15 Mar 2012 16:22:47 +0100 Subject: [PATCH] Profile pcap file callback. --- src/source-pcap-file.c | 4 ++++ src/suricata-common.h | 2 ++ src/util-profiling.h | 2 -- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/source-pcap-file.c b/src/source-pcap-file.c index e0144be67c..3919fcdaf3 100644 --- a/src/source-pcap-file.c +++ b/src/source-pcap-file.c @@ -46,6 +46,7 @@ #include "tm-threads.h" #include "util-optimize.h" #include "flow-manager.h" +#include "util-profiling.h" extern uint8_t suricata_ctl_flags; extern int max_pending_packets; @@ -123,6 +124,7 @@ void PcapFileCallbackLoop(char *user, struct pcap_pkthdr *h, u_char *pkt) { if (unlikely(p == NULL)) { SCReturn; } + PACKET_PROFILING_TMM_START(p, TMM_RECEIVEPCAPFILE); p->ts.tv_sec = h->ts.tv_sec; p->ts.tv_usec = h->ts.tv_usec; @@ -135,8 +137,10 @@ void PcapFileCallbackLoop(char *user, struct pcap_pkthdr *h, u_char *pkt) { if (unlikely(PacketCopyData(p, pkt, h->caplen))) { TmqhOutputPacketpool(ptv->tv, p); + PACKET_PROFILING_TMM_END(p, TMM_RECEIVEPCAPFILE); SCReturn; } + PACKET_PROFILING_TMM_END(p, TMM_RECEIVEPCAPFILE); if (TmThreadsSlotProcessPkt(ptv->tv, ptv->slot, p) != TM_ECODE_OK) { pcap_breakloop(pcap_g.pcap_handle); diff --git a/src/suricata-common.h b/src/suricata-common.h index f8e5885324..b7345fd9bc 100644 --- a/src/suricata-common.h +++ b/src/suricata-common.h @@ -30,6 +30,8 @@ #define DBG_PERF #endif +//#define PROFILE_LOCKING + #define TRUE 1 #define FALSE 0 diff --git a/src/util-profiling.h b/src/util-profiling.h index 1dce64c90a..4f99085e7b 100644 --- a/src/util-profiling.h +++ b/src/util-profiling.h @@ -27,8 +27,6 @@ #ifdef PROFILING -//#define PROFILE_LOCKING - #include "util-cpu.h" extern int profiling_rules_enabled; -- 2.47.2