summaryrefslogtreecommitdiff
path: root/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test13.java
blob: 660b99f49df85694690e4582fcbb4551a35fe4cd (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
package org.linaro.iasenov.benchmarkframework;

import android.util.Log;

import java.io.PrintStream;

import art_benchmarks.math.AccessNBody;
import art_benchmarks.math.MathCordic;
import art_benchmarks.math.MathPartialSums;
import art_benchmarks.math.MathSpectralNorm;

/**
 * Created by iasenov on 9/21/16.
 */
public class Test13 extends BaseBenchmark{

    private String TAG = "Math(ART)";
    static boolean  isJavaCanceled = false;

    public String startBenchmark(int count) {

        isJavaCanceled = false;

        version = " Math(ART) ";
        benchmarkName = "Test13";
        integrationType = "SL";

        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 "";
        //***********AccessNBody*************
        AccessNBody obj = new AccessNBody();
        before = System.currentTimeMillis();
        obj.timeAccessNBody(200);
        after = System.currentTimeMillis();
        obj.verify();
        System.out.println("art_benchmarks/math/AccessNBody: " + (after - before));
        //***********AccessNBody*************

        if(isJavaCanceled) return "";
        //***********MathCordic*************
        MathCordic obj1 = new MathCordic();
        before = System.currentTimeMillis();
        obj1.timeMathCordic(175);
        after = System.currentTimeMillis();
        obj1.verify();
        System.out.println("art_benchmarks/math/MathCordic: " + (after - before));
        //***********MathCordic*************

        if(isJavaCanceled) return "";
        //***********MathPartialSums*************
        MathPartialSums obj2 = new MathPartialSums();
        before = System.currentTimeMillis();
        obj2.timeMathPartialSums(140);
        after = System.currentTimeMillis();
        obj2.verify();
        System.out.println("art_benchmarks/math/MathPartial: " + (after - before));
        //***********MathPartialSums*************

        if(isJavaCanceled) return "";
        //***********MathSpectralNorm*************
        MathSpectralNorm obj3 = new MathSpectralNorm();
        before = System.currentTimeMillis();
        obj3.timeMathSpectralNorm(360);
        after = System.currentTimeMillis();
        obj3.verify();
        System.out.println("art_benchmarks/math/MathSpectralNorm: " + (after - before));
        //***********MathSpectralNorm*************



        xout[2] = Interceptor.outputTxt;
        Interceptor.clear();

        endTest = System.currentTimeMillis();

        return benchmarkName + ":" + getBenchmarkResult(5, integrationType);
    }

    public boolean stopBenchmark(){
        isJavaCanceled = true;
        Log.i(TAG, "stopBenchmark: isJNICanceled");
        return true;
    }
}