[NTOSKRNL] Quickly implement the !defwrites in KDBG

This commit is contained in:
Pierre Schweitzer 2018-02-09 12:16:29 +01:00
parent 0518444217
commit d35243d4e0
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
2 changed files with 28 additions and 0 deletions

View file

@ -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 */

View file

@ -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 *****************************************************************/