diff options
author | Eric Holk <eholk@google.com> | 2019-11-13 15:24:40 -0800 |
---|---|---|
committer | Eric Holk <eholk@google.com> | 2019-11-14 17:29:08 +0000 |
commit | afb9b08dd8db25026f29b4882b885fea13979b70 (patch) | |
tree | 9e4f2dea2125cb56c1f0a3bd0e3632b153d4938c | |
parent | c4584294e5b2e00c92db8a05273e888ee93ee2ef (diff) |
Refactor interactive microbenchmarks
Replaces the SystemServer Benchmark activity with one that has
several sets of benchmarks grouped into categories. This will make it
easier to add more benchmarks that do not logically fit with the
categories we already have.
This does not remove any of the other benchmark activities, but in a
follow up CL, we should remove those since they are covered by the
Interactive Microbenchmarks activity.
This also does not adjust the non-interactive mode, which should also
happen in a followup.
Change-Id: I1d079362df0d32642525ede5b41779d76a5735ec
-rw-r--r-- | startop/apps/test/Android.bp | 4 | ||||
-rw-r--r-- | startop/apps/test/AndroidManifest.xml | 8 | ||||
-rw-r--r-- | startop/apps/test/src/CPUIntensiveBenchmarkActivity.java | 2 | ||||
-rw-r--r-- | startop/apps/test/src/InitCheckOverheadBenchmarkActivity.java | 2 | ||||
-rw-r--r-- | startop/apps/test/src/InteractiveMicrobenchmarkActivity.java (renamed from startop/apps/test/src/SystemServerBenchmarkActivity.java) | 25 | ||||
-rw-r--r-- | startop/apps/test/src/NonInteractiveMicrobenchmarkActivity.java (renamed from startop/apps/test/src/NonInteractiveSystemServerBenchmarkActivity.java) | 2 | ||||
-rw-r--r-- | startop/apps/test/src/SystemServerBenchmarks.java | 3 |
7 files changed, 33 insertions, 13 deletions
diff --git a/startop/apps/test/Android.bp b/startop/apps/test/Android.bp index 3f20273a8d61..c7c70db60a72 100644 --- a/startop/apps/test/Android.bp +++ b/startop/apps/test/Android.bp @@ -25,8 +25,8 @@ android_app { "src/InitCheckOverheadBenchmarkActivity.java", "src/InitCheckOverheadBenchmarks.java", "src/LayoutInflationActivity.java", - "src/NonInteractiveSystemServerBenchmarkActivity.java", - "src/SystemServerBenchmarkActivity.java", + "src/NonInteractiveMicrobenchmarkActivity.java", + "src/InteractiveMicrobenchmarkActivity.java", "src/SystemServerBenchmarks.java", "src/TextViewInflationActivity.java", ], diff --git a/startop/apps/test/AndroidManifest.xml b/startop/apps/test/AndroidManifest.xml index 235aa0d25e86..adaab61778ed 100644 --- a/startop/apps/test/AndroidManifest.xml +++ b/startop/apps/test/AndroidManifest.xml @@ -97,8 +97,8 @@ </activity> <activity - android:label="SystemServer Benchmark" - android:name=".SystemServerBenchmarkActivity" + android:label="Interactive Microbenchmarks" + android:name=".InteractiveMicrobenchmarkActivity" android:exported="true" > <intent-filter> @@ -109,8 +109,8 @@ </activity> <activity - android:label="Non-interactive SystemServer Benchmark" - android:name=".NonInteractiveSystemServerBenchmarkActivity" + android:label="Non-interactive Microbenchmarks" + android:name=".NonInteractiveMicrobenchmarkActivity" android:exported="true" /> </application> diff --git a/startop/apps/test/src/CPUIntensiveBenchmarkActivity.java b/startop/apps/test/src/CPUIntensiveBenchmarkActivity.java index 2ec5308afe14..db3234a72129 100644 --- a/startop/apps/test/src/CPUIntensiveBenchmarkActivity.java +++ b/startop/apps/test/src/CPUIntensiveBenchmarkActivity.java @@ -18,7 +18,7 @@ package com.android.startop.test; import android.os.Bundle; -public class CPUIntensiveBenchmarkActivity extends SystemServerBenchmarkActivity { +public class CPUIntensiveBenchmarkActivity extends InteractiveMicrobenchmarkActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.system_server_benchmark_page); diff --git a/startop/apps/test/src/InitCheckOverheadBenchmarkActivity.java b/startop/apps/test/src/InitCheckOverheadBenchmarkActivity.java index 3e0e3b113a29..92d8638092d3 100644 --- a/startop/apps/test/src/InitCheckOverheadBenchmarkActivity.java +++ b/startop/apps/test/src/InitCheckOverheadBenchmarkActivity.java @@ -18,7 +18,7 @@ package com.android.startop.test; import android.os.Bundle; -public class InitCheckOverheadBenchmarkActivity extends SystemServerBenchmarkActivity { +public class InitCheckOverheadBenchmarkActivity extends InteractiveMicrobenchmarkActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.system_server_benchmark_page); diff --git a/startop/apps/test/src/SystemServerBenchmarkActivity.java b/startop/apps/test/src/InteractiveMicrobenchmarkActivity.java index 6be8df3728af..8ed7f6ae2109 100644 --- a/startop/apps/test/src/SystemServerBenchmarkActivity.java +++ b/startop/apps/test/src/InteractiveMicrobenchmarkActivity.java @@ -18,12 +18,13 @@ package com.android.startop.test; import android.app.Activity; import android.content.Context; +import android.graphics.Typeface; import android.os.Bundle; import android.widget.Button; import android.widget.GridLayout; import android.widget.TextView; -public class SystemServerBenchmarkActivity extends Activity implements BenchmarkRunner { +public class InteractiveMicrobenchmarkActivity extends Activity implements BenchmarkRunner { protected GridLayout mBenchmarkList; protected void onCreate(Bundle savedInstanceState) { @@ -32,10 +33,32 @@ public class SystemServerBenchmarkActivity extends Activity implements Benchmark mBenchmarkList = findViewById(R.id.benchmark_list); + addBenchmark("Empty", () -> { + }); + addHeader("Application Benchmarks"); + CPUIntensiveBenchmarks.initializeBenchmarks(this, this); + addHeader("Init Check Overhead Benchmarks"); + InitCheckOverheadBenchmarks.initializeBenchmarks(this, this); + addHeader("System Server Benchmarks"); SystemServerBenchmarks.initializeBenchmarks(this, this); } /** + * Add a heading for a group of related benchmarks + * + * @param name The name of this group of benchmarks + */ + public void addHeader(CharSequence name) { + Context context = mBenchmarkList.getContext(); + TextView header = new TextView(context); + header.setText(name); + header.setTypeface(header.getTypeface(), Typeface.BOLD); + GridLayout.LayoutParams params = new GridLayout.LayoutParams(); + params.columnSpec = GridLayout.spec(0, 3); + mBenchmarkList.addView(header, params); + } + + /** * Adds a benchmark to the set to run. * * @param name A short name that shows up in the UI or benchmark results diff --git a/startop/apps/test/src/NonInteractiveSystemServerBenchmarkActivity.java b/startop/apps/test/src/NonInteractiveMicrobenchmarkActivity.java index a2dc2cf03d69..0162ac6c5d81 100644 --- a/startop/apps/test/src/NonInteractiveSystemServerBenchmarkActivity.java +++ b/startop/apps/test/src/NonInteractiveMicrobenchmarkActivity.java @@ -36,7 +36,7 @@ import android.widget.Button; import android.widget.GridLayout; import android.widget.TextView; -public class NonInteractiveSystemServerBenchmarkActivity extends Activity { +public class NonInteractiveMicrobenchmarkActivity extends Activity { ArrayList<CharSequence> benchmarkNames = new ArrayList(); ArrayList<Runnable> benchmarkThunks = new ArrayList(); diff --git a/startop/apps/test/src/SystemServerBenchmarks.java b/startop/apps/test/src/SystemServerBenchmarks.java index 25b43f4d53f6..8114bc225c23 100644 --- a/startop/apps/test/src/SystemServerBenchmarks.java +++ b/startop/apps/test/src/SystemServerBenchmarks.java @@ -57,9 +57,6 @@ class SystemServerBenchmarks { static void initializeBenchmarks(Activity parent, BenchmarkRunner benchmarks) { final String packageName = parent.getPackageName(); - benchmarks.addBenchmark("Empty", () -> { - }); - PackageManager pm = parent.getPackageManager(); benchmarks.addBenchmark("getInstalledApplications", () -> { pm.getInstalledApplications(PackageManager.MATCH_SYSTEM_ONLY); |