Measureing memory used by a subprocess

Andrew McLean andrew-news at
Mon Apr 2 02:12:53 CEST 2007

I want to script the benchmarking of some compression algorithms on a 
Windows box. The algorithms are all embodied in command line 
executables, such as gzip and bzip2. I would like to measure three things:

1. size of compressed file
2. elapsed time (clock or preferably CPU)
3. memory used

The first is straightforward, as is measuring elapsed clock time. But 
how would I get the CPU time used by a sub-process or the memory used?

I'm guessing that the Windows Performance Counters may be relevant, see 
the recipe

But I don't see any obvious way to get the process id of the spawned 

- Andrew

More information about the Python-list mailing list