Better "!stats"; can display peak and current bandwidth usage.
Network stats are now updated every minute, so that we have them handy for printing in logs, or by issuing the !stats command. Note: this checkin disables the once-per-hour stats logging. I do not know wether or not that is useful functionality.
This commit is contained in:
@@ -591,19 +591,6 @@ void net_stats_get(struct net_statistics** intermediate, struct net_statistics**
|
||||
}
|
||||
|
||||
|
||||
void net_stats_report()
|
||||
{
|
||||
int factor = (time(NULL) - stats.timestamp);
|
||||
if (!factor) factor++;
|
||||
|
||||
hub_log(log_info, "Statistics NET: tx=%d KB/s, rx=%d KB/s, (acc=%d/cls=%d/err=%d)",
|
||||
(int) ((stats.tx / factor) / 1024),
|
||||
(int) ((stats.rx / factor) / 1024),
|
||||
(int) stats.accept,
|
||||
(int) stats.closed,
|
||||
(int) stats.errors);
|
||||
}
|
||||
|
||||
void net_stats_reset()
|
||||
{
|
||||
stats_total.tx += stats.tx;
|
||||
@@ -619,8 +606,7 @@ void net_stats_reset()
|
||||
|
||||
int net_stats_timeout()
|
||||
{
|
||||
/* FIXME: Configurable time for dumping network statistics */
|
||||
return (time(NULL) - stats.timestamp > 60) ? 1 : 0;
|
||||
return (difftime(time(NULL), stats.timestamp) > TIMEOUT_STATS) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user