The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
stats.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16  */
17 
18 /**
19  * $Id: e3ee82510fa0ef1914114483d3c41e38164f127e $
20  *
21  * @file lib/server/stats.h
22  * @brief Structures and functions for statistics.
23  *
24  * @copyright 2005, 2006, 2007, 2008 The FreeRADIUS server project
25  */
26 RCSIDH(stats_h, "$Id: e3ee82510fa0ef1914114483d3c41e38164f127e $")
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #ifdef WITH_STATS_64BIT
33 typedef uint64_t fr_uint_t;
34 #else
36 #endif
37 
38 #ifdef WITH_STATS
39 typedef struct {
53  time_t last_packet;
54  fr_uint_t elapsed[8];
55 } fr_stats_t;
56 
57 typedef struct {
59 
60  uint32_t f1, f10;
61  uint32_t ema1, ema10;
63 
66 
67 void radius_stats_init(int flag);
68 void request_stats_final(request_t *request);
70  fr_time_t start, fr_time_t end);
72 int fr_snmp_process(request_t *request);
73 int fr_snmp_init(void);
74 void fr_snmp_free(void);
75 
76 
77 #define FR_STATS_INC(_x, _y) radius_ ## _x ## _stats._y++;if (listener) listener->stats._y++;if (client) client->_x._y++;
78 #define FR_STATS_TYPE_INC(_x) _x++
79 
80 #else /* WITH_STATS */
81 #define request_stats_init(_x)
82 #define request_stats_final(_x)
83 #define fr_stats_bins(_x, _y, _z)
84 
85 #define FR_STATS_INC(_x, _y)
86 #define FR_STATS_TYPE_INC(_x)
87 
88 #endif
89 
90 #ifdef __cplusplus
91 }
92 #endif
#define RCSIDH(h, id)
Definition: build.h:445
unsigned int uint32_t
Definition: merged_model.c:33
static rc_stats_t stats
Definition: radclient-ng.c:72
void fr_snmp_free(void)
Definition: snmp.c:1119
uint32_t f1
Definition: stats.h:60
time_t last_packet
Definition: stats.h:53
fr_uint_t total_access_challenges
Definition: stats.h:46
fr_uint_t total_responses
Definition: stats.h:43
fr_uint_t total_timeouts
Definition: stats.h:52
fr_uint_t total_dup_requests
Definition: stats.h:42
fr_uint_t total_bad_authenticators
Definition: stats.h:48
fr_uint_t total_unknown_types
Definition: stats.h:51
void radius_stats_ema(fr_stats_ema_t *ema, fr_time_t start, fr_time_t end)
Definition: stats.c:159
void fr_stats_bins(fr_stats_t *stats, fr_time_t start, fr_time_t end)
Sort latency times into bins.
Definition: stats.c:214
fr_uint_t total_access_accepts
Definition: stats.h:44
fr_uint_t total_packets_dropped
Definition: stats.h:49
int fr_snmp_process(request_t *request)
Definition: snmp.c:921
void request_stats_final(request_t *request)
Definition: stats.c:48
fr_uint_t total_malformed_requests
Definition: stats.h:47
uint32_t ema1
Definition: stats.h:61
int fr_snmp_init(void)
Initialise the tree of SNMP map structures used to attach callbacks to OIDs.
Definition: snmp.c:1101
fr_uint_t total_requests
Definition: stats.h:40
fr_stats_t radius_auth_stats
Definition: stats.c:45
void radius_stats_init(int flag)
Definition: stats.c:149
fr_uint_t total_access_rejects
Definition: stats.h:45
uint32_t window
Definition: stats.h:58
fr_stats_t radius_acct_stats
Definition: stats.c:46
fr_uint_t total_no_records
Definition: stats.h:50
fr_uint_t total_invalid_requests
Definition: stats.h:41
uint32_t fr_uint_t
Definition: stats.h:35
"server local" time.
Definition: time.h:69