mirror of
https://github.com/wolfpld/tracy
synced 2025-04-28 20:23:51 +00:00
only write SysTime::used if fscanf succeeds
This commit is contained in:
parent
93b7b5a8e7
commit
28a29d071f
@ -47,9 +47,12 @@ void SysTime::ReadTimes()
|
||||
FILE* f = fopen( "/proc/stat", "r" );
|
||||
if( f )
|
||||
{
|
||||
fscanf( f, "cpu %" PRIu64 " %" PRIu64 " %" PRIu64" %" PRIu64, &user, &nice, &system, &idle );
|
||||
int read = fscanf( f, "cpu %" PRIu64 " %" PRIu64 " %" PRIu64" %" PRIu64, &user, &nice, &system, &idle );
|
||||
fclose( f );
|
||||
used = user + nice + system;
|
||||
if (read == 4)
|
||||
{
|
||||
used = user + nice + system;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user