Windows 7 Shell : get accumulated page faults of process

2

I want to read the (accumulated) pagefaults of a process from the windows shell to decide when to kill it. The process will start dynamically.

I found the killing part (e.g. here: How to monitor and kill a process automatically on windows by process name) but I found no way to read the page faults. I tried pfmon.exe from the windows resource kits (installed rktools.exe although it raised a incompatibility warning) with taskmgr and it works - I tried it with MathKernel (the process in question and after I added it to PATH) and pfmon says it is not supported.

I know of tasklist but this only shows me cpu time and memory usage.

Is there another way to read page faults? Can the taskmanager be used somehow automatically?

Background:

This is related to my post about a problem in Mathematica here for which I couldn't find a solution (I tried the 1 answer there). My script runs 8 parallel Mathematica Kernels for a computation which takes ~10 hours and sometimes one or two of them block. I already restart them for each computation but the behaviour prevails. At the moment I check regularly with the taskmanager on them and kill MathKernel.exe processes which accumulate a lot of page faults. Note that processor time/load and memory usage are not helpful while the other MathKernel.exe processes are still running. That's why I need the page faults - I want to compare all 8 processes say every minute and if one has 10 times the page faults of the other I want to kill it.

Kab

Posted 2017-07-18T11:50:59.003

Reputation: 23

Answers

1

Is there another way to read this data?

You can use pslist from Windows Sysinternals:

Memory Abbreviation Key

All memory values are displayed in KB.

Pri: Priority
Thd: Number of Threads
Hnd: Number of Handles
VM: Virtual Memory
WS: Working Set
Priv: Private Virtual Memory
Priv Pk: Private Virtual Memory Peak
Faults: Page Faults
NonP: Non-Paged Pool
Page: Paged Pool
Cswtch: Context Switches

The faults value is the total number of page faults.

You will need the process IDs of the processes you want to monitor.

Example output:

> pslist -m 6272

PsList v1.4 - Process information lister
Copyright (C) 2000-2016 Mark Russinovich
Sysinternals - www.sysinternals.com

Process memory detail for HAL:

Name                Pid      VM      WS    Priv Priv Pk   Faults   NonP Page
firefox            6272 2707156 1038508 1015532 1191600 34880695    194  596

You can use a batch file or PowerShell script to parse this output.

Disclaimer

I am not affiliated with Windows Sysinternals in any way, I am just an end user of their software.

DavidPostill

Posted 2017-07-18T11:50:59.003

Reputation: 118 938

Thanks DavidPostill! I tried it and it does what I want. I will post my batch file in the other Question i linked. – Kab – 2017-07-18T12:33:59.817

I also don't need to use the PID. I can just use "pslist -m -nobanner MathKernel" and it will find all the processes. – Kab – 2017-07-18T13:53:40.540

@Kab Correct. My answer was just an illustration. You have to identify the processes somehow ... – DavidPostill – 2017-07-18T13:55:19.547