Skip to content

Commit 76fb297

Browse files
author
Jason Sams
committed
Stabilize perf data.
Change-Id: I75fb31b1bb6e6a7a5a82b86fd4a6639dd328ceaa
1 parent bac6c12 commit 76fb297

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,14 @@ private static Bitmap copyBitmap(Bitmap source) {
280280

281281
// button hook
282282
public void benchmark(View v) {
283-
long t = getBenchmark();
283+
float t = getBenchmark();
284284
//long javaTime = javaFilter();
285285
//mBenchmarkResult.setText("RS: " + t + " ms Java: " + javaTime + " ms");
286286
mBenchmarkResult.setText("Result: " + t + " ms");
287287
}
288288

289289
// For benchmark test
290-
public long getBenchmark() {
290+
public float getBenchmark() {
291291
mDoingBenchmark = true;
292292

293293
mTest.setupBenchmark();
@@ -303,14 +303,18 @@ public long getBenchmark() {
303303

304304
Log.v(TAG, "Benchmarking");
305305
t = java.lang.System.currentTimeMillis();
306-
mTest.runTest();
306+
for (int i=0; i<10; i++) {
307+
mTest.runTest();
308+
}
307309
mTest.finish();
308310
t = java.lang.System.currentTimeMillis() - t;
311+
float ft = (float)t;
312+
ft /= 10;
309313

310-
Log.v(TAG, "getBenchmark: Renderscript frame time core ms " + t);
314+
Log.v(TAG, "getBenchmark: Renderscript frame time core ms " + ft);
311315
mTest.exitBenchmark();
312316
mDoingBenchmark = false;
313317

314-
return t;
318+
return ft;
315319
}
316320
}

tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void testImageProcessingBench() {
7878
BufferedWriter rsWriter = new BufferedWriter(new FileWriter(resultFile));
7979
Log.v(TAG, "Saved results in: " + resultFile.getAbsolutePath());
8080
for (int i = 0; i < ITERATION; i++ ) {
81-
t = mAct.getBenchmark();
81+
t = (long)mAct.getBenchmark();
8282
sum += t;
8383
rsWriter.write("Renderscript frame time core: " + t + " ms\n");
8484
Log.v(TAG, "RenderScript framew time core: " + t + " ms");

tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ rs_allocation gIn;
2525
float gCoeffs[9];
2626

2727
void root(uchar4 *out, uint32_t x, uint32_t y) {
28-
uint32_t x1 = min((int32_t)x+1, gWidth);
28+
uint32_t x1 = min((int32_t)x+1, gWidth-1);
2929
uint32_t x2 = max((int32_t)x-1, 0);
30-
uint32_t y1 = min((int32_t)y+1, gHeight);
30+
uint32_t y1 = min((int32_t)y+1, gHeight-1);
3131
uint32_t y2 = max((int32_t)y-1, 0);
3232

3333
float4 p00 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x1, y1))[0]);

0 commit comments

Comments
 (0)