Fully featured low overhead profiler for Java EE and Java SE platforms.
Performance monitoring and profiling of Jenkins, TeamCity, Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

Copy stack: use jstack format

Moderators: Vladimir Kondratyev, Anton Katilin

Copy stack: use jstack format

Postby plethora » Mon Dec 17, 2012 7:08 pm

In the "Threads" view, I often use "copy stack" on the stack of the selected thread shown in the bottom pane.
It would be very convenient, if the format of the thread stack that YourKit puts on the system clipboard was similar to jstack.

For one, it would allow me to use the IntelliJ Analyze->Stacktrace feature.

At the moment, when I want to follow the stack of a give thread stack from frame to frame, I can of course also click, and the IDE integration will take me there.
However, especially when using only a single screen, this is far from an enjoyable UI experience. When clicking on a link shows you the source, but then you've lost the context (thread stack), and vice versa.
plethora
 
Posts: 314
Joined: Thu Jun 02, 2005 8:36 pm

Re: Copy stack: use jstack format

Postby Anton Katilin » Tue Dec 18, 2012 10:11 am

Hi Taras

I see your point, but it seems there is a technical problem.

IDEA's Analyze -> Stacktrace feature turns to clickable links only lines in format

Code: Select all
 at com.foo.ClassName.methodName(ClassName.java:<LineNumber>)


but not

Code: Select all
 at com.foo.ClassName.methodName(Unknown Source)


or

Code: Select all
 at com.foo.ClassName.methodName(Native Method)


That is, it allows to navigate only if the source code position, file and line, is known.

The problem is that the stacks in YourKit include methods but not the source code points <file name>:<line number>. Why it is so and whether there should be an ability/option to see the source code lines is subject to discuss. But the fact is that the current version does not have and all older versions never had the line number for the stacks.

As the result, we cannot present the stacks in that format now.

You can ask: But how the navigation feature works? How does it manage to find to the source code location inside the IDE? Well, it passes the method signature to IDE, and uses the IDE's internal code introspection API to locate the source code position. It always navigates to the beginning of the method body.

Which solutions I see:

1. Add line numbers. This requires serious changes and definitely will not be implemented in one of the version 12 updates.

2. Use the IDE's power to retrieve the line number. It could work like this:
- on attempt to produce the stack trace, the profiler UI collects the list of methods for which the source code is needed, and makes a call to the IDE plugin;
- the plugin retrieves the source positions for each of the methods, just like it does now when it navigates to source code from the profiler UI;
- the plugin sends the source code positions back to the profiler UI;
- the profiler UI generate the stacks.
But note: this will be a "strange" stack trace: the line numbers will always correspond to the method beginnings.

3. File a feature request to JetBrains, to make the lines without the source code position clickable too. Let it navigate to the beginning of the method.

I personally prefer #3, but not sure how fast they could implement this suggestion, if ever.
And #1 as a potential request for the future version.

Best regards,
Anton
Anton Katilin
 
Posts: 5708
Joined: Wed Aug 11, 2004 8:37 am

Re: Copy stack: use jstack format

Postby plethora » Tue Dec 18, 2012 1:54 pm

Hi Anton,

#1 would be a nice feature request for YK 13.
Having stack traces with lines numbers (if available) would be useful beyond my specific use case.

Cheers,
Taras
plethora
 
Posts: 314
Joined: Thu Jun 02, 2005 8:36 pm

Re: Copy stack: use jstack format

Postby Anton Katilin » Thu Nov 06, 2014 2:48 pm

Hi Taras

Line numbers are available in version 2014.

Best regards,
Anton
Anton Katilin
 
Posts: 5708
Joined: Wed Aug 11, 2004 8:37 am


Return to Java Profiler

Who is online

Users browsing this forum: No registered users and 17 guests