Currently I'm profiling two Windows applications in order to understand why one is slower than another.
First, I ran them with ProcMon tracing enabled and found that each application triggers "FlushBuffersFile" File System event with the same number of times (~1000 times per app run). Then I noticed that, on average, one application spend 3x times less on each FlushBuffersFile event duration, so I wanted to see this in details with Xperf.
I ran Xperf with the max sampling frequency collecting both disk IO and file IO (in CMD with Administator mode): xperf -on DiagEasy+FILE_IO -SetProfInt 1221
(DiagEasy is PROC_THREAD+LOADER+DISK_IO+HARD_FAULTS+DPC+INTERRUPT+CSWITCH+PERF_COUNTER)
Analyzing Xperf results, I noticed that it still show ~1000 Flush events for one application, but shows only ~50 for another. So, analyzing it with Xperf, I may think that for my 'fast' application Flush event occurs 50 times only, but I do know that it is wrong, because ProcMon says it occurs ~1000 times.
Is there an explanation for this? Why I see different number of events in Xperf and ProcMon for my 'fast' application? And, in general, is Xperf a good approach to understand why Flush event slower or faster for applications?