https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e63237585122fb0555e07…
commit e63237585122fb0555e07af7a4ba089ffe1d590f
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sun Dec 9 18:56:50 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sun Dec 9 18:56:50 2018 +0100
[NTOSKRNL] For SystemPerformanceInformation, return some info extracted from PRCB
This notably includes the amount of context switchs and system calls.
---
ntoskrnl/ex/sysinfo.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/ntoskrnl/ex/sysinfo.c b/ntoskrnl/ex/sysinfo.c
index 09b9a6359c..b43aa2c1f9 100644
--- a/ntoskrnl/ex/sysinfo.c
+++ b/ntoskrnl/ex/sysinfo.c
@@ -669,7 +669,9 @@ QSI_DEF(SystemProcessorInformation)
/* Class 2 - Performance Information */
QSI_DEF(SystemPerformanceInformation)
{
+ LONG i;
ULONG IdleUser, IdleKernel;
+ PKPRCB Prcb;
PSYSTEM_PERFORMANCE_INFORMATION Spi
= (PSYSTEM_PERFORMANCE_INFORMATION) Buffer;
@@ -786,10 +788,23 @@ QSI_DEF(SystemPerformanceInformation)
Spi->CcLazyWritePages = CcLazyWritePages;
Spi->CcDataFlushes = CcDataFlushes;
Spi->CcDataPages = CcDataPages;
- Spi->ContextSwitches = 0; /* FIXME */
- Spi->FirstLevelTbFills = 0; /* FIXME */
- Spi->SecondLevelTbFills = 0; /* FIXME */
- Spi->SystemCalls = 0; /* FIXME */
+
+ Spi->ContextSwitches = 0;
+ Spi->FirstLevelTbFills = 0;
+ Spi->SecondLevelTbFills = 0;
+ Spi->SystemCalls = 0;
+ for (i = 0; i < KeNumberProcessors; i ++)
+ {
+ Prcb = KiProcessorBlock[i];
+ if (Prcb)
+ {
+ Spi->ContextSwitches += KeGetContextSwitches(Prcb);
+ Spi->FirstLevelTbFills += Prcb->KeFirstLevelTbFills;
+ Spi->SecondLevelTbFills += Prcb->KeSecondLevelTbFills;
+ Spi->SystemCalls += Prcb->KeSystemCalls;
+ }
+ }
+
return STATUS_SUCCESS;
}