From 98f2ecb01456dcb9b47bd0c89e88cd49d6d5205d Mon Sep 17 00:00:00 2001 From: danieldg Date: Mon, 18 Jan 2010 20:06:21 +0000 Subject: Include total CPU usage in STATS z git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12295 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/stats.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.3