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 #include "tm-modules.h"
30 
31 typedef struct StatsRecord_ {
32  const char *name;
33  const char *tm_name;
34  int64_t value; /**< total value */
35  int64_t pvalue; /**< prev value (may be higher for memuse counters) */
37 
38 typedef struct StatsTable_ {
39  StatsRecord *stats; /**< array of global stats, indexed by counters gid */
40  StatsRecord *tstats; /**< array of arrays with per thread stats */
41  uint32_t nstats; /**< size in records of 'stats' */
42  uint32_t ntstats; /**< number of threads for which tstats stores stats */
43  time_t start_time;
44  struct timeval ts;
46 
47 TmEcode OutputStatsLog(ThreadVars *tv, void *thread_data, StatsTable *st);
48 
49 typedef int (*StatsLogger)(ThreadVars *, void *thread_data, const StatsTable *);
50 
51 int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc,
52  OutputCtx *, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
53  ThreadExitPrintStatsFunc ThreadExitPrintStats);
54 
55 void TmModuleStatsLoggerRegister (void);
56 
58 
59 void OutputStatsShutdown(void);
60 
61 #endif /* __OUTPUT_STATS_H__ */
StatsTable_::ntstats
uint32_t ntstats
Definition: output-stats.h:42
OutputStatsLog
TmEcode OutputStatsLog(ThreadVars *tv, void *thread_data, StatsTable *st)
Definition: output-stats.c:82
StatsRecord
struct StatsRecord_ StatsRecord
TmModuleStatsLoggerRegister
void TmModuleStatsLoggerRegister(void)
Definition: output-stats.c:192
StatsRecord_
Definition: output-stats.h:31
OutputStatsLoggersRegistered
int OutputStatsLoggersRegistered(void)
Definition: output-stats.c:201
tm-modules.h
StatsRecord_::pvalue
int64_t pvalue
Definition: output-stats.h:35
OutputCtx_
Definition: tm-modules.h:78
StatsTable_::ts
struct timeval ts
Definition: output-stats.h:44
StatsRecord_::name
const char * name
Definition: output-stats.h:32
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
OutputStatsShutdown
void OutputStatsShutdown(void)
Definition: output-stats.c:208
ThreadInitFunc
TmEcode(* ThreadInitFunc)(ThreadVars *, const void *, void **)
Definition: tm-modules.h:39
StatsTable_
Definition: output-stats.h:38
StatsRecord_::value
int64_t value
Definition: output-stats.h:34
OutputRegisterStatsLogger
int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc, OutputCtx *, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-stats.c:52
TmEcode
TmEcode
Definition: tm-threads-common.h:83
StatsTable_::start_time
time_t start_time
Definition: output-stats.h:43
StatsTable_::stats
StatsRecord * stats
Definition: output-stats.h:39
ThreadExitPrintStatsFunc
void(* ThreadExitPrintStatsFunc)(ThreadVars *, void *)
Definition: tm-modules.h:41
StatsRecord_::tm_name
const char * tm_name
Definition: output-stats.h:33
StatsTable_::tstats
StatsRecord * tstats
Definition: output-stats.h:40
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:32
StatsLogger
int(* StatsLogger)(ThreadVars *, void *thread_data, const StatsTable *)
Definition: output-stats.h:49
StatsTable_::nstats
uint32_t nstats
Definition: output-stats.h:41
ThreadDeinitFunc
TmEcode(* ThreadDeinitFunc)(ThreadVars *, void *)
Definition: tm-modules.h:40
StatsTable
struct StatsTable_ StatsTable