From 7e46119759b7099c38f543bd38d0186b9806542f Mon Sep 17 00:00:00 2001 From: danieldg Date: Mon, 18 Jan 2010 19:36:41 +0000 Subject: Remove excessive gettimeofday system calls git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12293 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/stats.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/stats.cpp') diff --git a/src/stats.cpp b/src/stats.cpp index b295db4a5..b272e0b6b 100644 --- a/src/stats.cpp +++ b/src/stats.cpp @@ -194,11 +194,10 @@ void InspIRCd::DoStats(char statschar, User* user, string_list &results) results.push_back(sn+" 249 "+user->nick+" :Swaps: "+ConvToStr(R.ru_nswap)); results.push_back(sn+" 249 "+user->nick+" :Context Switches: Voluntary; "+ConvToStr(R.ru_nvcsw)+" Involuntary; "+ConvToStr(R.ru_nivcsw)); - timeval tv; char percent[30]; - gettimeofday(&tv, NULL); - float n_elapsed = ((tv.tv_sec - this->stats->LastSampled.tv_sec) * 1000000 + tv.tv_usec - this->stats->LastSampled.tv_usec); + float n_elapsed = (ServerInstance->Time() - this->stats->LastSampled.tv_sec) * 1000000 + + (ServerInstance->Time_ns() - this->stats->LastSampled.tv_nsec) / 1000; float n_eaten = ((R.ru_utime.tv_sec - this->stats->LastCPU.tv_sec) * 1000000 + R.ru_utime.tv_usec - this->stats->LastCPU.tv_usec); float per = (n_eaten / n_elapsed) * 100; -- cgit v1.3.1-10-gc9f91