summaryrefslogtreecommitdiffstats
path: root/test-runner
diff options
context:
space:
mode:
authorJack Wang <jackwang@google.com>2009-10-30 17:07:21 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-10-30 17:07:21 -0700
commit1d225d67d94049151fef90bc431dcd5def9e948a (patch)
tree9547eab544673284fa10f27ca1000ace7fa7869a /test-runner
parent0fc2131aa2a164288adcc6f3ec9e0fe88494fd93 (diff)
parente8228afb2bd005ae25ce58719f9d678389b26a16 (diff)
downloadframeworks_base-1d225d67d94049151fef90bc431dcd5def9e948a.zip
frameworks_base-1d225d67d94049151fef90bc431dcd5def9e948a.tar.gz
frameworks_base-1d225d67d94049151fef90bc431dcd5def9e948a.tar.bz2
am e8228afb: Merge change I92cdc5ed into eclair
Merge commit 'e8228afb2bd005ae25ce58719f9d678389b26a16' into eclair-plus-aosp * commit 'e8228afb2bd005ae25ce58719f9d678389b26a16': PerformanceCollector: Collect & report perf measurements in key/value form
Diffstat (limited to 'test-runner')
-rw-r--r--test-runner/android/test/InstrumentationTestRunner.java29
1 files changed, 22 insertions, 7 deletions
diff --git a/test-runner/android/test/InstrumentationTestRunner.java b/test-runner/android/test/InstrumentationTestRunner.java
index b9978d6..773d7a9 100644
--- a/test-runner/android/test/InstrumentationTestRunner.java
+++ b/test-runner/android/test/InstrumentationTestRunner.java
@@ -227,17 +227,22 @@ public class InstrumentationTestRunner extends Instrumentation implements TestSu
*/
private static final String REPORT_KEY_COVERAGE_PATH = "coverageFilePath";
/**
+ * If included at the start of reporting keys, this prefix marks the key as a performance
+ * metric.
+ */
+ private static final String REPORT_KEY_PREFIX = "performance.";
+ /**
* If included in the status or final bundle sent to an IInstrumentationWatcher, this key
* reports the cpu time in milliseconds of the current test.
*/
private static final String REPORT_KEY_PERF_CPU_TIME =
- "performance." + PerformanceCollector.METRIC_KEY_CPU_TIME;
+ REPORT_KEY_PREFIX + PerformanceCollector.METRIC_KEY_CPU_TIME;
/**
* If included in the status or final bundle sent to an IInstrumentationWatcher, this key
* reports the run time in milliseconds of the current test.
*/
private static final String REPORT_KEY_PERF_EXECUTION_TIME =
- "performance." + PerformanceCollector.METRIC_KEY_EXECUTION_TIME;
+ REPORT_KEY_PREFIX + PerformanceCollector.METRIC_KEY_EXECUTION_TIME;
/**
* The test is starting.
@@ -739,11 +744,9 @@ public class InstrumentationTestRunner extends Instrumentation implements TestSu
}
public void writeEndSnapshot(Bundle results) {
- // Copy all snapshot data fields as type long into mResults, which
- // is outputted via Instrumentation.finish
- for (String key : results.keySet()) {
- mResults.putLong(key, results.getLong(key));
- }
+ // Copy all snapshot data fields into mResults, which is outputted
+ // via Instrumentation.finish
+ mResults.putAll(results);
}
public void writeStartTiming(String label) {
@@ -768,6 +771,18 @@ public class InstrumentationTestRunner extends Instrumentation implements TestSu
}
}
+ public void writeMeasurement(String label, long value) {
+ mTestResult.putLong(REPORT_KEY_PREFIX + label, value);
+ }
+
+ public void writeMeasurement(String label, float value) {
+ mTestResult.putFloat(REPORT_KEY_PREFIX + label, value);
+ }
+
+ public void writeMeasurement(String label, String value) {
+ mTestResult.putString(REPORT_KEY_PREFIX + label, value);
+ }
+
// TODO report the end of the cycle
}
}