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

perf-base.h

Go to the documentation of this file.
00001 /*
00002 ** $Id$
00003 **
00004 ** perf-base.h
00005 **
00006 ** Copyright (C) 2002 Sourcefire,Inc
00007 ** Dan Roelker (droelker@sourcefire.com)
00008 ** Marc Norton (mnorton@sourcefire.com)
00009 ** Chris Green (stream4 instrumentation)
00010 **
00011 **
00012 ** This program is free software; you can redistribute it and/or modify
00013 ** it under the terms of the GNU General Public License as published by
00014 ** the Free Software Foundation; either version 2 of the License, or
00015 ** (at your option) any later version.
00016 **
00017 ** This program is distributed in the hope that it will be useful,
00018 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 ** GNU General Public License for more details.
00021 **
00022 ** You should have received a copy of the GNU General Public License
00023 ** along with this program; if not, write to the Free Software
00024 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00025 **
00026 ** 9.1.04  : Added SFBASE iReset (MAN)
00027 **           This is set by perfmonitor 'accrure' and 'reset' commands
00028 */
00029 #ifndef _PERFBASE_H
00030 #define _PERFBASE_H
00031 
00032 #include "config.h"
00033 #include "sfprocpidstats.h"
00034 
00035 #include <time.h>
00036 
00037 #define MAX_PERF_STATS 1
00038 
00039 typedef struct _PKTSTATS {
00040 
00041     UINT64 pkts_recv;
00042     UINT64 pkts_drop;
00043 
00044 }  PKTSTATS;
00045 
00046 typedef struct _SFBASE {
00047 
00048     UINT64   total_wire_packets;
00049     UINT64   total_ipfragmented_packets;
00050     UINT64   total_ipreassembled_packets;
00051     UINT64   total_packets;  /* Really, total packets of
00052                               * unfragmented/stream rebuilt
00053                               */
00054     UINT64   total_rebuilt_packets;
00055     UINT64   total_wire_bytes;
00056     UINT64   total_ipfragmented_bytes;
00057     UINT64   total_ipreassembled_bytes;
00058     UINT64   total_bytes;    /* Total non-stream rebuilt (but
00059                               * includes IP reassembled) bytes
00060                               */
00061     UINT64   total_rebuilt_bytes;
00062 
00063     PKTSTATS pkt_stats;
00064 
00065     double   usertime_sec;
00066     double   systemtime_sec;
00067     double   realtime_sec;
00068 
00069     time_t time;
00070 
00071     UINT64   iAlerts;
00072     UINT64   iSyns;      /* SYNS != Connections */
00073     UINT64   iSynAcks;   /* better estimator  */
00074     UINT64   iTotalSessions;
00075     UINT64   iNewSessions;
00076     UINT64   iDeletedSessions;
00077     UINT64   iMaxSessions;
00078 
00079     UINT64   iStreamFlushes;  /* # of fake packet is flushed */
00080     UINT64   iStreamFaults;  /* # of times we run out of memory */
00081     UINT64   iStreamTimeouts; /* # of timeouts we get in this quanta */
00082     
00083     UINT64   iFragCreates;    /* # of times we call Frag3NewTracker() */
00084     UINT64   iFragCompletes;  /* # of times we call FragIsComplete() */
00085     UINT64   iFragInserts;    /* # of fraginserts */
00086     UINT64   iFragDeletes;    /* # of times we call Frag3RemoveTracker() */
00087     UINT64   iFragAutoFrees;  /* # of times we auto free a FragTracker */
00088     UINT64   iFragFlushes;    /* # of times we call Frag3Rebuild() */
00089     UINT64   iMaxFrags;
00090     UINT64   iCurrentFrags;
00091     UINT64   iFragTimeouts;   /* # of times we've reached timeout */
00092     UINT64   iFragFaults;     /* # of times we've run out of memory */    
00093 
00094     int      iFlags;
00095 
00096     int      iReset;
00097 
00098 #ifdef LINUX_SMP
00099     SFPROCPIDSTATS sfProcPidStats;
00100 #endif
00101 
00102 }  SFBASE;
00103 
00104 typedef struct _SYSTIMES {
00105 
00106     double usertime;
00107     double systemtime;
00108     double totaltime;
00109     double realtime;
00110 
00111 }  SYSTIMES;
00112 
00113 typedef struct _SFBASE_STATS {
00114 
00115     UINT64   total_packets;
00116     UINT64   total_sessions;
00117     UINT64   max_sessions;
00118     SYSTIMES kpackets_per_sec;
00119     SYSTIMES kpackets_wire_per_sec;
00120     SYSTIMES kpackets_ipfrag_per_sec;
00121     SYSTIMES kpackets_ipreass_per_sec;
00122     SYSTIMES kpackets_rebuilt_per_sec;
00123     SYSTIMES usecs_per_packet;
00124     SYSTIMES wire_mbits_per_sec;
00125     SYSTIMES ipfrag_mbits_per_sec;
00126     SYSTIMES ipreass_mbits_per_sec;
00127     SYSTIMES rebuilt_mbits_per_sec;
00128     SYSTIMES mbits_per_sec;
00129     int      avg_bytes_per_wire_packet;
00130     int      avg_bytes_per_ipfrag_packet;
00131     int      avg_bytes_per_ipreass_packet;
00132     int      avg_bytes_per_packet;
00133     int      avg_bytes_per_rebuilt_packet;
00134     double   idle_cpu_time;
00135     double   user_cpu_time;
00136     double   system_cpu_time;
00137     PKTSTATS pkt_stats;
00138     double   pkt_drop_percent; 
00139     double   alerts_per_second;
00140     double   syns_per_second;
00141     double   synacks_per_second;
00142     double   deleted_sessions_per_second;
00143     double   new_sessions_per_second;
00144 
00145     double stream_flushes_per_second;
00146     UINT64 stream_faults;
00147     UINT64 stream_timeouts;
00148 
00149     double frag_creates_per_second;
00150     double frag_completes_per_second;
00151     double frag_inserts_per_second;
00152     double frag_deletes_per_second;
00153     double frag_autofrees_per_second;
00154     double frag_flushes_per_second;
00155     UINT64 frag_timeouts;
00156     UINT64 frag_faults;
00157     UINT64 current_frags;
00158     UINT64 max_frags;
00159     
00160     double   patmatch_percent;
00161     time_t   time;
00162 
00163 #ifdef LINUX_SMP
00164     SFPROCPIDSTATS *sfProcPidStats;
00165 #endif
00166 
00167 }  SFBASE_STATS;
00168 
00169 int InitBaseStats(SFBASE *sfBase);
00170 int UpdateBaseStats(SFBASE *sfBase, int len, int iRebuiltPkt);
00171 int ProcessBaseStats(SFBASE *sfBase,int console, int file, FILE * fh);
00172 int AddStreamSession(SFBASE *sfBase);
00173 int RemoveStreamSession(SFBASE *sfBase);
00174 
00175 void UpdateWireStats(SFBASE *sfBase, int len);  
00176 void UpdateIPFragStats(SFBASE *sfBase, int len);
00177 void UpdateIPReassStats(SFBASE *sfBase, int len);
00178 
00179 #endif
00180 
00181 

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