Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this plugin support multiple profilers? #72

Closed
srangwal opened this issue Apr 27, 2016 · 5 comments
Closed

Does this plugin support multiple profilers? #72

srangwal opened this issue Apr 27, 2016 · 5 comments
Milestone

Comments

@srangwal
Copy link

srangwal commented Apr 27, 2016

(NOTE: I am using 0.3.0)

From the docs it looks like it does. So when I use

profilers = [' org.openjdk.jmh.profile.GCProfiler ', ' org.openjdk.jmh.profile.StackProfiler ']

I get

java.lang.ClassNotFoundException:  org.openjdk.jmh.profile.GCProfiler -prof org.openjdk.jmh.profile.StackProfiler 
Profilers failed to initialize, exiting.

Looking at this code in JMHPluginExtension.java

   private void addOption(List<String> options, List values, String option, String separator) {
        if (values!=null) {
            options.add("-"+option);
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < values.size(); i++) {
                final Object value = values.get(i);
                sb.append(value);
                if (i<values.size()-1) {
                    sb.append(separator);
                }
            }
            options.add(sb.toString());
        }
    }

should options.add() be called for each value in the List? In addition, a space is required in the first option, (after every separator as well or should the separator include the space?) and after every value i.e.,

options.add("-" + option + " ");
.....
....
sb.append(value + " ");
@aalmiray aalmiray added this to the 0.3.1 milestone Apr 27, 2016
@vyazelenko
Copy link
Contributor

@srangwal The list of supported profilers to be specified is the same as you get when passing -lprof key to JMH. Here is the output I get on my Mac OS X:

Supported profilers:
                  cl: Classloader profiling via standard MBeans 
                comp: JIT compiler profiling via standard MBeans 
                  gc: GC profiling via standard MBeans 
               hs_cl: HotSpot (tm) classloader profiling via implementation-specific MBeans 
             hs_comp: HotSpot (tm) JIT compiler profiling via implementation-specific MBeans 
               hs_gc: HotSpot (tm) memory manager (GC) profiling via implementation-specific MBeans 
               hs_rt: HotSpot (tm) runtime profiling via implementation-specific MBeans 
              hs_thr: HotSpot (tm) threading subsystem via implementation-specific MBeans 
               stack: Simple and naive Java stack profiler 

Unsupported profilers:
                perf: <none> 
[Cannot run program "perf": error=2, No such file or directory]
             perfasm: <none> 
[Cannot run program "perf": error=2, No such file or directory]
            perfnorm: <none> 
[Cannot run program "perf": error=2, No such file or directory]
            xperfasm: <none> 
[Cannot run program "xperf": error=2, No such file or directory]

Anyway PR #74 will update documentation and list all supported profilers.

@aalmiray
Copy link
Contributor

Fixed with #74

@srangwal
Copy link
Author

My (maybe flawed) guess is that the issue is with the way the options are combined. When I use profilers = ['gc']everything works fine but when I use profilers = ['gc', 'stack'] I get the error

java.lang.ClassNotFoundException: gc-profstack

@aalmiray
Copy link
Contributor

Fixed with da68800

@srangwal
Copy link
Author

I can emulated the behaviour of the fix above with

  profilers = [' gc ', ' stack ']

notice the space before and after each profiler name

But I still get the error

java.lang.ClassNotFoundException:  gc -prof stack 

@aalmiray aalmiray reopened this Apr 28, 2016
aalmiray added a commit that referenced this issue Apr 28, 2016
Split multiple profiles into distinct arg entries. Fixes #72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants