All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
stats.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
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  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15  */
16 #ifndef _FR_STATS_H
17 #define _FR_STATS_H
18 /**
19  * $Id: dfec96cdf4412e2f9e31d33ffa07ee3b978400d6 $
20  *
21  * @file include/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: dfec96cdf4412e2f9e31d33ffa07ee3b978400d6 $")
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #ifdef WITH_STATS_64BIT
33 typedef uint64_t fr_uint_t;
34 #else
35 typedef uint32_t fr_uint_t;
36 #endif
37 
38 #ifdef WITH_STATS
39 typedef struct fr_stats_t {
40  fr_uint_t total_requests;
42  fr_uint_t total_dup_requests;
43  fr_uint_t total_responses;
50  fr_uint_t total_no_records;
52  fr_uint_t total_timeouts;
53  time_t last_packet;
54  fr_uint_t elapsed[8];
55 } fr_stats_t;
56 
57 typedef struct fr_stats_ema_t {
58  uint32_t window;
59 
60  uint32_t f1, f10;
61  uint32_t ema1, ema10;
63 
65 #ifdef WITH_ACCOUNTING
67 #endif
68 #ifdef WITH_COA
71 #endif
72 #ifdef WITH_PROXY
74 #ifdef WITH_ACCOUNTING
76 #endif
77 #ifdef WITH_COA
80 #endif
81 #endif
82 
83 void radius_stats_init(int flag);
84 void request_stats_final(REQUEST *request);
85 void request_stats_reply(REQUEST *request);
87  struct timeval *start, struct timeval *end);
88 
89 #define FR_STATS_INC(_x, _y) radius_ ## _x ## _stats._y++;if (listener) listener->stats._y++;if (client) client->_x._y++;
90 #define FR_STATS_TYPE_INC(_x) _x++
91 
92 #else /* WITH_STATS */
93 #define request_stats_init(_x)
94 #define request_stats_final(_x)
95 
96 #define FR_STATS_INC(_x, _y)
97 #define FR_STATS_TYPE_INC(_x)
98 
99 #endif
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 #endif /* _FR_STATS_H */
#define RCSIDH(h, id)
Definition: build.h:136
time_t last_packet
Definition: stats.h:53
void radius_stats_ema(fr_stats_ema_t *ema, struct timeval *start, struct timeval *end)
Definition: stats.c:841
fr_uint_t total_packets_dropped
Definition: stats.h:49
fr_stats_t proxy_acct_stats
Definition: stats.c:53
fr_stats_t radius_coa_stats
Definition: stats.c:46
uint32_t ema1
Definition: stats.h:61
void request_stats_reply(REQUEST *request)
Definition: stats.c:481
fr_stats_t radius_dsc_stats
Definition: stats.c:47
struct fr_stats_ema_t fr_stats_ema_t
fr_uint_t elapsed[8]
Definition: stats.h:54
void radius_stats_init(int flag)
Definition: stats.c:831
fr_stats_t proxy_dsc_stats
Definition: stats.c:57
uint32_t window
Definition: stats.h:58
uint32_t fr_uint_t
Definition: stats.h:35
fr_stats_t proxy_auth_stats
Definition: stats.c:51
uint32_t f10
Definition: stats.h:60
void request_stats_final(REQUEST *request)
Definition: stats.c:110
fr_uint_t total_responses
Definition: stats.h:43
struct fr_stats_t fr_stats_t
fr_uint_t total_dup_requests
Definition: stats.h:42
fr_stats_t radius_acct_stats
Definition: stats.c:43
fr_uint_t total_access_accepts
Definition: stats.h:44
fr_uint_t total_access_challenges
Definition: stats.h:46
fr_uint_t total_timeouts
Definition: stats.h:52
uint32_t f1
Definition: stats.h:60
fr_uint_t total_no_records
Definition: stats.h:50
fr_uint_t total_invalid_requests
Definition: stats.h:41
fr_uint_t total_malformed_requests
Definition: stats.h:47
fr_stats_t proxy_coa_stats
Definition: stats.c:56
fr_uint_t total_access_rejects
Definition: stats.h:45
uint32_t ema10
Definition: stats.h:61
fr_stats_t radius_auth_stats
Definition: stats.c:41
fr_uint_t total_unknown_types
Definition: stats.h:51
fr_uint_t total_bad_authenticators
Definition: stats.h:48
fr_uint_t total_requests
Definition: stats.h:40