suricata
output-stats.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2013 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Victor Julien <victor@inliniac.net>
22  *
23  * Stats Logger Output registration functions
24  */
25 
26 #ifndef __OUTPUT_STATS_H__
27 #define __OUTPUT_STATS_H__
28 
29 typedef struct StatsRecord_ {
30  const char *name;
31  const char *tm_name;
32  uint64_t value; /**< total value */
33  uint64_t pvalue; /**< prev value (may be higher for memuse counters) */
35 
36 typedef struct StatsTable_ {
37  StatsRecord *stats; /**< array of global stats, indexed by counters gid */
38  StatsRecord *tstats; /**< array of arrays with per thread stats */
39  uint32_t nstats; /**< size in records of 'stats' */
40  uint32_t ntstats; /**< number of threads for which tstats stores stats */
41  time_t start_time;
42  struct timeval ts;
44 
45 TmEcode OutputStatsLog(ThreadVars *tv, void *thread_data, StatsTable *st);
46 
47 typedef int (*StatsLogger)(ThreadVars *, void *thread_data, const StatsTable *);
48 
49 int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc,
50  OutputCtx *, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
51  ThreadExitPrintStatsFunc ThreadExitPrintStats);
52 
53 void TmModuleStatsLoggerRegister (void);
54 
56 
57 void OutputStatsShutdown(void);
58 
59 #endif /* __OUTPUT_STATS_H__ */
StatsTable_::ntstats
uint32_t ntstats
Definition: output-stats.h:40
OutputStatsLog
TmEcode OutputStatsLog(ThreadVars *tv, void *thread_data, StatsTable *st)
Definition: output-stats.c:87
StatsRecord
struct StatsRecord_ StatsRecord
TmModuleStatsLoggerRegister
void TmModuleStatsLoggerRegister(void)
Definition: output-stats.c:197
StatsRecord_
Definition: output-stats.h:29
OutputStatsLoggersRegistered
int OutputStatsLoggersRegistered(void)
Definition: output-stats.c:206
StatsRecord_::value
uint64_t value
Definition: output-stats.h:32
OutputCtx_
Definition: tm-modules.h:78
StatsTable_::ts
struct timeval ts
Definition: output-stats.h:42
StatsRecord_::name
const char * name
Definition: output-stats.h:30
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
OutputStatsShutdown
void OutputStatsShutdown(void)
Definition: output-stats.c:213
ThreadInitFunc
TmEcode(* ThreadInitFunc)(ThreadVars *, const void *, void **)
Definition: tm-modules.h:39
StatsTable_
Definition: output-stats.h:36
OutputRegisterStatsLogger
int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc, OutputCtx *, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-stats.c:57
TmEcode
TmEcode
Definition: tm-threads-common.h:77
StatsTable_::start_time
time_t start_time
Definition: output-stats.h:41
StatsTable_::stats
StatsRecord * stats
Definition: output-stats.h:37
ThreadExitPrintStatsFunc
void(* ThreadExitPrintStatsFunc)(ThreadVars *, void *)
Definition: tm-modules.h:41
StatsRecord_::tm_name
const char * tm_name
Definition: output-stats.h:31
StatsTable_::tstats
StatsRecord * tstats
Definition: output-stats.h:38
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:29
StatsLogger
int(* StatsLogger)(ThreadVars *, void *thread_data, const StatsTable *)
Definition: output-stats.h:47
StatsRecord_::pvalue
uint64_t pvalue
Definition: output-stats.h:33
StatsTable_::nstats
uint32_t nstats
Definition: output-stats.h:39
ThreadDeinitFunc
TmEcode(* ThreadDeinitFunc)(ThreadVars *, void *)
Definition: tm-modules.h:40
StatsTable
struct StatsTable_ StatsTable