package org.greencheek.spray.cache.memcached.perf.benchmarks;

/**
 * Created by dominictootell on 07/06/2014.
 */
public class JvmArgs {
    private final static String JFR_JVM_ARGS ="-server -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,settings=profile,filename=target/recording.jfr";
    private final static String JVM_ARGS ="-server";

    public static String getJvmArgs() {
        String profile = System.getProperty("enablejfr","true");
        boolean flightRecorderEnabled;
        if(profile==null || profile.trim().length()==0) {
            flightRecorderEnabled = true;
        } else {
            if(profile.equalsIgnoreCase("true")) {
                flightRecorderEnabled = true;
            } else {
                flightRecorderEnabled = false;
            }
        }
        return flightRecorderEnabled ? JFR_JVM_ARGS : JVM_ARGS;
    }

}

@@ -162,16 +162,18 @@
 c String
+%5B%5D
  JFR_JVM
@@ -179,24 +179,38 @@
 M_ARGS =
+ new String%5B%5D%7B
 %22-server
  -XX:+Un
@@ -201,17 +201,19 @@
 %22-server
- 
+%22,%22
 -XX:+Unl
@@ -233,17 +233,19 @@
 Features
- 
+%22,%22
 -XX:+Fli
@@ -255,17 +255,19 @@
 Recorder
- 
+%22,%22
 -XX:Flig
@@ -353,16 +353,17 @@
 ing.jfr%22
+%7D
 ;%0A    pr
@@ -387,16 +387,18 @@
 c String
+%5B%5D
  JVM_ARG
@@ -400,16 +400,30 @@
 M_ARGS =
+ new String%5B%5D%7B
 %22-server
@@ -423,16 +423,17 @@
 -server%22
+%7D
 ;%0A%0A    p
@@ -451,16 +451,18 @@
 c String
+%5B%5D
  getJvmA

add jfr args