Check if core_id and die_id exist.

This commit is contained in:
Bartosz Taudul 2024-09-07 23:53:57 +02:00
parent ea4de3be36
commit 11777e8136
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -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++ )