diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2011-01-27 08:27:39 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2011-01-27 08:27:39 +0300 |
commit | 673bea74d2beb8d4260355f928499230c7ff9b17 (patch) | |
tree | 4b5474b9623f0b6f5a8dbdde48f1dc906fdd322e /accel-pppd/radius/auth.c | |
parent | 7f8d3e240fe9544b22846ea05b09515922d1de57 (diff) | |
download | accel-ppp-xebd-673bea74d2beb8d4260355f928499230c7ff9b17.tar.gz accel-ppp-xebd-673bea74d2beb8d4260355f928499230c7ff9b17.zip |
radius: extended statistics calculation
Diffstat (limited to 'accel-pppd/radius/auth.c')
-rw-r--r-- | accel-pppd/radius/auth.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/accel-pppd/radius/auth.c b/accel-pppd/radius/auth.c index 692830e..70ecbbe 100644 --- a/accel-pppd/radius/auth.c +++ b/accel-pppd/radius/auth.c @@ -145,9 +145,12 @@ static uint8_t* encrypt_password(const char *passwd, const char *secret, const u static int rad_auth_send(struct rad_req_t *req) { int i; + struct timeval tv; + unsigned int dt; for(i = 0; i < conf_max_try; i++) { __sync_add_and_fetch(&stat_auth_sent, 1); + gettimeofday(&tv, NULL); if (rad_req_send(req, conf_verbose)) goto out; @@ -156,12 +159,20 @@ static int rad_auth_send(struct rad_req_t *req) if (req->reply) { if (req->reply->id != req->pack->id) { __sync_add_and_fetch(&stat_auth_lost, 1); + stat_accm_add(stat_auth_lost_1m, 1); + stat_accm_add(stat_auth_lost_5m, 1); rad_packet_free(req->reply); req->reply = NULL; - } else + } else { + dt = (req->reply->tv.tv_sec - tv.tv_sec) * 1000 + (req->reply->tv.tv_usec - tv.tv_usec) / 1000; + stat_accm_add(stat_auth_query_1m, dt); + stat_accm_add(stat_auth_query_5m, dt); break; + } } else __sync_add_and_fetch(&stat_auth_lost, 1); + stat_accm_add(stat_auth_lost_1m, 1); + stat_accm_add(stat_auth_lost_5m, 1); } if (!req->reply) |