Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

perf-base.c File Reference

#include <time.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include "snort.h"
#include "util.h"
#include "mpse.h"

Go to the source code of this file.

Defines

#define UINT32_MAX   (4294967295U)

Functions

int GetPktDropStats (SFBASE *sfBase, SFBASE_STATS *sfBaseStats)
int DisplayBasePerfStatsConsole (SFBASE_STATS *sfBaseStats, int iFlags)
int CalculateBasePerfStats (SFBASE *sfPerf, SFBASE_STATS *sfBaseStats)
int LogBasePerfStats (SFBASE_STATS *sfBaseStats, FILE *fh)
int InitBaseStats (SFBASE *sfBase)
int UpdateBaseStats (SFBASE *sfBase, int len, int iRebuiltPkt)
void UpdateWireStats (SFBASE *sfBase, int len)
void UpdateIPFragStats (SFBASE *sfBase, int len)
void UpdateIPReassStats (SFBASE *sfBase, int len)
int AddStreamSession (SFBASE *sfBase)
int RemoveStreamSession (SFBASE *sfBase)
int ProcessBaseStats (SFBASE *sfBase, int console, int file, FILE *fh)
int GetProcessingTime (SYSTIMES *Systimes, SFBASE *sfBase)
int GetEventsPerSecond (SFBASE *sfBase, SFBASE_STATS *sfBaseStats, SYSTIMES *Systimes)
int GetPacketsPerSecond (SFBASE *sfBase, SFBASE_STATS *sfBaseStats, SYSTIMES *Systimes)
int GetuSecondsPerPacket (SFBASE *sfBase, SFBASE_STATS *sfBaseStats, SYSTIMES *Systimes)
int GetMbitsPerSecond (SFBASE *sfBase, SFBASE_STATS *sfBaseStats, SYSTIMES *Systimes)
int GetCPUTime (SFBASE *sfBase, SFBASE_STATS *sfBaseStats, SYSTIMES *Systimes)


Define Documentation

#define UINT32_MAX   (4294967295U)
 

Definition at line 56 of file perf-base.c.

Referenced by GetPktDropStats().


Function Documentation

int AddStreamSession SFBASE sfBase  ) 
 

Definition at line 315 of file perf-base.c.

References _SFBASE::iMaxSessions, _SFBASE::iNewSessions, and _SFBASE::iTotalSessions.

Referenced by ReassembleStream4().

int CalculateBasePerfStats SFBASE sfPerf,
SFBASE_STATS sfBaseStats
 

Definition at line 731 of file perf-base.c.

References _SFBASE_STATS::avg_bytes_per_ipfrag_packet, _SFBASE_STATS::avg_bytes_per_ipreass_packet, _SFBASE_STATS::avg_bytes_per_packet, _SFBASE_STATS::avg_bytes_per_rebuilt_packet, _SFBASE_STATS::avg_bytes_per_wire_packet, GetCPUTime(), GetEventsPerSecond(), GetMbitsPerSecond(), GetPacketsPerSecond(), GetPktDropStats(), GetProcessingTime(), GetuSecondsPerPacket(), int(), MAX_PERF_STATS, mpseGetPatByteCount(), mpseResetByteCount(), _SFBASE_STATS::patmatch_percent, _SFBASE_STATS::time, and _SFBASE_STATS::total_packets.

Referenced by ProcessBaseStats().

int DisplayBasePerfStatsConsole SFBASE_STATS sfBaseStats,
int  iFlags
 

Definition at line 1131 of file perf-base.c.

