package org.linaro.iasenov.benchmarkframework; import android.util.Log; import java.io.PrintStream; import art_benchmarks.jit_aot.Invoke; import art_benchmarks.jit_aot.LoadCheck; /** * Created by iasenov on 9/21/16. */ public class Test12 extends BaseBenchmark{ private String TAG = "Jit-out(ART)"; static boolean isJavaCanceled = false; public String startBenchmark(int count) { isJavaCanceled = false; version = " Jit-out "; benchmarkName = "Test12"; integrationType = "SL"; chartName = "Jit-out(ART)"; long before; long after; clear(); //****Redirect System.out and Syste.err**** PrintStream stdOut = System.out; PrintStream stdErrt = System.err; PrintStream interceptor_stdout = new Interceptor(stdOut); PrintStream interceptor_err = new Interceptor(stdErrt); System.setOut(interceptor_stdout);// just add the interceptor System.setErr(interceptor_err);// just add the interceptor //****Redirect System.out and Syste.err**** startTest = System.currentTimeMillis(); if(isJavaCanceled) return ""; //***********Invoke************* int rc = 0; Invoke obj = new Invoke(); before = System.currentTimeMillis(); obj.timeRecursionInvokeVirtual(1000); obj.timeRecursionInvokeStatic(1000); obj.timeRecursionInvokeFinal(1000); obj.timeRecursionInvokePrivate(1000); after = System.currentTimeMillis(); if (!obj.verify()) { rc++; } System.out.println("art_benchmarks/jit_aot/Invoke: " + (after - before)); //System.exit(rc); //***********Invoke************* if(isJavaCanceled) return ""; //***********LoadCheck************* rc = 0; LoadCheck obj1 = new LoadCheck(); before = System.currentTimeMillis(); obj1.timeRandomSumInvokeStaticMethod(10000); obj1.timeRandomSumInvokeUserClass(10000); after = System.currentTimeMillis(); if (!obj1.verify()) { rc++; } System.out.println("art_benchmarks/jit_aot/LoadCheck: " + (after - before)); //System.exit(rc); //***********LoadCheck************* xout[2] = Interceptor.outputTxt; Interceptor.clear(); endTest = System.currentTimeMillis(); sendElapsedTimeToChart(); submitElapsedTime(endTest-startTest); return benchmarkName + ":" + getBenchmarkResult(5, integrationType); } public boolean stopBenchmark(){ isJavaCanceled = true; Log.i(TAG, "stopBenchmark: isJNICanceled"); return true; } }