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.
build 050819 m8v2 jdk 1.5.0_04 I tried to profile simple method like: private void test1000() { long startTime = System.currentTimeMillis(); while ((System.currentTimeMillis() - startTime) < 1000); } The method is called periodicaly and always run 1000ms. I used CPU profiling with this method as root method. The Live Results window shown me values: 1000ms 1st invocation 2002ms 2nd invocation 2999ms 3rd invocation 3593ms 4th invocation ... The error on the last line is not exceptional, similar errors occured in about 3 invocations of 10.
I found that when 'getresults' is called in a time a method is entered but not exited the profiler client probably counts a difference between method entry and getresults time and adds it to the method's self time. (The difference is subtracted after showing of results.) The method's invocations counter is increased after the method is entered. If a user take snapshot in a 'wrong' time profiler can return results: 10 invocations of a method (each should take 1000 ms) and self time 9536ms. Maybe it should show only finished invocations of a method: 9 invocations, self time 9000ms or to have more counters: 9 invocations, 10 method's entries, measured time 9000ms, actual time 9536ms
The results are actually correct. The results have to include partial results for methods that have not finished yet - definitely for submethods called, as those may have finished their execution, and if those are included, the self time needs to be included too for accuracy. The clearest example is with methods that never exit - such as run () method or all threads - if partial timing would not be included, no results would be available until the thread finishes - which is never for most typical threads.
verified