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

import android.util.Log;

/**
 * Created by iasenov on 8/22/16.
 */
public class Test2 extends BaseBenchmark{

    public native String  stringFromJNI(int size1);

    private int runs = 10; // 2 * 4 DP MW arrays = 2 * 32 MB

    private String TAG = "RandMem";

    static boolean  isJNICanceled = false;

    public String startBenchmark(int count)
    {
        isJNICanceled = false;

        version = " Android RandMem Benchmark 1.1 ";
        benchmarkName = "Test2";
        integrationType = "SL";
        chartName = "RandMem";

        clear();

        xout[2]  = "    MBytes/Second Transferring 4 Byte Words  \n";
        xout[3]  = "   Memory     Serial.......     Random.......\n";
        xout[4]  = "   KBytes     Read   Rd/Wrt     Read   Rd/Wrt\n";

        startTest = System.currentTimeMillis();

        for (int size1=0; size1<runs; size1++)
        {
            if(isJNICanceled){
                break;
            }

            xout[size1+5] = stringFromJNI(size1);
        }

        endTest = System.currentTimeMillis();

        sendElapsedTimeToChart();

        submitElapsedTime(endTest-startTest);

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

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