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