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
31typedef 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
39typedef 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
48TmEcode OutputStatsLog(ThreadVars *tv, void *thread_data, StatsTable *st);
49
50typedef int (*StatsLogger)(ThreadVars *, void *thread_data, const StatsTable *);
51
52int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc, OutputCtx *,
53 ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit);
54
56
58
59void OutputStatsShutdown(void);
60
61#endif /* SURICATA_OUTPUT_STATS_H */
ThreadVars * tv
struct StatsTable_ StatsTable
int(* StatsLogger)(ThreadVars *, void *thread_data, const StatsTable *)
int OutputStatsLoggersRegistered(void)
void OutputStatsShutdown(void)
struct StatsRecord_ StatsRecord
int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc, OutputCtx *, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
void TmModuleStatsLoggerRegister(void)
TmEcode OutputStatsLog(ThreadVars *tv, void *thread_data, StatsTable *st)
const char * name
const char * tm_name
int64_t pvalue
const char * short_name
int64_t value
time_t start_time
StatsRecord * stats
StatsRecord * tstats
struct timeval ts
uint32_t nstats
uint32_t ntstats
Per thread variable structure.
Definition threadvars.h:58
TmEcode(* ThreadDeinitFunc)(ThreadVars *, void *)
Definition tm-modules.h:44
TmEcode(* ThreadInitFunc)(ThreadVars *, const void *, void **)
Definition tm-modules.h:43
const char * name