From: Victor Julien Date: Thu, 15 Mar 2012 15:22:47 +0000 (+0100) Subject: Profile pcap file callback. X-Git-Tag: suricata-1.3beta1~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41e9dba20bdf74344f352e05431aa27d9550e527;p=thirdparty%2Fsuricata.git Profile pcap file callback. --- 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;