Added patch to implement IO stats for SystemPerformanceInformation in NtQuerySystemInformation.

This commit is contained in:
Sebastian Lackner 2017-03-11 00:11:02 +01:00
parent ab34c856c3
commit 05a282feff
3 changed files with 55 additions and 0 deletions

View File

@ -7281,10 +7281,12 @@ if test "$enable_taskmgr_Memory_Usage" -eq 1; then
patch_apply taskmgr-Memory_Usage/0002-ntdll-Report-system-information-SystemPerformanceInf.patch
patch_apply taskmgr-Memory_Usage/0003-taskmgr-Use-system-font-instead-of-special-bitmap-fo.patch
patch_apply taskmgr-Memory_Usage/0004-taskmgr-Use-different-units-depending-on-memory-usag.patch
patch_apply taskmgr-Memory_Usage/0005-ntdll-Implement-basic-IO-stats-for-SystemPerformance.patch
(
printf '%s\n' '+ { "Michael Müller", "ntdll: Report system information SystemPerformanceInformation info class.", 2 },';
printf '%s\n' '+ { "Michael Müller", "taskmgr: Use system font instead of special bitmap font.", 1 },';
printf '%s\n' '+ { "Michael Müller", "taskmgr: Use different units depending on memory usage.", 1 },';
printf '%s\n' '+ { "Michael Müller", "ntdll: Implement basic IO stats for SystemPerformanceInformation in NtQuerySystemInformation.", 1 },';
) >> "$patchlist"
fi

View File

@ -0,0 +1,52 @@
From 02cb8d6b85421c1f302a706803249cc574f48cdc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 8 Mar 2017 23:09:54 +0100
Subject: ntdll: Implement basic IO stats for SystemPerformanceInformation in
NtQuerySystemInformation.
---
dlls/ntdll/nt.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 9e61bd96022..947ecc73f32 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1943,6 +1943,34 @@ NTSTATUS WINAPI NtQuerySystemInformation(
}
#endif
+ if ((fp = fopen("/proc/diskstats", "r")))
+ {
+ unsigned long long reads, reads_merged, sectors_read, read_time;
+ unsigned long long writes, writes_merged, sectors_written, write_time;
+ unsigned long long io_time, weighted_io_time, current_io;
+ unsigned int major, minor;
+ char dev[30], buffer[256];
+
+ /* the exact size (32 or 64 bits) depends on the kernel */
+ while (fscanf(fp, "%u %u %s %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu",
+ &major, &minor, dev, &reads, &reads_merged, &sectors_read, &read_time,
+ &writes, &writes_merged, &sectors_written, &write_time,
+ &current_io, &io_time, &weighted_io_time) == 14)
+ {
+ /* we have to ignore partitions as their I/O is also included in the block device */
+ sprintf(buffer, "/sys/dev/block/%u:%u/device", major, minor);
+ if (access(buffer, F_OK) != 0)
+ continue;
+
+ spi.ReadTransferCount.QuadPart += sectors_read * 512;
+ spi.WriteTransferCount.QuadPart += sectors_written * 512;
+ spi.ReadOperationCount += reads;
+ spi.WriteOperationCount += writes;
+ }
+
+ fclose(fp);
+ }
+
if (Length >= len)
{
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
--
2.11.0

View File

@ -0,0 +1 @@
Fixes: Implement IO stats for SystemPerformanceInformation in NtQuerySystemInformation