mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 22:56:00 +00:00
[NTOSKRNL] Allow filtering !poolused output using a tag
This commit is contained in:
parent
879d8f2104
commit
454e8738f2
2 changed files with 27 additions and 7 deletions
|
@ -185,7 +185,7 @@ static const struct
|
||||||
{ "kmsg", "kmsg", "Kernel dmesg. Alias for dmesg.", KdbpCmdDmesg },
|
{ "kmsg", "kmsg", "Kernel dmesg. Alias for dmesg.", KdbpCmdDmesg },
|
||||||
{ "help", "help", "Display help screen.", KdbpCmdHelp },
|
{ "help", "help", "Display help screen.", KdbpCmdHelp },
|
||||||
{ "!pool", "!pool [Address [Flags]]", "Display information about pool allocations.", ExpKdbgExtPool },
|
{ "!pool", "!pool [Address [Flags]]", "Display information about pool allocations.", ExpKdbgExtPool },
|
||||||
{ "!poolused", "!poolused", "Display pool usage.", ExpKdbgExtPoolUsed },
|
{ "!poolused", "!poolused [Tag]", "Display pool usage.", ExpKdbgExtPoolUsed },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
|
@ -480,7 +480,7 @@ ExpTagAllowPrint(CHAR Tag)
|
||||||
else DPRINT1(fmt, ##__VA_ARGS__)
|
else DPRINT1(fmt, ##__VA_ARGS__)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
MiDumpPoolConsumers(BOOLEAN CalledFromDbg)
|
MiDumpPoolConsumers(BOOLEAN CalledFromDbg, ULONG Tag)
|
||||||
{
|
{
|
||||||
SIZE_T i;
|
SIZE_T i;
|
||||||
|
|
||||||
|
@ -519,8 +519,10 @@ MiDumpPoolConsumers(BOOLEAN CalledFromDbg)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// If there's a tag, attempt to do a pretty print
|
// If there's a tag, attempt to do a pretty print
|
||||||
|
// only if it matches the caller tag, or if
|
||||||
|
// any tag is allowed
|
||||||
//
|
//
|
||||||
if (TableEntry->Key != 0 && TableEntry->Key != TAG_NONE)
|
if (TableEntry->Key != 0 && TableEntry->Key != TAG_NONE && (Tag == 0 || TableEntry->Key == Tag))
|
||||||
{
|
{
|
||||||
CHAR Tag[4];
|
CHAR Tag[4];
|
||||||
|
|
||||||
|
@ -548,7 +550,7 @@ MiDumpPoolConsumers(BOOLEAN CalledFromDbg)
|
||||||
TableEntry->PagedAllocs, TableEntry->PagedBytes);
|
TableEntry->PagedAllocs, TableEntry->PagedBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (Tag == 0 || Tag == TAG_NONE)
|
||||||
{
|
{
|
||||||
MiDumperPrint(CalledFromDbg, "Anon\t\t%ld\t\t%ld\t\t%ld\t\t%ld\n",
|
MiDumperPrint(CalledFromDbg, "Anon\t\t%ld\t\t%ld\t\t%ld\t\t%ld\n",
|
||||||
TableEntry->NonPagedAllocs, TableEntry->NonPagedBytes,
|
TableEntry->NonPagedAllocs, TableEntry->NonPagedBytes,
|
||||||
|
@ -1749,7 +1751,7 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
|
||||||
//
|
//
|
||||||
// Out of memory, display current consumption
|
// Out of memory, display current consumption
|
||||||
//
|
//
|
||||||
MiDumpPoolConsumers(FALSE);
|
MiDumpPoolConsumers(FALSE, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2082,7 +2084,7 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
|
||||||
//
|
//
|
||||||
// Out of memory, display current consumption
|
// Out of memory, display current consumption
|
||||||
//
|
//
|
||||||
MiDumpPoolConsumers(FALSE);
|
MiDumpPoolConsumers(FALSE, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2942,7 +2944,25 @@ ExpKdbgExtPoolUsed(
|
||||||
ULONG Argc,
|
ULONG Argc,
|
||||||
PCHAR Argv[])
|
PCHAR Argv[])
|
||||||
{
|
{
|
||||||
MiDumpPoolConsumers(TRUE);
|
ULONG Tag = 0;
|
||||||
|
|
||||||
|
if (Argc > 1)
|
||||||
|
{
|
||||||
|
CHAR Tmp[4];
|
||||||
|
ULONG Len;
|
||||||
|
|
||||||
|
/* Get the tag */
|
||||||
|
Len = strlen(Argv[1]);
|
||||||
|
if (Len > 4)
|
||||||
|
{
|
||||||
|
Len = 4;
|
||||||
|
}
|
||||||
|
RtlCopyMemory(Tmp, Argv[1], Len * sizeof(CHAR));
|
||||||
|
|
||||||
|
Tag = *((PULONG)Tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
MiDumpPoolConsumers(TRUE, Tag);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue