Hi
I am profiling an application using HotSpot profiling and realized there is a giant unmatch between User-Mode sampling and Hardware-event sampling. I do know that there might be some amount of inaccuracy in the sampling mode, but I did not expect it to be that big…
Note in the figure below. For func@0x1a7d04 shown in red, its CPU time is 0.9% in the User-Mode sampling mode, but 4%(being the highest) in the Hardward-event sampling mode.
A similar thing happens on std::__cxx11::basic_string<char,std::char_traits>… shown in green. It shows 3%(being the highest) CPU time in User-Mode sampling, but 0% in hardware-event-based sampling.
Right now I don’t know which one is the true data… We enable the “allow multiple run option”, setting Hardware-event sampling frequency to 0.5ms (I also tried 10ms, the same setting with User-Mode Sampling frequency, but this unmatch still exists).
P.S. The microarchitecture exploration result aligns with the hardware-event sampling Hotspot experiment…

