All of lore.kernel.org
 help / color / mirror / Atom feed
* Profiling Java code running on Sun HotSpot JVM with linux perf
@ 2011-08-30 20:03 Geoffrey Blake
  2011-08-31  7:35 ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Geoffrey Blake @ 2011-08-30 20:03 UTC (permalink / raw)
  To: linux-perf-users

Hi all,

I am trying to profile some java server applications using %>perf
record -a, and as expected the majority of the execution time of these
applications is spent within jit'ed java code.  According to these
lists, the jit should be outputting a /tmp/perf-$pid.map file for each
thread being jit'ed.  The Sun JIT does not seem to have this output
enabled by default.  Does anyone here know what options I need to set
on the command line to get the JVM to output the symbol map files from
the JIT?

Thanks,
Geoff Blake

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Profiling Java code running on Sun HotSpot JVM with linux perf
  2011-08-30 20:03 Profiling Java code running on Sun HotSpot JVM with linux perf Geoffrey Blake
@ 2011-08-31  7:35 ` Stefan Hajnoczi
  2011-08-31  9:00   ` Maucci, Cyrille
  2011-09-01 14:58   ` Maynard Johnson
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2011-08-31  7:35 UTC (permalink / raw)
  To: Geoffrey Blake; +Cc: linux-perf-users

On Tue, Aug 30, 2011 at 9:03 PM, Geoffrey Blake
<geoffrey.w.blake@gmail.com> wrote:
> Hi all,
>
> I am trying to profile some java server applications using %>perf
> record -a, and as expected the majority of the execution time of these
> applications is spent within jit'ed java code.  According to these
> lists, the jit should be outputting a /tmp/perf-$pid.map file for each
> thread being jit'ed.  The Sun JIT does not seem to have this output
> enabled by default.  Does anyone here know what options I need to set
> on the command line to get the JVM to output the symbol map files from
> the JIT?

I don't know the answer but if you don't get one here you could check
the OProfile mailing list.  I believe there was a solution for JIT
compilers with OProfile and people probably got popular JVMs like
HotSpot working.  That might reveal what support HotSpot has for doing
this.

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Profiling Java code running on Sun HotSpot JVM with linux perf
  2011-08-31  7:35 ` Stefan Hajnoczi
@ 2011-08-31  9:00   ` Maucci, Cyrille
  2011-09-01 10:21     ` Stefan Hajnoczi
  2011-09-01 14:58   ` Maynard Johnson
  1 sibling, 1 reply; 6+ messages in thread
From: Maucci, Cyrille @ 2011-08-31  9:00 UTC (permalink / raw)
  To: Stefan Hajnoczi, Geoffrey Blake; +Cc: linux-perf-users

Hey gents,

I probably have a dumb question (if there are dumb questions...).

I always thought that system level profiling tools/framework like perf-events or Oprofile or Caliper ... being used to profile java based applications were only good to show the high-level breakdown between CPU time exec'ed in java code and CPU time exec'ed in 'native' (JNI) code, i.e. something like 
20% spent exec'ing JNI code vs. 80% spent in exec'ing pure java code.

But if you want the breakdown of the 80% spent in java code, i.e. the perf java methods breakdown, etc.... You need to use a java profiler (Jrockit Mission Control, Jprofiler, etc...) and can't expect this information to be provided by perf-events / Oprofile / Caliper /etc...

Comments ?

++Cyrille

-----Original Message-----
From: linux-perf-users-owner@vger.kernel.org [mailto:linux-perf-users-owner@vger.kernel.org] On Behalf Of Stefan Hajnoczi
Sent: Wednesday, August 31, 2011 9:36 AM
To: Geoffrey Blake
Cc: linux-perf-users@vger.kernel.org
Subject: Re: Profiling Java code running on Sun HotSpot JVM with linux perf

On Tue, Aug 30, 2011 at 9:03 PM, Geoffrey Blake <geoffrey.w.blake@gmail.com> wrote:
> Hi all,
>
> I am trying to profile some java server applications using %>perf 
> record -a, and as expected the majority of the execution time of these 
> applications is spent within jit'ed java code.  According to these 
> lists, the jit should be outputting a /tmp/perf-$pid.map file for each 
> thread being jit'ed.  The Sun JIT does not seem to have this output 
> enabled by default.  Does anyone here know what options I need to set 
> on the command line to get the JVM to output the symbol map files from 
> the JIT?

I don't know the answer but if you don't get one here you could check the OProfile mailing list.  I believe there was a solution for JIT compilers with OProfile and people probably got popular JVMs like HotSpot working.  That might reveal what support HotSpot has for doing this.

Stefan
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to majordomo@vger.kernel.org More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Profiling Java code running on Sun HotSpot JVM with linux perf
  2011-08-31  9:00   ` Maucci, Cyrille
