3
3
* System Information CPU section
4
4
*
5
5
* Copyright (C) 2011-2016 wj32
6
- * Copyright (C) 2017-2021 dmex
6
+ * Copyright (C) 2017-2022 dmex
7
7
*
8
8
* This file is part of Process Hacker.
9
9
*
@@ -829,7 +829,7 @@ VOID PhSipNotifyCpuGraph(
829
829
{
830
830
FLOAT cpuKernel ;
831
831
FLOAT cpuUser ;
832
- PH_FORMAT format [9 ];
832
+ PH_FORMAT format [15 ];
833
833
834
834
cpuKernel = PhGetItemCircularBuffer_FLOAT (& PhCpusKernelHistory [Index ], getTooltipText -> Index );
835
835
cpuUser = PhGetItemCircularBuffer_FLOAT (& PhCpusUserHistory [Index ], getTooltipText -> Index );
@@ -842,8 +842,14 @@ VOID PhSipNotifyCpuGraph(
842
842
PhInitFormatF (& format [4 ], (DOUBLE )cpuUser * 100 , 2 );
843
843
PhInitFormatS (& format [5 ], L"%)" );
844
844
PhInitFormatSR (& format [6 ], PH_AUTO_T (PH_STRING , PhSipGetMaxCpuString (getTooltipText -> Index ))-> sr );
845
- PhInitFormatC (& format [7 ], L'\n' );
846
- PhInitFormatSR (& format [8 ], PH_AUTO_T (PH_STRING , PhGetStatisticsTimeString (NULL , getTooltipText -> Index ))-> sr );
845
+ PhInitFormatS (& format [7 ], L"\nCPU " );
846
+ PhInitFormatU (& format [8 ], Index );
847
+ PhInitFormatS (& format [9 ], L", Core " );
848
+ PhInitFormatU (& format [10 ], PhSipGetProcessorRelationshipIndex (RelationProcessorCore , Index ));
849
+ PhInitFormatS (& format [11 ], L", Socket " );
850
+ PhInitFormatU (& format [12 ], PhSipGetProcessorRelationshipIndex (RelationProcessorPackage , Index ));
851
+ PhInitFormatS (& format [13 ], L"\n" );
852
+ PhInitFormatSR (& format [14 ], PH_AUTO_T (PH_STRING , PhGetStatisticsTimeString (NULL , getTooltipText -> Index ))-> sr );
847
853
848
854
PhMoveReference (& CpusGraphState [Index ].TooltipText , PhFormat (format , RTL_NUMBER_OF (format ), 160 ));
849
855
}
@@ -1533,3 +1539,40 @@ NTSTATUS PhSipQueryProcessorLogicalInformationEx(
1533
1539
1534
1540
return status ;
1535
1541
}
1542
+
1543
+ ULONG PhSipGetProcessorRelationshipIndex (
1544
+ _In_ LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType ,
1545
+ _In_ ULONG Index
1546
+ )
1547
+ {
1548
+ ULONG index ;
1549
+ ULONG bufferLength ;
1550
+ PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX buffer ;
1551
+ PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX logicalInfo ;
1552
+
1553
+ if (!NT_SUCCESS (PhSipQueryProcessorLogicalInformationEx (RelationshipType , & buffer , & bufferLength )))
1554
+ return ULONG_MAX ;
1555
+
1556
+ index = 0 ;
1557
+
1558
+ for (
1559
+ logicalInfo = buffer ;
1560
+ (ULONG_PTR )logicalInfo < (ULONG_PTR )PTR_ADD_OFFSET (buffer , bufferLength );
1561
+ logicalInfo = PTR_ADD_OFFSET (logicalInfo , logicalInfo -> Size )
1562
+ )
1563
+ {
1564
+ PROCESSOR_RELATIONSHIP processor = logicalInfo -> Processor ;
1565
+ //BOOLEAN hyperThreaded = processor.Flags & LTP_PC_SMT;
1566
+
1567
+ if (processor .GroupMask [0 ].Mask & ((KAFFINITY )1 << Index ))
1568
+ {
1569
+ PhFree (buffer );
1570
+ return index ;
1571
+ }
1572
+
1573
+ index ++ ;
1574
+ }
1575
+
1576
+ PhFree (buffer );
1577
+ return ULONG_MAX ;
1578
+ }
0 commit comments