Skip to content

Commit

Permalink
Check if core_id and die_id exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfpld committed Sep 7, 2024
1 parent ea4de3b commit 11777e8
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions public/client/TracyProfiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3901,17 +3901,23 @@ void Profiler::ReportTopology()

sprintf( path, "%s%i/topology/core_id", basePath, i );
f = fopen( path, "rb" );
read = fread( buf, 1, 1024, f );
buf[read] = '\0';
fclose( f );
cpuData[i].core = uint32_t( atoi( buf ) );
if( f )
{
read = fread( buf, 1, 1024, f );
buf[read] = '\0';
fclose( f );
cpuData[i].core = uint32_t( atoi( buf ) );
}

sprintf( path, "%s%i/topology/die_id", basePath, i );
f = fopen( path, "rb" );
read = fread( buf, 1, 1024, f );
buf[read] = '\0';
fclose( f );
cpuData[i].die = uint32_t( atoi( buf ) );
if( f )
{
read = fread( buf, 1, 1024, f );
buf[read] = '\0';
fclose( f );
cpuData[i].die = uint32_t( atoi( buf ) );
}
}

for( int i=0; i<numcpus; i++ )
Expand Down

0 comments on commit 11777e8

Please sign in to comment.