Skip to content

Commit 6d617c2

Browse files
Jason SamsAndroid (Google) Code Review
authored andcommitted
Merge "Stabilize perf data." into jb-mr1-dev
2 parents 3e777c7 + 76fb297 commit 6d617c2

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
@@ -296,14 +296,14 @@ private static Bitmap copyBitmap(Bitmap source) {
296296

297297
// button hook
298298
public void benchmark(View v) {
299-
long t = getBenchmark();
299+
float t = getBenchmark();
300300
//long javaTime = javaFilter();
301301
//mBenchmarkResult.setText("RS: " + t + " ms Java: " + javaTime + " ms");
302302
mBenchmarkResult.setText("Result: " + t + " ms");
303303
}
304304

305305
// For benchmark test
306-
public long getBenchmark() {
306+
public float getBenchmark() {
307307
mDoingBenchmark = true;
308308

309309
mTest.setupBenchmark();
@@ -319,14 +319,18 @@ public long getBenchmark() {
319319

320320
Log.v(TAG, "Benchmarking");
321321
t = java.lang.System.currentTimeMillis();
322-
mTest.runTest();
322+
for (int i=0; i<10; i++) {
323+
mTest.runTest();
324+
}
323325
mTest.finish();
324326
t = java.lang.System.currentTimeMillis() - t;
327+
float ft = (float)t;
328+
ft /= 10;
325329

326-
Log.v(TAG, "getBenchmark: Renderscript frame time core ms " + t);
330+
Log.v(TAG, "getBenchmark: Renderscript frame time core ms " + ft);
327331
mTest.exitBenchmark();
328332
mDoingBenchmark = false;
329333

330-
return t;
334+
return ft;
331335
}
332336
}

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)