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

import android.content.Intent;
import android.util.Log;

import graphics_benchmarks.graphics.DrawArc;


/**
 * Created by iasenov on 10/10/16.
 */
public class Test16 extends BaseBenchmark{

    private String TAG = "DrawArc(GPU)";
    static boolean  isJavaCanceled = false;

    public String startBenchmark(int count) {

        isJavaCanceled = false;

        version = " DrawArc(GPU) ";
        benchmarkName = "Test16";
        integrationType = "SL";
        chartName = "DrawArc(GPU)";


        clear();


        startTest = 0;//System.currentTimeMillis();

        MainActivity.LOCK.setCondition(false);

        Intent i = new Intent(MainActivity.mActivity, DrawArc.class);
        i.putExtra(MainActivity.GRAPHICS_ROUND, 500);
        MainActivity.mActivity.startActivityForResult(i, 100);

        synchronized (MainActivity.LOCK) {
            while (!MainActivity.LOCK.conditionMet()) {
                try {
                    MainActivity.LOCK.wait();
                    Log.i(TAG, "waiting is finished");
                } catch (InterruptedException e) {
                    Log.e(TAG, "Exception when waiting for condition", e);
                }
            }
        }


        float second = (elapsedFromActivityTest / 1000f);
        float fps = (float) mRound / second; // milliseconds to seconds

        xout[2] = "Round = " + mRound +"    fps = " + fps + "\n" + Interceptor.outputTxt;
        Interceptor.clear();

        endTest = elapsedFromActivityTest;//System.currentTimeMillis();

        sendElapsedTimeToChart();

        submitElapsedTime(endTest - startTest);

        //Log.i(TAG, "return");

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

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