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.

Bug 56793 - Strange percentual values in CPU CCT
Summary: Strange percentual values in CPU CCT
Status: CLOSED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Base (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker (vote)
Assignee: mishadmitriev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-22 13:12 UTC by Jiri Sedlacek
Modified: 2007-02-12 22:23 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot (21.28 KB, image/png)
2005-03-22 13:13 UTC, Jiri Sedlacek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Sedlacek 2005-03-22 13:12:10 UTC
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.
Comment 1 Jiri Sedlacek 2005-03-22 13:13:02 UTC
Created attachment 21031 [details]
Screenshot
Comment 2 iformanek 2005-03-29 14:42:18 UTC
Assigning to Misha, who owns the corresponding code
Comment 3 mishadmitriev 2005-04-04 07:43:20 UTC
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...
Comment 4 Jiri Sedlacek 2005-04-04 10:16:14 UTC
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.
Comment 5 mishadmitriev 2005-04-05 04:25:40 UTC
Fixed in M6 by completely eliminating time cleansing when thread CPU only timer
is used on Windows or Linux.
Comment 6 ehucka 2006-10-09 12:10:24 UTC
Verification of old issues.
Comment 7 Alexander Kouznetsov 2007-02-12 22:23:22 UTC
Closing old issues.