How do you know if your program is creating too many page faults? How do you know how many page faults it’s creating? You can use Task Manager or Resource Monitor to give you a broad overview. But what if you want more detail about the page faults your application is creating?
Page faults are a necessary part of a disk-based operating system. But your program can incur unnecessary performance penalties if its causing too many page faults. How many is too many is a judgement call, but a good rule of thumb is that the program is running slower than expected. Often once you see where the page faults are caused, you can infer that a restructuring of your software may have a great performance impact. Often the change is as simple as moving a call a few lines earlier, or to a parent function, or caching a handle rather than opening it and closing it each time.
Page Fault Monitor is a page fault viewer that monitors the activity of a program and reports all page faults associated with that program.
Page Fault Monitor provides a GUI for the examination of the page fault data. Where possible, we provide DLL, symbol, filename and line number information associated with a page fault address and the number of page faults at that address.
In the page fault report shown above the method for EXE_FILE::openPart2, source file e:\om\c\svlpedll\exefile.cpp in the DLL svlPeInfo_x64.dll has caused 73,204 page faults.
Those 73,204 page faults are in 3,598 unique locations that are shown on the lower left of the image. The source code is shown below, with the faulting line of code highlighted.
Now that you know where in your source code the page fault happened, you can make a judgement call as to whether this line of code is always going to cause a page fault or if this was just a page fault because of the virtual memory paging of the operating system. If you consider that this line is always going to cause page faults, the next step is to determine if you can reduce the number of page faults, either by modifying the source code or working your way back through the program behaviour to see if you can make a change there that reduces the likelihood of a page fault.