Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #3917 from koying/fixdroidcpuload

FIX: [droid] cpu load info with vanilla ndk
  • Loading branch information...
commit f808ac14c5238fe6576fbbf735118d4999d2af5c 2 parents a630106 + d42e229
@koying koying authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 xbmc/utils/CPUInfo.cpp
View
8 xbmc/utils/CPUInfo.cpp
@@ -685,8 +685,16 @@ bool CCPUInfo::readProcStat(unsigned long long& user, unsigned long long& nice,
if (m_fProcStat == NULL)
return false;
+#ifdef TARGET_ANDROID
+ // Just another (vanilla) NDK quirk:
+ // rewind + fflush do not actually flush the buffers,
+ // the same initial content is returned rather than re-read
+ fclose(m_fProcStat);
+ m_fProcStat = fopen("/proc/stat", "r");
+#else
rewind(m_fProcStat);
fflush(m_fProcStat);
+#endif
char buf[256];
if (!fgets(buf, sizeof(buf), m_fProcStat))
Please sign in to comment.
Something went wrong with that request. Please try again.