@ 2011-09-01 10:21     ` Stefan Hajnoczi
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2011-09-01 10:21 UTC (permalink / raw)
  To: Maucci, Cyrille; +Cc: Geoffrey Blake, linux-perf-users

On Wed, Aug 31, 2011 at 10:00 AM, Maucci, Cyrille <cyrille.maucci@hp.com> wrote:
> Hey gents,
>
> I probably have a dumb question (if there are dumb questions...).
>
> I always thought that system level profiling tools/framework like perf-events or Oprofile or Caliper ... being used to profile java based applications were only good to show the high-level breakdown between CPU time exec'ed in java code and CPU time exec'ed in 'native' (JNI) code, i.e. something like
> 20% spent exec'ing JNI code vs. 80% spent in exec'ing pure java code.
>
> But if you want the breakdown of the 80% spent in java code, i.e. the perf java methods breakdown, etc.... You need to use a java profiler (Jrockit Mission Control, Jprofiler, etc...) and can't expect this information to be provided by perf-events / Oprofile / Caliper /etc...
>
> Comments ?

Tools like Oprofile and perf can collect program counter samples.  If
the JVM provides information on where native code blocks live in
memory, it is possible to map them back to the actual Java methods
that live there.  For each sample you look up the PC in the mapping
structure that the JVM has provided for the profiler.

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Profiling Java code running on Sun HotSpot JVM with linux perf
  2011-08-31  7:35 ` Stefan Hajnoczi
  2011-08-31  9:00   ` Maucci, Cyrille
@ 2011-09-01 14:58   ` Maynard Johnson
  2011-09-02 15:42     ` Geoffrey Blake
  1 sibling, 1 reply; 6+ messages in thread
From: Maynard Johnson @ 2011-09-01 14:58 UTC (permalink / raw)
  To: Geoffrey Blake; +Cc: Stefan Hajnoczi, linux-perf-users

On 08/31/2011 2:35 AM, Stefan Hajnoczi wrote:
> On Tue, Aug 30, 2011 at 9:03 PM, Geoffrey Blake
> <geoffrey.w.blake@gmail.com>  wrote:
>> Hi all,
>>
>> I am trying to profile some java server applications using %>perf
>> record -a, and as expected the majority of the execution time of these
>> applications is spent within jit'ed java code.  According to these
>> lists, the jit should be outputting a /tmp/perf-$pid.map file for each
>> thread being jit'ed.  The Sun JIT does not seem to have this output
>> enabled by default.  Does anyone here know what options I need to set
>> on the command line to get the JVM to output the symbol map files from
>> the JIT?
>
> I don't know the answer but if you don't get one here you could check
> the OProfile mailing list.  I believe there was a solution for JIT
> compilers with OProfile and people probably got popular JVMs like
> HotSpot working.  That might reveal what support HotSpot has for doing
> this.
Geoffrey,
I don't know if there's a way to get perf to show you profile information for 
Java class methods, but as Stefan said, you can indeed get this using oprofile. 
  See http://oprofile.sourceforge.net/doc/index.html and read every section with 
"JIT" in the title.

-Maynard

>
> Stefan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Profiling Java code running on Sun HotSpot JVM with linux perf
  2011-09-01 14:58   ` Maynard Johnson
@ 2011-09-02 15:42     ` Geoffrey Blake
  0 siblings, 0 replies; 6+ messages in thread
From: Geoffrey Blake @ 2011-09-02 15:42 UTC (permalink / raw)
  To: maynardj; +Cc: Stefan Hajnoczi, linux-perf-users

Thanks all for the feedback.  I have OProfile working now with the
JVMTI to get JIT symbols.

Geoff

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-02 15:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-30 20:03 Profiling Java code running on Sun HotSpot JVM with linux perf Geoffrey Blake
2011-08-31  7:35 ` Stefan Hajnoczi
2011-08-31  9:00   ` Maucci, Cyrille
2011-09-01 10:21     ` Stefan Hajnoczi
2011-09-01 14:58   ` Maynard Johnson
2011-09-02 15:42     ` Geoffrey Blake

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.