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

import android.content.ContentValues;
import android.content.Context;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;

import java.io.File;

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

    private String TAG = "Smallpt";

    public String startBenchmark(int count)
    {
        version = " Smallpt";
        benchmarkName = "Test32";
        executable_name = "smallpt";
        integrationType = "EX";
        chartName = "Smallpt";



        clear();

        startTest = System.currentTimeMillis();

        String param = "";

        TESTCOMMANDS = getCommands(executable_name, benchmarkName);

        xout[2] = copyAssetsExecFileAndRun(executable_name, TESTCOMMANDS);

        endTest = System.currentTimeMillis();

        sendElapsedTimeToChart();

        submitElapsedTime(endTest-startTest);

        //Get produced image file
        File img = new File(MainActivity.EXECUTABLE_PATH, "image.ppm");

        if(img.exists()){

            /*
            // make sure your target location folder exists!
            File targetLocation = new File (getGalleryPath() + "iii.ppm");

            if(img.renameTo(targetLocation)){
                Log.v(TAG, "Move file successful.");
            }else{
                Log.v(TAG, "Move file failed.");
                Log.v(TAG, img.getAbsolutePath() +"-->"+targetLocation.getAbsolutePath());
            }

            */

            Log.i(TAG, "image.ppm was deleted");
            img.delete();
        }

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

    public boolean stopBenchmark(){
        process_exec.destroy();
        Log.i(TAG, "Destroy Process:" + process_exec.toString());
        return true;
    }

    private static String getGalleryPath() {
        return Environment.getExternalStorageDirectory() + "/" + Environment.DIRECTORY_DCIM + "/";
    }

}