Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335133 - Profiling with Execution Statistics incorrectly generates repeating statistical data
Summary: Profiling with Execution Statistics incorrectly generates repeating statistic...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: TPTP (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 critical (vote)
Target Milestone: ---   Edit
Assignee: Jonathan West CLA
QA Contact: Kathy Chan CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-23 15:08 EST by Jonathan West CLA
Modified: 2016-05-05 10:43 EDT (History)
6 users (show)

See Also:
kathy: pmc_approved? (oec)
ernest: pmc_approved+
kathy: pmc_approved+
kathy: pmc_approved? (jgwest)
jerome.bozier: pmc_approved+
jgwest: review? (mikereid)


Attachments
Patch to tickets.h/tickets.cpp (25.77 KB, patch)
2011-02-02 17:48 EST, Jonathan West CLA
no flags Details | Diff
Patch to tickets.h/tickets.cpp - 2 (25.83 KB, patch)
2011-02-03 13:16 EST, Jonathan West CLA
no flags Details | Diff
Patch to tickets.h/tickets.cpp - 3 (776 bytes, patch)
2011-02-04 16:57 EST, Jonathan West CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan West CLA 2011-01-23 15:08:53 EST
In certain cases, execution statistics seems to be repeating the same set of profiling statistics over-and-over again, independent of what the target application is actually doing.

To reproduce:
1. From Eclipse, profile HeapJniCarTest with Execution Stats enabled. Set the polling frequency to 10 seconds before launching.
2. Launch the app. Hit enter once in the console, to advance the application to the second set of outputs.
3. Wait for stats to appear in the profiling window. Then, wait for the stats to have greater-than-zero method calls associated with them.

After step 3, every subsequent data refresh will increase the time and call numbers on all the methods. This is inaccurate, because at this stage the profiled application is literally doing nothing. Each data refresh is essentially a copy of the last data refresh that was sent.
Comment 1 Jonathan West CLA 2011-02-02 17:48:47 EST
Created attachment 188203 [details]
Patch to tickets.h/tickets.cpp
Comment 2 Jonathan West CLA 2011-02-02 17:49:45 EST
Mike, can you review?
Comment 3 Mike Reid CLA 2011-02-03 10:09:07 EST
I'd say this looks good overall; nicely cleaned up from the prior version :)

A few minor comments/questions:

- The comment block talking about 'Print Stack' (Tickets.h:193) would be more clear if you use 'visit' in place of 'enter'; this reduces confusion between the idea of a stack entry and the act of traversing the tree.

- Can CStackEntry::m_pInvokedChildren be an aggregated member, rather than a pointer that has to b new'd? This avoids a call to new+delete at each level of the call-graph.

- Similarly for CStackHead::m_pStackHead?

- Tickets.cpp:53 - Does it make sense to emit a DEBUG message here? That way if this does happen we have a way of detecting it?

- CStackEntry::DeleteTreeNonMatchingStackEntry - does the fact that you sometimes delete the entry prevent you from putting the increment operation in the third slot of the for loop, as is usual? Otherwise I would suggest moving the 'it++' to the third clause of the for loop, as it makes it easier to see there is not an infinite loop.
Comment 4 Jonathan West CLA 2011-02-03 13:16:59 EST
Created attachment 188259 [details]
Patch to tickets.h/tickets.cpp - 2
Comment 5 Jonathan West CLA 2011-02-03 13:27:59 EST

I would like to request that the following defect be considered for PMC approval for 4.7.2.

1.  Explain why you believe this is a stop-ship defect. How does the defect manifest itself, and how will users of TPTP / consuming products be affected if the defect is not fixed?
The scope of the issue described above is such that it is likely that incorrect statistics would be produced in any profile with execution statistics, and should therefore be fixed in 4.7.2.

2. Is there a work-around? If so, why do you believe the work-around is insufficient?
Workaround would be to used execution flow, rather than execution statistics, however this is not an option for profiling large or long-running applications, or applications for which only minimal profiling overhead can be tolerated.

3. Is this a regression or API breakage? Explain.
No, not a regression from 4.7.1, haven't tested issue with other previous releases.

4. Does this require new API?
No.

5. Who performed the code review?
Mike Reid.

6. Is there a test case attached to the bugzilla record?
No.

7. What is the nature of the fix?  What is the risk associated with this fix?
Fix required rewriting the algorithm used to process execution statistics data. New algorithm has been fully documented in the code.
This change does not affect profiling with 'execution flow' option, which is the default for execution profiling.
Risk is medium.

8. Is this fix related to any standards that TPTP adheres to? If so, who has validated that the fix continues to adhere to the standard?
No.
Comment 6 Kathy Chan CLA 2011-02-03 13:36:41 EST
Requesting PMC approval for TPTP 4.7.2.
Comment 7 Jonathan West CLA 2011-02-03 14:16:04 EST
I've tested the patch in a variety of scenarios, and on a number of large application configurations, and have run the automated JVMTI test on the change and had no issues with any of the above. Once a build is available I will verify the fix through additional testing.
Comment 8 Jonathan West CLA 2011-02-03 14:17:42 EST
Checked into HEAD w/ PMC approval.
Comment 9 Samuel Wu CLA 2011-02-04 15:55:03 EST
Hey Jon,

the build failed on the patch you checked in. please handle
Thanks,

Sam
Comment 10 Jonathan West CLA 2011-02-04 16:57:19 EST
Created attachment 188372 [details]
Patch to tickets.h/tickets.cpp - 3
Comment 11 Jonathan West CLA 2011-02-04 16:59:04 EST
Patch 2 compiled fine for me on VS2K3, but this should fix for the rest of the platforms.
Comment 12 Jonathan West CLA 2011-02-04 16:59:25 EST
Checked into HEAD.
Comment 13 Jonathan West CLA 2011-04-01 14:21:24 EDT
Closing.