24 RCSID(
"$Id: 372f342441e2f56d007bfb546c8865cce5aeae9c $")
26 #include <freeradius-devel/server/client.h>
27 #include <freeradius-devel/server/request.h>
28 #include <freeradius-devel/server/stats.h>
29 #include <freeradius-devel/util/debug.h>
31 #include <freeradius-devel/util/misc.h>
32 #include <freeradius-devel/util/time.h>
33 #include <freeradius-devel/radius/defs.h>
38 #define EMA_SCALE (100)
39 #define F_EMA_SCALE (1000000)
44 #define FR_STATS_INIT { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
45 { 0, 0, 0, 0, 0, 0, 0, 0 }}
52 if (request->counted)
return;
55 if (!request->listener)
return;
56 if (!request->client)
return;
57 if (!request->packet)
return;
70 #define INC_AUTH(_x) do { radius_auth_stats._x++;request->client->auth._x++; } while (0)
73 #define INC_ACCT(_x) do { radius_acct_stats._x++;request->client->acct._x++; } while (0)
94 request->packet->timestamp,
95 request->reply->timestamp);
97 request->packet->timestamp,
98 request->reply->timestamp);
112 request->packet->timestamp,
113 request->reply->timestamp);
121 switch (request->packet->code) {
123 if (request->reply->id == -1) {
132 if (request->reply->id == -1) {
148 request->counted =
true;
164 #ifdef WITH_STATS_DEBUG
167 if (ema->
window == 0)
return;
184 if (ema->
ema1 == 0) {
190 diff = ema->
f1 * (tdiff - ema->
ema1);
191 ema->
ema1 += (diff / 1000000);
193 diff = ema->
f10 * (tdiff - ema->
ema10);
194 ema->
ema10 += (diff / 1000000);
198 #ifdef WITH_STATS_DEBUG
199 DEBUG(
"time %d %d.%06d\t%d.%06d\t%d.%06d\n",
233 for (i = 0; i < 7; i++) {
@ FR_RADIUS_CODE_ACCESS_CHALLENGE
RFC2865 - Access-Challenge.
@ FR_RADIUS_CODE_ACCESS_REQUEST
RFC2865 - Access-Request.
@ FR_RADIUS_CODE_STATUS_SERVER
RFC2865/RFC5997 - Status Server (request)
@ FR_RADIUS_CODE_ACCESS_ACCEPT
RFC2865 - Access-Accept.
@ FR_RADIUS_CODE_ACCOUNTING_RESPONSE
RFC2866 - Accounting-Response.
@ FR_RADIUS_CODE_ACCOUNTING_REQUEST
RFC2866 - Accounting-Request.
@ FR_RADIUS_CODE_ACCESS_REJECT
RFC2865 - Access-Reject.
static fr_time_t start_time
static fr_time_t hup_time
void radius_stats_ema(fr_stats_ema_t *ema, fr_time_t start, fr_time_t end)
void fr_stats_bins(fr_stats_t *stats, fr_time_t start, fr_time_t end)
Sort latency times into bins.
void request_stats_final(request_t *request)
fr_stats_t radius_auth_stats
void radius_stats_init(int flag)
fr_stats_t radius_acct_stats
#define fr_time()
Allow us to arbitrarily manipulate time.
static fr_time_delta_t fr_time_delta_from_sec(int64_t sec)
#define fr_time_lteq(_a, _b)
static int64_t fr_time_delta_to_usec(fr_time_delta_t delta)
#define fr_time_delta_gteq(_a, _b)
#define fr_time_sub(_a, _b)
Subtract one time from another.
#define fr_time_lt(_a, _b)
A time delta, a difference in time measured in nanoseconds.