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: 6fc92b2c2f4d31250f2efc9914a390aefb3bb91f $
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: 6fc92b2c2f4d31250f2efc9914a390aefb3bb91f $")
27 
28 #include <freeradius-devel/server/request.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #ifdef WITH_STATS_64BIT
35 typedef uint64_t fr_uint_t;
36 #else
38 #endif
39 
40 #ifdef WITH_STATS
41 typedef struct {
55  time_t last_packet;
56  fr_uint_t elapsed[8];
57 } fr_stats_t;
58 
59 typedef struct {
61 
62  uint32_t f1, f10;
63  uint32_t ema1, ema10;
65 
68 
69 void radius_stats_init(int flag);
70 void request_stats_final(request_t *request);
72  fr_time_t start, fr_time_t end);
74 int fr_snmp_process(request_t *request);
75 int fr_snmp_init(void);
76 
77 
78 #define FR_STATS_INC(_x, _y) radius_ ## _x ## _stats._y++;if (listener) listener->stats._y++;if (client) client->_x._y++;
79 #define FR_STATS_TYPE_INC(_x) _x++
80 
81 #else /* WITH_STATS */
82 #define request_stats_init(_x)
83 #define request_stats_final(_x)
84 #define fr_stats_bins(_x, _y, _z)
85 
86 #define FR_STATS_INC(_x, _y)
87 #define FR_STATS_TYPE_INC(_x)
88 
89 #endif
90 
91 #ifdef __cplusplus
92 }
93 #endif
#define RCSIDH(h, id)
Definition: build.h:482
unsigned int uint32_t
Definition: merged_model.c:33
static rc_stats_t stats
Definition: radclient-ng.c:74
uint32_t f1
Definition: stats.h:62
time_t last_packet
Definition: stats.h:55
fr_uint_t total_access_challenges
Definition: stats.h:48
fr_uint_t total_responses
Definition: stats.h:45
fr_uint_t total_timeouts
Definition: stats.h:54
fr_uint_t total_dup_requests
Definition: stats.h:44
fr_uint_t total_bad_authenticators
Definition: stats.h:50
fr_uint_t total_unknown_types
Definition: stats.h:53
void radius_stats_ema(fr_stats_ema_t *ema, fr_time_t start, fr_time_t end)
Definition: stats.c:161
void fr_stats_bins(fr_stats_t *stats, fr_time_t start, fr_time_t end)
Sort latency times into bins.
Definition: stats.c:216
fr_uint_t total_access_accepts
Definition: stats.h:46
fr_uint_t total_packets_dropped
Definition: stats.h:51
int fr_snmp_process(request_t *request)
Definition: snmp.c:925
void request_stats_final(request_t *request)
Definition: stats.c:50
fr_uint_t total_malformed_requests
Definition: stats.h:49
uint32_t ema1
Definition: stats.h:63
int fr_snmp_init(void)
Initialise the tree of SNMP map structures used to attach callbacks to OIDs.
Definition: snmp.c:1129
fr_uint_t total_requests
Definition: stats.h:42
fr_stats_t radius_auth_stats
Definition: stats.c:47
void radius_stats_init(int flag)
Definition: stats.c:151
fr_uint_t total_access_rejects
Definition: stats.h:47
uint32_t window
Definition: stats.h:60
fr_stats_t radius_acct_stats
Definition: stats.c:48
fr_uint_t total_no_records
Definition: stats.h:52
fr_uint_t total_invalid_requests
Definition: stats.h:43
uint32_t fr_uint_t
Definition: stats.h:37
"server local" time.
Definition: time.h:69