There are two distinct issues when trying to collect a profile of a Java application if operf is used with either the '--pid' option or the '--system-wide' option:
1) To stop operf in either case, the user must do a ctrl-C (or 'kill -SIGINT <operf_pid>'. If not using '--lazy-conversion', the operf.cpp:convert_sample_data function is run in a child process that does not have a SIGINT handler set up for it while reading sample data from the pipe (which is being written to by the operf-record process). The end result is that the operf-read process is interrupted and stopped by the unhandled ctrl-C before it gets a chance to run opjitconv.
2) When passing the 'java' command directly to operf, samples are nicely collected for all of the threads created by the JVM. However, if the Java app is already running when the user starts operf with either '--pid' or '--system-wide' option, zero samples are collected on the child threads of the JVM. Note: The user program that is JITed by the JVM is executed by a child thread.
Note: Another (minor) side effect of issue #1 above is that there may be sample data left un-read in the pipe, and the type of app being profiled (Java or not) is irrelevant.
I have a fix for issue #1 above, and I'll attach the patch.
Log in to post a comment.