summaryrefslogtreecommitdiff
path: root/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test12.java
blob: 3d5ddc3c99a44d161648494dda5b912c291dd669 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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;
    }
}