diff options
| author | Jack Wang <jackwang@google.com> | 2009-10-27 22:01:09 -0700 |
|---|---|---|
| committer | Jack Wang <jackwang@google.com> | 2009-10-28 14:32:05 -0700 |
| commit | 075997f12e2fb2b646172a92926be0f26f739099 (patch) | |
| tree | 80752d7d775d710f8be21f405a0f0979b67e110f /core/java/android/os | |
| parent | 59625fa86ad0e520931361aba120e2d868f01618 (diff) | |
| download | frameworks_base-075997f12e2fb2b646172a92926be0f26f739099.zip frameworks_base-075997f12e2fb2b646172a92926be0f26f739099.tar.gz frameworks_base-075997f12e2fb2b646172a92926be0f26f739099.tar.bz2 | |
PerformanceCollector: Collect & report perf measurements in key/value form
- Added new functions to PerformanceCollector and PerformanceResultsWriter
- Modified unit tests to test new functionality and fix flakiness reported in
2218327 and 2118268
- Added PerformanceCollectorTest to small suite
Diffstat (limited to 'core/java/android/os')
| -rw-r--r-- | core/java/android/os/PerformanceCollector.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/core/java/android/os/PerformanceCollector.java b/core/java/android/os/PerformanceCollector.java index 4ca1f32..be1cf6d 100644 --- a/core/java/android/os/PerformanceCollector.java +++ b/core/java/android/os/PerformanceCollector.java @@ -107,6 +107,36 @@ public class PerformanceCollector { * @see PerformanceCollector#stopTiming(String) */ public void writeStopTiming(Bundle results); + + /** + * Callback invoked as last action in + * {@link PerformanceCollector#addMeasurement(String, long)} for + * reporting an integer type measurement. + * + * @param label short description of the metric that was measured + * @param value long value of the measurement + */ + public void writeMeasurement(String label, long value); + + /** + * Callback invoked as last action in + * {@link PerformanceCollector#addMeasurement(String, float)} for + * reporting a float type measurement. + * + * @param label short description of the metric that was measured + * @param value float value of the measurement + */ + public void writeMeasurement(String label, float value); + + /** + * Callback invoked as last action in + * {@link PerformanceCollector#addMeasurement(String, String)} for + * reporting a string field. + * + * @param label short description of the metric that was measured + * @param value string summary of the measurement + */ + public void writeMeasurement(String label, String value); } /** @@ -385,6 +415,39 @@ public class PerformanceCollector { return mPerfMeasurement; } + /** + * Add an integer type measurement to the collector. + * + * @param label short description of the metric that was measured + * @param value long value of the measurement + */ + public void addMeasurement(String label, long value) { + if (mPerfWriter != null) + mPerfWriter.writeMeasurement(label, value); + } + + /** + * Add a float type measurement to the collector. + * + * @param label short description of the metric that was measured + * @param value float value of the measurement + */ + public void addMeasurement(String label, float value) { + if (mPerfWriter != null) + mPerfWriter.writeMeasurement(label, value); + } + + /** + * Add a string field to the collector. + * + * @param label short description of the metric that was measured + * @param value string summary of the measurement + */ + public void addMeasurement(String label, String value) { + if (mPerfWriter != null) + mPerfWriter.writeMeasurement(label, value); + } + /* * Starts tracking memory usage, binder transactions, and real & cpu timing. */ |
