https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d35243d4e0bffb0edc07150c550ff903ba4427d8

commit d35243d4e0bffb0edc07150c550ff903ba4427d8
Author:     Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Fri Feb 9 12:16:29 2018 +0100
Commit:     Pierre Schweitzer <pie...@reactos.org>
CommitDate: Fri Feb 9 12:16:29 2018 +0100

    [NTOSKRNL] Quickly implement the !defwrites in KDBG
---
 ntoskrnl/cc/view.c      | 26 ++++++++++++++++++++++++++
 ntoskrnl/kdbg/kdb_cli.c |  2 ++
 2 files changed, 28 insertions(+)

diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c
index 23bc5076e1..cf2645591c 100644
--- a/ntoskrnl/cc/view.c
+++ b/ntoskrnl/cc/view.c
@@ -1427,6 +1427,32 @@ ExpKdbgExtFileCache(ULONG Argc, PCHAR Argv[])
 
     return TRUE;
 }
+
+BOOLEAN
+ExpKdbgExtDefWrites(ULONG Argc, PCHAR Argv[])
+{
+    KdbpPrint("CcTotalDirtyPages:\t%lu (%lu Kb)\n", CcTotalDirtyPages,
+              (CcTotalDirtyPages * PAGE_SIZE) / 1024);
+    KdbpPrint("CcDirtyPageThreshold:\t%lu (%lu Kb)\n", CcDirtyPageThreshold,
+              (CcDirtyPageThreshold * PAGE_SIZE) / 1024);
+    KdbpPrint("MmAvailablePages:\t%lu (%lu Kb)\n", MmAvailablePages,
+              (MmAvailablePages * PAGE_SIZE) / 1024);
+
+    if (CcTotalDirtyPages >= CcDirtyPageThreshold)
+    {
+        KdbpPrint("CcTotalDirtyPages above the threshold, writes should be 
throttled\n");
+    }
+    else if (CcTotalDirtyPages + 64 >= CcDirtyPageThreshold)
+    {
+        KdbpPrint("CcTotalDirtyPages within 64 (max charge) pages of the 
threshold, writes may be throttled\n");
+    }
+    else
+    {
+        KdbpPrint("CcTotalDirtyPages below the threshold, writes should not be 
throttled\n");
+    }
+
+    return TRUE;
+}
 #endif
 
 /* EOF */
diff --git a/ntoskrnl/kdbg/kdb_cli.c b/ntoskrnl/kdbg/kdb_cli.c
index dfb01f4960..3fce1977d9 100644
--- a/ntoskrnl/kdbg/kdb_cli.c
+++ b/ntoskrnl/kdbg/kdb_cli.c
@@ -94,6 +94,7 @@ static BOOLEAN KdbpCmdDmesg(ULONG Argc, PCHAR Argv[]);
 BOOLEAN ExpKdbgExtPool(ULONG Argc, PCHAR Argv[]);
 BOOLEAN ExpKdbgExtPoolUsed(ULONG Argc, PCHAR Argv[]);
 BOOLEAN ExpKdbgExtFileCache(ULONG Argc, PCHAR Argv[]);
+BOOLEAN ExpKdbgExtDefWrites(ULONG Argc, PCHAR Argv[]);
 
 #ifdef __ROS_DWARF__
 static BOOLEAN KdbpCmdPrintStruct(ULONG Argc, PCHAR Argv[]);
@@ -188,6 +189,7 @@ static const struct
     { "!pool", "!pool [Address [Flags]]", "Display information about pool 
allocations.", ExpKdbgExtPool },
     { "!poolused", "!poolused [Flags [Tag]]", "Display pool usage.", 
ExpKdbgExtPoolUsed },
     { "!filecache", "!filecache", "Display cache usage.", ExpKdbgExtFileCache 
},
+    { "!defwrites", "!defwrites", "Display cache write values.", 
ExpKdbgExtDefWrites },
 };
 
 /* FUNCTIONS *****************************************************************/

Reply via email to