clearCPUData does not work in 2014 API version?

Questions about YourKit Java Profiler
Post Reply
sershe
Posts: 2
Joined: Thu Mar 26, 2015 7:08 pm

clearCPUData does not work in 2014 API version?

Post by sershe »

Hello.
I want to profile certain sections of my application, so I start it with an argument like so
-agentpath:/opt/yourkit/bin/linux-x86-64/libyjpagent.so=disablej2ee,disabletracing,dir=/grid/5/sershe/ykdumps

Then I run
yourKit.startCPUSampling("walltime=*");
to enable

and
yourKit.captureSnapshot(Controller.SNAPSHOT_WITHOUT_HEAP);
yourKit.stopCPUProfiling();
yourKit.clearCPUData();
to disable profiling.

I see the calls are made correctly from my logging:
2015-05-12 15:52:13,832 .... attempt_1429683757595_0920_10_00_000710_0_13541 will start profiling
2015-05-12 15:52:38,671 .... captured snapshot after attempt_1429683757595_0920_10_00_000920_0_13598
2015-05-12 15:52:38,672 .... attempt_1429683757595_0920_10_00_000920_0_13598 has ended profiling

And so I expect CPU data for ~25 seconds in this case.
I do get a separate snapshots for each such invocation, however each snapshot is bigger than the previous one, and all of them have all the CPU data from the beginning of the application; clearCPUData doesn't work.

I used similar approach with 2013 version and it worked.
Currently I am using the redistributable from YourKit_Java_Profiler_2014_build_14120.app.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: clearCPUData does not work in 2014 API version?

Post by Anton Katilin »

however each snapshot is bigger than the previous one, and all of them have all the CPU data from the beginning of the application
Do you mean the call trees? It is what the CPU data is, and what is expected to be cleared. Please note that telemetry graphs, including the CPU usage, are not CPU data. They are stored in a cyclic buffer with 1 hour capacity be default, and cannot/should not be cleared.

If you mean the call trees: could you please check if the problem is reproducible with version 2015. Version 2014 is no longer supported.

Disregarding the version, please note that you don't need to clear CPU data explicitly, as it is implicitly cleared each time you call startCPUSampling(). Thus it is enough to perform this sequence of calls: startCPUSampling() - captureSnapshot() - stopProfiling().
sershe
Posts: 2
Joined: Thu Mar 26, 2015 7:08 pm

Re: clearCPUData does not work in 2014 API version?

Post by sershe »

Yes, I mean the call stacks from the beginning of the process.
CPU tab shows method time totals/call stacks/etc. for all time that profiling was on since the beginning, rather than the single short profiling time (25s in this case). I can also see call stacks/CPU summaries for any previous time profiling was on (most of the process runtime, but I wanted it in separate files to make it easier to compare different stretches with uneven performance).
I actually see "CPU profiling data cleared" markers in Performance Charts every time profiling is stopped, so it's really strange that it's not cleared.

I'll try 2015.
Post Reply