@@ -16,6 +16,8 @@ internal sealed class IntelCpu : GenericCpu
1616 private readonly Sensor _coreVoltage ;
1717 private readonly Sensor [ ] _distToTjMaxTemperatures ;
1818
19+ private readonly string [ ] _coreNames ;
20+
1921 private readonly uint [ ] _energyStatusMsrs = { MSR_PKG_ENERGY_STATUS , MSR_PP0_ENERGY_STATUS , MSR_PP1_ENERGY_STATUS , MSR_DRAM_ENERGY_STATUS , MSR_PLATFORM_ENERGY_STATUS } ;
2022 private readonly uint [ ] _lastEnergyConsumed ;
2123 private readonly DateTime [ ] _lastEnergyTime ;
@@ -318,6 +320,30 @@ public IntelCpu(int processorIndex, CpuId[][] cpuId, ISettings settings) : base(
318320 break ;
319321 }
320322
323+ // Initialize core names
324+ _coreNames = new string [ _coreCount ] ;
325+ int pCoreIndex = 1 ;
326+ int eCoreIndex = 1 ;
327+
328+ for ( int i = 0 ; i < _coreCount ; i ++ )
329+ {
330+ if ( _cpuId . Length > i && _cpuId [ i ] . Length > 0 )
331+ {
332+ CoreType coreType = _cpuId [ i ] [ 0 ] . CoreType ;
333+
334+ _coreNames [ i ] = coreType switch
335+ {
336+ CoreType . Performance => $ "P-Core #{ pCoreIndex ++ } ",
337+ CoreType . Efficient => $ "E-Core #{ eCoreIndex ++ } ",
338+ _ => CoreString ( i )
339+ } ;
340+ }
341+ else
342+ {
343+ _coreNames [ i ] = CoreString ( i ) ;
344+ }
345+ }
346+
321347 int coreSensorId = 0 ;
322348
323349 //core temp avg and max value
@@ -344,23 +370,24 @@ public IntelCpu(int processorIndex, CpuId[][] cpuId, ISettings settings) : base(
344370 _coreTemperatures = new Sensor [ _coreCount ] ;
345371 for ( int i = 0 ; i < _coreTemperatures . Length ; i ++ )
346372 {
347- _coreTemperatures [ i ] = new Sensor ( CoreString ( i ) ,
348- coreSensorId ,
349- SensorType . Temperature ,
350- this ,
351- new [ ]
352- {
353- new ParameterDescription ( "TjMax [°C]" , "TjMax temperature of the core sensor.\n " + "Temperature = TjMax - TSlope * Value." , tjMax [ i ] ) ,
354- new ParameterDescription ( "TSlope [°C]" , "Temperature slope of the digital thermal sensor.\n " + "Temperature = TjMax - TSlope * Value." , 1 )
355- } ,
356- settings ) ;
373+ _coreTemperatures [ i ] = new Sensor ( _coreNames [ i ] ,
374+ coreSensorId ,
375+ SensorType . Temperature ,
376+ this ,
377+ [
378+ new ParameterDescription ( "TjMax [°C]" , "TjMax temperature of the core sensor.\n " + "Temperature = TjMax - TSlope * Value." , tjMax [ i ] ) ,
379+ new ParameterDescription ( "TSlope [°C]" , "Temperature slope of the digital thermal sensor.\n " + "Temperature = TjMax - TSlope * Value." , 1 )
380+ ] ,
381+ settings ) ;
357382
358383 ActivateSensor ( _coreTemperatures [ i ] ) ;
359384 coreSensorId ++ ;
360385 }
361386 }
362387 else
363- _coreTemperatures = Array . Empty < Sensor > ( ) ;
388+ {
389+ _coreTemperatures = [ ] ;
390+ }
364391
365392 // check if processor supports a digital thermal sensor at package level
366393 if ( cpuId [ 0 ] [ 0 ] . Data . GetLength ( 0 ) > 6 && ( cpuId [ 0 ] [ 0 ] . Data [ 6 , 0 ] & 0x40 ) != 0 && _microArchitecture != MicroArchitecture . Unknown )
@@ -369,11 +396,10 @@ public IntelCpu(int processorIndex, CpuId[][] cpuId, ISettings settings) : base(
369396 coreSensorId ,
370397 SensorType . Temperature ,
371398 this ,
372- new [ ]
373- {
399+ [
374400 new ParameterDescription ( "TjMax [°C]" , "TjMax temperature of the package sensor.\n " + "Temperature = TjMax - TSlope * Value." , tjMax [ 0 ] ) ,
375401 new ParameterDescription ( "TSlope [°C]" , "Temperature slope of the digital thermal sensor.\n " + "Temperature = TjMax - TSlope * Value." , 1 )
376- } ,
402+ ] ,
377403 settings ) ;
378404
379405 ActivateSensor ( _packageTemperature ) ;
@@ -386,19 +412,21 @@ public IntelCpu(int processorIndex, CpuId[][] cpuId, ISettings settings) : base(
386412 _distToTjMaxTemperatures = new Sensor [ _coreCount ] ;
387413 for ( int i = 0 ; i < _distToTjMaxTemperatures . Length ; i ++ )
388414 {
389- _distToTjMaxTemperatures [ i ] = new Sensor ( CoreString ( i ) + " Distance to TjMax" , coreSensorId , SensorType . Temperature , this , settings ) ;
415+ _distToTjMaxTemperatures [ i ] = new Sensor ( _coreNames [ i ] + " Distance to TjMax" , coreSensorId , SensorType . Temperature , this , settings ) ;
390416 ActivateSensor ( _distToTjMaxTemperatures [ i ] ) ;
391417 coreSensorId ++ ;
392418 }
393419 }
394420 else
395- _distToTjMaxTemperatures = Array . Empty < Sensor > ( ) ;
421+ {
422+ _distToTjMaxTemperatures = [ ] ;
423+ }
396424
397425 _busClock = new Sensor ( "Bus Speed" , 0 , SensorType . Clock , this , settings ) ;
398426 _coreClocks = new Sensor [ _coreCount ] ;
399427 for ( int i = 0 ; i < _coreClocks . Length ; i ++ )
400428 {
401- _coreClocks [ i ] = new Sensor ( CoreString ( i ) , i + 1 , SensorType . Clock , this , settings ) ;
429+ _coreClocks [ i ] = new Sensor ( _coreNames [ i ] , i + 1 , SensorType . Clock , this , settings ) ;
402430 if ( HasTimeStampCounter && _microArchitecture != MicroArchitecture . Unknown )
403431 ActivateSensor ( _coreClocks [ i ] ) ;
404432 }
@@ -444,7 +472,7 @@ MicroArchitecture.ElkhartLake or
444472
445473 if ( EnergyUnitsMultiplier != 0 )
446474 {
447- string [ ] powerSensorLabels = { "CPU Package" , "CPU Cores" , "CPU Graphics" , "CPU Memory" , "CPU Platform" } ;
475+ string [ ] powerSensorLabels = [ "CPU Package" , "CPU Cores" , "CPU Graphics" , "CPU Memory" , "CPU Platform" ] ;
448476
449477 for ( int i = 0 ; i < _energyStatusMsrs . Length ; i ++ )
450478 {
@@ -477,7 +505,7 @@ MicroArchitecture.ElkhartLake or
477505 _coreVIDs = new Sensor [ _coreCount ] ;
478506 for ( int i = 0 ; i < _coreVIDs . Length ; i ++ )
479507 {
480- _coreVIDs [ i ] = new Sensor ( CoreString ( i ) , i + 1 , SensorType . Voltage , this , settings ) ;
508+ _coreVIDs [ i ] = new Sensor ( _coreNames [ i ] , i + 1 , SensorType . Voltage , this , settings ) ;
481509 ActivateSensor ( _coreVIDs [ i ] ) ;
482510 }
483511
0 commit comments