mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
/proc/stat might be inaccessible.
This commit is contained in:
parent
cffc6e21d3
commit
2c9d9d0d27
@ -43,10 +43,12 @@ void SysTime::ReadTimes()
|
|||||||
{
|
{
|
||||||
uint64_t user, nice, system;
|
uint64_t user, nice, system;
|
||||||
FILE* f = fopen( "/proc/stat", "r" );
|
FILE* f = fopen( "/proc/stat", "r" );
|
||||||
assert( f );
|
if( f )
|
||||||
fscanf( f, "cpu %" PRIu64 " %" PRIu64 " %" PRIu64" %" PRIu64, &user, &nice, &system, &idle );
|
{
|
||||||
fclose( f );
|
fscanf( f, "cpu %" PRIu64 " %" PRIu64 " %" PRIu64" %" PRIu64, &user, &nice, &system, &idle );
|
||||||
used = user + nice + system;
|
fclose( f );
|
||||||
|
used = user + nice + system;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# elif defined __APPLE__
|
# elif defined __APPLE__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user