Permalink
Browse files

[droid] fixed cpu usage got NaN when no cpu stats changed

  • Loading branch information...
1 parent 541abf3 commit 7a7047de46a763db0cbc11d8332b557baf87730c @huceke huceke committed Aug 4, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 xbmc/utils/CPUInfo.cpp
View
@@ -498,7 +498,10 @@ bool CCPUInfo::readProcStat(unsigned long long& user, unsigned long long& nice,
coreIO -= iter->second.m_io;
double total = (double)(coreUser + coreNice + coreSystem + coreIdle + coreIO);
- iter->second.m_fPct = ((double)(coreUser + coreNice + coreSystem) * 100.0) / total;
+ if(total == 0.0f)
+ iter->second.m_fPct = 0.0f;
+ else
+ iter->second.m_fPct = ((double)(coreUser + coreNice + coreSystem) * 100.0) / total;
iter->second.m_user += coreUser;
iter->second.m_nice += coreNice;

0 comments on commit 7a7047d

Please sign in to comment.