I'm hunting of a memory pool leak using poolmon. In the KB article, they explain how to capture the output manually using cut&paste. Isn't there a way to automate this?

Since the tool doesn't seem to support it, my idea was to run two command prompts (one for paged and one for nonpaged pools), and use a tool to make an automatic screenshot. If this was possible, which tool would you suggest? Is there a tool that can cut the text out of a command prompt without manual intervention?

link|improve this question

feedback

2 Answers

up vote 4 down vote accepted

In version 5.2.3790.0 (from the W2K3 RTM support tools) you can specify a "snapshot" file:

poolmon -n filename.log

It will write both the paged and non-paged pool entries to this file.

I'd use scheduled tasks to run the following on a recurring basis:

@echo off
SET POOLMON="C:\Program Files\Support Tools\Poolmon.exe"
SET OUTDIR=C:\WINDOWS\TEMP

SET YEAR=%DATE:~10,4%
SET MONTH=%DATE:~4,2%
SET DAY=%DATE:~7,2%
SET HOUR=%TIME:~0,2%
IF /I %HOUR% LEQ 9 SET HOUR=0%HOUR:~1,1%
SET MINUTE=%TIME:~3,2%
SET SECOND=%TIME:~6,2%
SET ISODATE=%YEAR%-%MONTH%-%DAY%_%HOUR%-%MINUTE%-%SECOND%

%POOLMON% -n %OUTDIR%\poolmon.%ISODATE%.log

Set POOLMON to point to the path of Poolmon.exe and OUTDIR to point to whatever directory you want output written to and you'll get output files of the format:

poolmon.YYYY-MM-DD_HH-MM-SS.log

Throw that script into a scheduled task and you're in business.

link|improve this answer
I hope this version also runs on WinXP. I'll give it a try and let you know. – Aaron Digulla Jul 28 '09 at 14:37
And the good news is: it does! Thanks a bunch! – Aaron Digulla Aug 7 '09 at 9:26
Oh, and the date didn't work for me: In the German version, the format is 31.08.2009, so I had to replace the first three assignments with YEAR=%DATE:~6,4% MONTH=%DATE:~3,2% DAY=%DATE:~0,2% – Aaron Digulla Aug 7 '09 at 9:38
Good catch. I always forget that your version of Windows' default regional options affect the order of the DATE variable. – Evan Anderson Aug 7 '09 at 11:54
feedback
Rem You need sleep.exe and poolmon to run.
echo off
C:
cd \
MD Poolmon-log
cd poolmon-log
explorer c:\poolmon-log
SET POOLMON="Poolmon.exe"
SET OUTDIR=C:\poolmon-log\
SET YEAR=%DATE:~8,4%
SET MONTH=%DATE:~3,2%
SET DAY=%DATE:~0,2%
SET HOUR=%TIME:~0,2%
IF /I %HOUR% LEQ 9 SET HOUR=0%HOUR:~1,1%
SET MINUTE=%TIME:~3,2%
SET SECOND=%TIME:~6,2%
SET ISODATE=%DAY%-%MONTH%-%Year%_%HOUR%-%MINUTE%-%SECOND%
:Top1
%POOLMON% /p /p /b -n %OUTDIR%poolmon-%ISODATE%.log
sleep 3600
goto top1
pause

The above works in Ireland. Explorer will auto open the folder for viewing. Logs are dumped every 30min.

link|improve this answer
Please indent your code by four spaces to keep it readable :) – Aaron Digulla Sep 29 '09 at 8:13
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.