References _SFBASE_STATS::alerts_per_second, _SFBASE_STATS::avg_bytes_per_ipfrag_packet, _SFBASE_STATS::avg_bytes_per_ipreass_packet, _SFBASE_STATS::avg_bytes_per_packet, _SFBASE_STATS::avg_bytes_per_rebuilt_packet, _SFBASE_STATS::avg_bytes_per_wire_packet, _SFBASE_STATS::current_frags, _SFBASE_STATS::deleted_sessions_per_second, _SFBASE_STATS::frag_autofrees_per_second, _SFBASE_STATS::frag_completes_per_second, _SFBASE_STATS::frag_creates_per_second, _SFBASE_STATS::frag_deletes_per_second, _SFBASE_STATS::frag_faults, _SFBASE_STATS::frag_flushes_per_second, _SFBASE_STATS::frag_inserts_per_second, _SFBASE_STATS::frag_timeouts, _SFBASE_STATS::idle_cpu_time, _SFBASE_STATS::ipfrag_mbits_per_sec, _SFBASE_STATS::ipreass_mbits_per_sec, _SFBASE_STATS::kpackets_ipfrag_per_sec, _SFBASE_STATS::kpackets_ipreass_per_sec, _SFBASE_STATS::kpackets_per_sec, _SFBASE_STATS::kpackets_rebuilt_per_sec, _SFBASE_STATS::kpackets_wire_per_sec, LogMessage(), _SFBASE_STATS::max_frags, MAX_PERF_STATS, _SFBASE_STATS::max_sessions, _SFBASE_STATS::mbits_per_sec, _SFBASE_STATS::new_sessions_per_second, _SFBASE_STATS::patmatch_percent, _SFBASE_STATS::pkt_drop_percent, _SFBASE_STATS::pkt_stats, _PKTSTATS::pkts_drop, _PKTSTATS::pkts_recv, _SYSTIMES::realtime, _SFBASE_STATS::rebuilt_mbits_per_sec, _SFBASE_STATS::stream_faults, _SFBASE_STATS::stream_flushes_per_second, _SFBASE_STATS::stream_timeouts, _SFBASE_STATS::synacks_per_second, _SFBASE_STATS::syns_per_second, _SFBASE_STATS::system_cpu_time, _SYSTIMES::systemtime, _SFBASE_STATS::time, _SFBASE_STATS::total_sessions, _SYSTIMES::totaltime, _SFBASE_STATS::usecs_per_packet, _SFBASE_STATS::user_cpu_time, _SYSTIMES::usertime, and _SFBASE_STATS::wire_mbits_per_sec.

Referenced by ProcessBaseStats().

int GetCPUTime SFBASE sfBase,
SFBASE_STATS sfBaseStats,
SYSTIMES Systimes
 

Definition at line 652 of file perf-base.c.

References _SFBASE_STATS::idle_cpu_time, _SYSTIMES::realtime, _SFBASE_STATS::system_cpu_time, _SYSTIMES::systemtime, _SYSTIMES::totaltime, _SFBASE_STATS::user_cpu_time, and _SYSTIMES::usertime.

Referenced by CalculateBasePerfStats().

int GetEventsPerSecond SFBASE sfBase,
SFBASE_STATS sfBaseStats,
SYSTIMES Systimes
 

Definition at line 426 of file perf-base.c.

References _PacketCount::alert_pkts, _SFBASE_STATS::alerts_per_second, _SFBASE_STATS::current_frags, _SFBASE_STATS::deleted_sessions_per_second, _SFBASE_STATS::frag_autofrees_per_second, _SFBASE_STATS::frag_completes_per_second, _SFBASE_STATS::frag_creates_per_second, _SFBASE_STATS::frag_deletes_per_second, _SFBASE_STATS::frag_faults, _SFBASE_STATS::frag_flushes_per_second, _SFBASE_STATS::frag_inserts_per_second, _SFBASE_STATS::frag_timeouts, _SFBASE::iAlerts, _SFBASE::iCurrentFrags, _SFBASE::iDeletedSessions, _SFBASE::iFragAutoFrees, _SFBASE::iFragCompletes, _SFBASE::iFragCreates, _SFBASE::iFragDeletes, _SFBASE::iFragFaults, _SFBASE::iFragFlushes, _SFBASE::iFragInserts, _SFBASE::iFragTimeouts, _SFBASE::iMaxFrags, _SFBASE::iMaxSessions, _SFBASE::iNewSessions, _SFBASE::iStreamFaults, _SFBASE::iStreamFlushes, _SFBASE::iStreamTimeouts, _SFBASE::iSynAcks, _SFBASE::iSyns, _SFBASE::iTotalSessions, _SFBASE_STATS::max_frags, _SFBASE_STATS::max_sessions, _SFBASE_STATS::new_sessions_per_second, pc, _SYSTIMES::realtime, _SFBASE_STATS::stream_faults, _SFBASE_STATS::stream_flushes_per_second, _SFBASE_STATS::stream_timeouts, _SFBASE_STATS::synacks_per_second, _SFBASE_STATS::syns_per_second, and _SFBASE_STATS::total_sessions.

Referenced by CalculateBasePerfStats().

int GetMbitsPerSecond SFBASE sfBase,
SFBASE_STATS sfBaseStats,
SYSTIMES Systimes
 

Definition at line 603 of file perf-base.c.

References _SFBASE::iFlags, _SFBASE_STATS::ipfrag_mbits_per_sec, _SFBASE_STATS::ipreass_mbits_per_sec, MAX_PERF_STATS, _SFBASE_STATS::mbits_per_sec, _SYSTIMES::realtime, _SFBASE_STATS::rebuilt_mbits_per_sec, _SYSTIMES::systemtime, _SFBASE::total_bytes, _SFBASE::total_ipfragmented_bytes, _SFBASE::total_ipreassembled_bytes, _SFBASE::total_rebuilt_bytes, _SFBASE::total_wire_bytes, _SYSTIMES::totaltime, _SYSTIMES::usertime, and _SFBASE_STATS::wire_mbits_per_sec.

Referenced by CalculateBasePerfStats().

int GetPacketsPerSecond SFBASE sfBase,
SFBASE_STATS sfBaseStats,
SYSTIMES Systimes
 

Definition at line 501 of file perf-base.c.

References _SFBASE::iFlags, _SFBASE_STATS::kpackets_ipfrag_per_sec, _SFBASE_STATS::kpackets_ipreass_per_sec, _SFBASE_STATS::kpackets_per_sec, _SFBASE_STATS::kpackets_rebuilt_per_sec, _SFBASE_STATS::kpackets_wire_per_sec, MAX_PERF_STATS, _SYSTIMES::realtime, _SYSTIMES::systemtime, _SFBASE::total_ipfragmented_packets, _SFBASE::total_ipreassembled_packets, _SFBASE::total_packets, _SFBASE::total_rebuilt_packets, _SFBASE::total_wire_packets, _SYSTIMES::totaltime, and _SYSTIMES::usertime.

Referenced by CalculateBasePerfStats().

int GetPktDropStats SFBASE sfBase,
SFBASE_STATS sfBaseStats
 

Definition at line 863 of file perf-base.c.

References _SFBASE::iReset, pcap_stats(), pd, _SFBASE_STATS::pkt_drop_percent, _SFBASE::pkt_stats, _SFBASE_STATS::pkt_stats, _PKTSTATS::pkts_drop, _PKTSTATS::pkts_recv, pcap_stat::ps_drop, pcap_stat::ps_recv, pv, _progvars::readmode_flag, _SFBASE_STATS::total_packets, and UINT32_MAX.

Referenced by CalculateBasePerfStats().

int GetProcessingTime SYSTIMES Systimes,
SFBASE sfBase
 

Definition at line 382 of file perf-base.c.

References gettimeofday(), NULL, _SYSTIMES::realtime, _SFBASE::realtime_sec, rusage::ru_stime, rusage::ru_utime, RUSAGE_SELF, _SYSTIMES::systemtime, _SFBASE::systemtime_sec, _SYSTIMES::totaltime, _SYSTIMES::usertime, and _SFBASE::usertime_sec.

