Log to file the memory usage (Private Bytes) of a process

Solution 1:

The Performance Monitor MMC console (perfmon.msc) supports background data collection.

  1. Open the "Data Collector Sets → User Defined" branch. Right-click to create a new set.

  2. Select "Create manually". In the next page, choose "Create data logs" and enable "Performance counter" logging.

  3. Click "Add Counter" and select "Process → Private Bytes" from the available counters list. You'll be able to select from running process names as "instances" of the counter.

    (Note that if you have multiple processes with the same basename, they'll have individual instances named "foo#2", "foo#3" etc.)

  4. Apparently that's what the C:\PerfLogs directory is for.

  5. Select "Start this data collector set now".

  6. After some time, right-click the collector set (the whole set, not the specific collector) and choose "Latest Report". This should open a scrollable graph, similar to the live "Performance Monitor" view.

(I don't know how well this works, I literally just figured out how to use it 15 minutes ago.)