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.
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