Referenced by CalculateBasePerfStats().

int GetuSecondsPerPacket SFBASE sfBase,
SFBASE_STATS sfBaseStats,
SYSTIMES Systimes
 

Definition at line 588 of file perf-base.c.

References _SYSTIMES::realtime, _SYSTIMES::systemtime, _SFBASE::total_packets, _SYSTIMES::totaltime, _SFBASE_STATS::usecs_per_packet, and _SYSTIMES::usertime.

Referenced by CalculateBasePerfStats().

int InitBaseStats SFBASE sfBase  ) 
 

Definition at line 77 of file perf-base.c.

References gettimeofday(), _SFBASE::iDeletedSessions, _SFBASE::iFragAutoFrees, _SFBASE::iFragCompletes, _SFBASE::iFragCreates, _SFBASE::iFragDeletes, _SFBASE::iFragFaults, _SFBASE::iFragFlushes, _SFBASE::iFragInserts, _SFBASE::iFragTimeouts, _SFBASE::iNewSessions, _SFBASE::iStreamFaults, _SFBASE::iStreamFlushes, _SFBASE::iStreamTimeouts, NULL, _SFBASE::realtime_sec, rusage::ru_stime, rusage::ru_utime, RUSAGE_SELF, _SFBASE::systemtime_sec, _SFBASE::total_bytes, _SFBASE::total_ipfragmented_bytes, _SFBASE::total_ipfragmented_packets, _SFBASE::total_ipreassembled_bytes, _SFBASE::total_ipreassembled_packets, _SFBASE::total_packets, _SFBASE::total_rebuilt_bytes, _SFBASE::total_rebuilt_packets, _SFBASE::total_wire_bytes, _SFBASE::total_wire_packets, and _SFBASE::usertime_sec.

Referenced by InitPerfStats().

int LogBasePerfStats SFBASE_STATS sfBaseStats,
FILE *  fh
 

Definition at line 987 of file perf-base.c.

References WIN32.

Referenced by ProcessBaseStats().

int ProcessBaseStats SFBASE sfBase,
int  console,
int  file,
FILE *  fh
 

Definition at line 362 of file perf-base.c.

References CalculateBasePerfStats(), DisplayBasePerfStatsConsole(), _SFBASE::iFlags, and LogBasePerfStats().

Referenced by ProcessPerfStats().

int RemoveStreamSession SFBASE sfBase  ) 
 

Definition at line 340 of file perf-base.c.

References _SFBASE::iDeletedSessions, and _SFBASE::iTotalSessions.

Referenced by DeleteSession().

int UpdateBaseStats SFBASE sfBase,
int  len,
int  iRebuiltPkt
 

Definition at line 210 of file perf-base.c.

References _SFBASE::total_bytes, _SFBASE::total_packets, _SFBASE::total_rebuilt_bytes, and _SFBASE::total_rebuilt_packets.

Referenced by UpdatePerfStats().

void UpdateIPFragStats SFBASE sfBase,
int  len
 

Definition at line 269 of file perf-base.c.

References _SFBASE::total_ipfragmented_bytes, _SFBASE::total_ipfragmented_packets, and _SFBASE::total_wire_bytes.

Referenced by Frag2Defrag(), and Frag3Defrag().

void UpdateIPReassStats SFBASE sfBase,
int  len
 

Definition at line 292 of file perf-base.c.

References _SFBASE::total_ipreassembled_bytes, _SFBASE::total_ipreassembled_packets, and _SFBASE::total_wire_bytes.

Referenced by Frag3Rebuild(), and RebuildFrag().

void UpdateWireStats SFBASE sfBase,
int  len
 

Definition at line 247 of file perf-base.c.

References _SFBASE::total_wire_bytes, and _SFBASE::total_wire_packets.

Referenced by PcapProcessPacket().


Generated on Sun May 14 14:51:25 2006 by  doxygen 1.4.2