diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index b62d665e..afd16b06 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -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 diff --git a/patches/taskmgr-Memory_Usage/0005-ntdll-Implement-basic-IO-stats-for-SystemPerformance.patch b/patches/taskmgr-Memory_Usage/0005-ntdll-Implement-basic-IO-stats-for-SystemPerformance.patch new file mode 100644 index 00000000..e9defc25 --- /dev/null +++ b/patches/taskmgr-Memory_Usage/0005-ntdll-Implement-basic-IO-stats-for-SystemPerformance.patch @@ -0,0 +1,52 @@ +From 02cb8d6b85421c1f302a706803249cc574f48cdc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +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, §ors_read, &read_time, ++ &writes, &writes_merged, §ors_written, &write_time, ++ ¤t_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 + diff --git a/patches/taskmgr-Memory_Usage/definition b/patches/taskmgr-Memory_Usage/definition new file mode 100644 index 00000000..a1240ac9 --- /dev/null +++ b/patches/taskmgr-Memory_Usage/definition @@ -0,0 +1 @@ +Fixes: Implement IO stats for SystemPerformanceInformation in NtQuerySystemInformation