Java Code Examples for org.openjdk.jmh.util.Utils

The following examples show how to use org.openjdk.jmh.util.Utils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-cloud-sleuth   Source File: ProcessLauncherState.java    License: Apache License 2.0 6 votes vote down vote up
public void run() throws Exception {
	List<String> args = new ArrayList<>(this.args);
	args.add(args.size() - this.length, this.mainClass);
	if (extraArgs != null) {
		args.addAll(extraArgs);
	}
	ProcessBuilder builder = new ProcessBuilder(args);
	builder.directory(home);
	builder.redirectErrorStream(true);
	customize(builder);
	if (!"false".equals(System.getProperty("debug", "false"))) {
		System.err.println("Running: " + Utils.join(args, " "));
	}
	started = builder.start();
	monitor();
}
 
Example 2
Source Project: unsafe   Source File: MemoryUtils.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public static List<String> buildJavaArg() {
  List<String> command = new ArrayList<String>();

  command.add(Utils.getCurrentJvm());
  command.add("-cp");

  if (Utils.isWindows()) {
    command.add('"' + System.getProperty("java.class.path") + '"');
  } else {
    command.add(System.getProperty("java.class.path"));
  }

  command.add(MemoryTest.class.getName());

  return command;
}
 
Example 3
Source Project: spring-cloud-sleuth   Source File: ProcessLauncherState.java    License: Apache License 2.0 5 votes vote down vote up
public Collection<String> capture(String... additional) throws Exception {
	List<String> args = new ArrayList<>(this.args);
	args.addAll(Arrays.asList(additional));
	ProcessBuilder builder = new ProcessBuilder(args);
	builder.directory(home);
	builder.redirectErrorStream(true);
	customize(builder);
	if (!"false".equals(System.getProperty("debug", "false"))) {
		System.err.println("Running: " + Utils.join(args, " "));
	}
	started = builder.start();
	return FileUtils.readAllLines(started.getInputStream());
}
 
Example 4
Source Project: cache2k-benchmark   Source File: ForcedGcMemoryProfiler.java    License: Apache License 2.0 5 votes vote down vote up
public static String getJmapExcutable() {
  String javaHome = System.getProperty("java.home");
  String jreDir = File.separator + "jre";
  if (javaHome.endsWith(jreDir)) {
    javaHome = javaHome.substring(0, javaHome.length() - jreDir.length());
  }
  return (javaHome +
          File.separator +
          "bin" +
          File.separator +
          "jmap" +
          (Utils.isWindows() ? ".exe" : ""));
}