Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
MetricUtility
public
class
MetricUtility
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.util.MetricUtility
|
Contains common utility methods for storing the test metrics, aggregating the metrics in similar
tests and writing the metrics to a file.
Summary
Public constructors
MetricUtility
public MetricUtility ()
Public methods
aggregateMetrics
public aggregateMetrics ( rawMetrics)
Aggregate comma separated metrics.
Parameters |
rawMetrics |
: metrics collected during the test run. |
Returns |
|
aggregated metrics. |
aggregateStoredTestMetricsAndWriteToFile
public File aggregateStoredTestMetricsAndWriteToFile (String fileName)
Aggregate the metrics collected from multiple iterations of the test and
write the aggregated metrics to a test result file.
Parameters |
fileName |
String : file name to use while writing the metrics. |
buildMetricFilterPatterns
public void buildMetricFilterPatterns ( strictIncludeRegEx)
Build regular expression patterns to filter the metrics.
Parameters |
strictIncludeRegEx |
|
filterMetrics
public filterMetrics ( parsedMetrics)
Filter the metrics that matches the pattern.
getStats
public static getStats ( values,
percentiles)
Compute the stats from the give list of values.
Parameters |
values |
: raw values to compute the aggregation. |
percentiles |
: stats to include in the final metrics. |
Returns |
|
aggregated values. |
getStoredTestMetric
public getStoredTestMetric ()
isAllDoubleValues
public static boolean isAllDoubleValues ( rawValues)
Return true is all the values can be parsed to double value.
Otherwise return false.
Parameters |
rawValues |
: list whose values are validated. |
setIterationSeparator
public void setIterationSeparator (String separator)
Parameters |
separator |
String |
setPercentiles
public void setPercentiles ( percentiles)
storeTestMetrics
public void storeTestMetrics (TestDescription testDescription,
testMetrics)
Used for storing the individual test metrics and use it for aggregation.
Parameters |
testDescription |
TestDescription : contains the test details like class name and test name. |
testMetrics |
: metrics collected for the test. |
writeResultsToFile
public File writeResultsToFile (String testFileSuffix,
String testHeaderName,
metrics,
File resultsFile)
Write metrics to a file.
Parameters |
testFileSuffix |
String : is used as suffix in the test metric file name. |
testHeaderName |
String : metrics will be written under the test header name. |
metrics |
: to write in the file. |
resultsFile |
File : if null create a new file and write the metrics otherwise append the
test header name and metric to the file. |
Returns |
File |
file with the metric. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-02 UTC."],[],[]]