This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
When profiling CPU (using Thread CPU Timer), percentual values > 100% occur inside the CCT. It is unclear what does it mean or if this is a bug.
Created attachment 21031 [details] Screenshot
Assigning to Misha, who owns the corresponding code
Initial investigation shows that the problem is likely due to extremely coarse granularity of thread CPU timer on Windows - about 10 ms. With this granularity plus our calibration, we may easily get negative time for many short-running methods. That's because if such a method was called say 1000 times in 2 ms, its measured time will be 0 ms due to timer's coarse granularity, but timer calls itself would take say 0.01 ms * 1000 = 10 ms - so the resulting calculated "cleansed" time for this method will be 0 - 10 = -10 ms. When negative results for multiple methods sum up, they may result in total time smaller than measured time for some long-running methods. For example, total time may be 10 for foo() + (-1) for bar1() + (-2) for bar2() = 7 ms. Thus for foo() we will get 10/7 = 130% execution time. The problem is serious in presence of short-running methods. So far I don't know how to deal with it except by not using measured time "cleansing" with data obtained by calibration, at all...
What about just using Math.max(0, cleansedTime) to avoid getting negative values. This should at least fix percentageValue > 100 problem, which can be confusing for the user.
Fixed in M6 by completely eliminating time cleansing when thread CPU only timer is used on Windows or Linux.
Verification of old issues.
Closing old issues.