FileDocCategorySizeDatePackage
ComputePerf.javaAPI DocAndroid 5.1 API1923Thu Mar 12 22:22:54 GMT 2015com.example.android.rs.computeperf

ComputePerf

public class ComputePerf extends android.app.Activity

Fields Summary
private LaunchTest
mLT
private Mandelbrot
mMandel
private android.renderscript.RenderScript
mRS
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle savedInstanceState)

        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        final int numTries = 100;

        long timesXLW = 0;
        long timesXYW = 0;

        mRS = RenderScript.create(this);
        mLT = new LaunchTest(mRS, getResources());
        mLT.XLW();
        mLT.XYW();
        for (int i = 0; i < numTries; i++) {
            timesXLW += mLT.XLW();
            timesXYW += mLT.XYW();
        }

        timesXLW /= numTries;
        timesXYW /= numTries;

        // XLW and XYW running times should match pretty closely
        Log.v("ComputePerf", "xlw launch test " + timesXLW + "ms");
        Log.v("ComputePerf", "xyw launch test " + timesXYW + "ms");

        mMandel = new Mandelbrot(mRS, getResources());
        mMandel.run();