summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-01-18 20:06:21 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-01-18 20:06:21 +0000
commit98f2ecb01456dcb9b47bd0c89e88cd49d6d5205d (patch)
tree8c2d666c579df29245cd7c311bef92cf513f3a10 /src
parentc5cda58914fe18f0730a66424751d2657c7194ee (diff)
Include total CPU usage in STATS z
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12295 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/stats.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/stats.cpp b/src/stats.cpp
index b272e0b6b..83beae03a 100644
--- a/src/stats.cpp
+++ b/src/stats.cpp
@@ -202,7 +202,13 @@ void InspIRCd::DoStats(char statschar, User* user, string_list &results)
float per = (n_eaten / n_elapsed) * 100;
snprintf(percent, 30, "%03.5f%%", per);
- results.push_back(sn+" 249 "+user->nick+" :CPU Usage: "+percent);
+ results.push_back(sn+" 249 "+user->nick+" :CPU Use (now): "+percent);
+
+ n_elapsed = ServerInstance->Time() - ServerInstance->startup_time;
+ n_eaten = (float)R.ru_utime.tv_sec + R.ru_utime.tv_usec / 100000.0;
+ per = (n_eaten / n_elapsed) * 100;
+ snprintf(percent, 30, "%03.5f%%", per);
+ results.push_back(sn+" 249 "+user->nick+" :CPU Use (total): "+percent);
}
#else
PROCESS_MEMORY_COUNTERS MemCounters;