org.openjdk.jmh.util.Utils Java Examples

The following examples show how to use org.openjdk.jmh.util.Utils. 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 File: ProcessLauncherState.java    From spring-cloud-sleuth with 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 File: MemoryUtils.java    From unsafe with 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 File: ProcessLauncherState.java    From spring-cloud-sleuth with 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 File: ForcedGcMemoryProfiler.java    From cache2k-benchmark with 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" : ""));
}