diff options
Diffstat (limited to 'tests')
7 files changed, 69 insertions, 53 deletions
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java index 4ed42b4..0dceafe 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java @@ -95,8 +95,10 @@ public class RsBench extends Activity { switch (item.getItemId()) { case R.id.benchmark_all: mView.setBenchmarkMode(-1); + mView.suspendRendering(false); return true; case R.id.benchmark_one: + mView.suspendRendering(true); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Pick a Test"); builder.setItems(mView.getTestNames(), @@ -106,11 +108,13 @@ public class RsBench extends Activity { "Starting to benchmark: " + mView.getTestNames()[item], Toast.LENGTH_SHORT).show(); mView.setBenchmarkMode(item); + mView.suspendRendering(false); } }); builder.show(); return true; case R.id.debug_mode: + mView.suspendRendering(true); AlertDialog.Builder debugBuilder = new AlertDialog.Builder(this); debugBuilder.setTitle("Pick a Test"); debugBuilder.setItems(mView.getTestNames(), @@ -120,6 +124,7 @@ public class RsBench extends Activity { "Switching to: " + mView.getTestNames()[item], Toast.LENGTH_SHORT).show(); mView.setDebugMode(item); + mView.suspendRendering(false); } }); debugBuilder.show(); diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java index 8c67026..4ac7dd5 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java @@ -266,6 +266,10 @@ public class RsBenchRS { mScript.invoke_setBenchmarkMode(benchNum); } + public void pause(boolean pause) { + mScript.set_gPauseRendering(pause); + } + private void initRS() { mScript = new ScriptC_rsbench(mRS, mRes, R.raw.rsbench); diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java index 004e6bf..124071e 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java @@ -92,6 +92,10 @@ public class RsBenchView extends RSSurfaceView { mRender.setBenchmarkMode(benchNum); } + void suspendRendering(boolean pause) { + mRender.pause(pause); + } + void setDebugMode(int num) { mRender.setDebugMode(num); } diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs index cb15449..27e5b11 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs @@ -51,6 +51,7 @@ typedef struct TestScripts_s { TestScripts *gTestScripts; bool gLoadComplete = false; +bool gPauseRendering = false; static float gDt = 0; @@ -257,6 +258,10 @@ int root(void) { return 1; } + if (gPauseRendering) { + rsgDrawText("Paused", 50, 50); + return 30; + } if (gIsDebugMode) { debug(); } else { diff --git a/tests/TileBenchmark/res/layout/main.xml b/tests/TileBenchmark/res/layout/main.xml index 577c466..1b39d5d 100644 --- a/tests/TileBenchmark/res/layout/main.xml +++ b/tests/TileBenchmark/res/layout/main.xml @@ -18,46 +18,52 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - <LinearLayout - android:id="@+id/top" - android:layout_width="match_parent" + <HorizontalScrollView + android:id="@+id/horizontalScrollView" + android:layout_width="wrap_content" android:layout_height="wrap_content" > - <Spinner - android:id="@+id/movement" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:prompt="@string/movement_method" - /> - <Spinner - android:id="@+id/velocity" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:gravity="center_horizontal" - android:prompt="@string/desired_scroll_velocity" - /> - <ToggleButton - android:id="@+id/capture" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textOn="@string/capture_stop" - android:textOff="@string/capture_start" - /> - <EditText - android:id="@+id/url" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:inputType="textUri" - android:imeOptions="actionGo" - android:layout_weight="1" - /> - <Button - android:id="@+id/inspect" - android:layout_width="wrap_content" + <LinearLayout + android:id="@+id/top" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/inspect_log" - /> - </LinearLayout> + > + <Spinner + android:id="@+id/movement" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:prompt="@string/movement_method" + /> + <Spinner + android:id="@+id/velocity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:prompt="@string/desired_scroll_velocity" + /> + <ToggleButton + android:id="@+id/capture" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textOn="@string/capture_stop" + android:textOff="@string/capture_start" + /> + <EditText + android:id="@+id/url" + android:layout_width="400dp" + android:layout_height="wrap_content" + android:inputType="textUri" + android:imeOptions="actionGo|flagNoExtractUi" + android:layout_weight="1" + /> + <Button + android:id="@+id/inspect" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/inspect_log" + /> + </LinearLayout> + </HorizontalScrollView> <com.test.tilebenchmark.ProfiledWebView android:id="@+id/web" android:layout_width="match_parent" diff --git a/tests/TileBenchmark/src/com/test/tilebenchmark/ProfileActivity.java b/tests/TileBenchmark/src/com/test/tilebenchmark/ProfileActivity.java index e7a21ad..d38d006 100644 --- a/tests/TileBenchmark/src/com/test/tilebenchmark/ProfileActivity.java +++ b/tests/TileBenchmark/src/com/test/tilebenchmark/ProfileActivity.java @@ -276,6 +276,7 @@ public class ProfileActivity extends Activity { settings.setEnableSmoothTransition(true); settings.setBuiltInZoomControls(true); settings.setLoadWithOverviewMode(true); + settings.setProperty("use_minimal_memory", "false"); // prefetch tiles, as browser does mWeb.setWebViewClient(new LoggingWebViewClient()); // URL text entry diff --git a/tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java b/tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java index 10802b4..83f1668 100644 --- a/tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java +++ b/tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java @@ -33,8 +33,7 @@ public class ProfiledWebView extends WebView { private ProfileCallback mCallback; private long mContentInvalMillis; private boolean mHadToBeForced = false; - private int mTestCount = 0; - private static final int LOAD_STALL_MILLIS = 5000; // nr of millis after load, + private static final int LOAD_STALL_MILLIS = 2000; // nr of millis after load, // before test is forced public ProfiledWebView(Context context) { @@ -76,13 +75,6 @@ public class ProfiledWebView extends WebView { mIsScrolling = autoScrolling; mCallback = callback; mIsTesting = false; - mContentInvalMillis = System.currentTimeMillis(); - registerPageSwapCallback(); - contentInvalidateAll(); - invalidate(); - - mTestCount++; - final int testCount = mTestCount; if (autoScrolling) { // after a while, force it to start even if the pages haven't swapped @@ -93,13 +85,12 @@ public class ProfiledWebView extends WebView { @Override public void onFinish() { - if (testCount == mTestCount && !mIsTesting) { - mHadToBeForced = true; - Log.d("ProfiledWebView", "num " + testCount - + " forcing a page swap with a scroll..."); - scrollBy(0, 1); - invalidate(); // ensure a redraw so that auto-scrolling can occur - } + // invalidate all content, and kick off redraw + registerPageSwapCallback(); + discardAllTextures(); + invalidate(); + + mContentInvalMillis = System.currentTimeMillis(); } }.start(); } |