Merge "CTS Test Metrics: Nuke deprecated code with fire!" into nyc-dev
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/DeviceReportLog.java b/common/device-side/util/src/com/android/compatibility/common/util/DeviceReportLog.java
index 8bdd0bd..3944f70 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/DeviceReportLog.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/DeviceReportLog.java
@@ -38,22 +38,11 @@
public class DeviceReportLog extends ReportLog {
private static final String TAG = DeviceReportLog.class.getSimpleName();
private static final String RESULT = "COMPATIBILITY_TEST_RESULT";
- // TODO(mishragaurav): Remove default names and constructor after fixing b/27950009.
- private static final String DEFAULT_REPORT_LOG_NAME = "DefaultDeviceTestMetrics";
- private static final String DEFAULT_STREAM_NAME = "DefaultStream";
private static final int INST_STATUS_ERROR = -1;
private static final int INST_STATUS_IN_PROGRESS = 2;
private ReportLogDeviceInfoStore store;
- public DeviceReportLog() {
- this(DEFAULT_REPORT_LOG_NAME, DEFAULT_STREAM_NAME);
- }
-
- public DeviceReportLog(String reportLogName) {
- this(reportLogName, DEFAULT_STREAM_NAME);
- }
-
public DeviceReportLog(String reportLogName, String streamName) {
super(reportLogName, streamName);
try {
diff --git a/common/device-side/util/tests/src/com/android/compatibility/common/util/DeviceReportTest.java b/common/device-side/util/tests/src/com/android/compatibility/common/util/DeviceReportTest.java
index 25fb4d7..ab42b32 100644
--- a/common/device-side/util/tests/src/com/android/compatibility/common/util/DeviceReportTest.java
+++ b/common/device-side/util/tests/src/com/android/compatibility/common/util/DeviceReportTest.java
@@ -74,7 +74,7 @@
private static final String STREAM_NAME_4 = "SampleStream4";
public void testSubmit() throws Exception {
- DeviceReportLog log = new DeviceReportLog();
+ DeviceReportLog log = new DeviceReportLog(REPORT_NAME_1, STREAM_NAME_1);
log.addValue(TEST_MESSAGE_1, TEST_VALUE_1, TEST_TYPE_1, TEST_UNIT_1);
log.setSummary(TEST_MESSAGE_2, TEST_VALUE_2, TEST_TYPE_2, TEST_UNIT_2);
TestInstrumentation inst = new TestInstrumentation();
diff --git a/common/host-side/util/src/com/android/compatibility/common/util/MetricsReportLog.java b/common/host-side/util/src/com/android/compatibility/common/util/MetricsReportLog.java
index 19524ce..b87b86c 100644
--- a/common/host-side/util/src/com/android/compatibility/common/util/MetricsReportLog.java
+++ b/common/host-side/util/src/com/android/compatibility/common/util/MetricsReportLog.java
@@ -31,9 +31,6 @@
private final String mClassMethodName;
private final IBuildInfo mBuildInfo;
- // TODO(mishragaurav): Remove default names and constructor after fixing b/27950009.
- private static final String DEFAULT_REPORT_LOG_NAME = "DefaultHostTestMetrics";
- private static final String DEFAULT_STREAM_NAME = "DefaultStream";
// Temporary folder must match the temp-dir value configured in ReportLogCollector target
// preparer in cts/tools/cts-tradefed/res/config/cts-oreconditions.xml
private static final String TEMPORARY_REPORT_FOLDER = "temp-report-logs/";
@@ -44,28 +41,6 @@
* @param abi abi the test was run on.
* @param classMethodName class name and method name of the test in class#method format.
* Note that ReportLog.getClassMethodNames() provide this.
- */
- public MetricsReportLog(IBuildInfo buildInfo, String abi, String classMethodName) {
- this(buildInfo, abi, classMethodName, DEFAULT_REPORT_LOG_NAME, DEFAULT_STREAM_NAME);
- }
-
- /**
- * @param buildInfo the test build info.
- * @param abi abi the test was run on.
- * @param classMethodName class name and method name of the test in class#method format.
- * Note that ReportLog.getClassMethodNames() provide this.
- * @param reportLogName the name of the report log file. Metrics will be written out to this.
- */
- public MetricsReportLog(IBuildInfo buildInfo, String abi, String classMethodName,
- String reportLogName) {
- this(buildInfo, abi, classMethodName, reportLogName, DEFAULT_STREAM_NAME);
- }
-
- /**
- * @param buildInfo the test build info.
- * @param abi abi the test was run on.
- * @param classMethodName class name and method name of the test in class#method format.
- * Note that ReportLog.getClassMethodNames() provide this.
* @param reportLogName the name of the report log file. Metrics will be written out to this.
* @param streamName the key for the JSON object of the set of metrics to be logged.
*/
diff --git a/libs/commonutil/src/com/android/cts/util/ReportLog.java b/libs/commonutil/src/com/android/cts/util/ReportLog.java
deleted file mode 100644
index 05dec0f..0000000
--- a/libs/commonutil/src/com/android/cts/util/ReportLog.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.cts.util;
-
-import com.android.compatibility.common.util.Stat;
-
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-
-/**
- * Utility class to print performance measurement result back to host.
- * For now, throws know exception with message.
- *
- * This class is deprecated, use {@link com.android.compatibility.common.util.ReportLog}
- * instead.
- */
-@Deprecated
-public class ReportLog {
-
- protected static int mDepth = 3;
- protected com.android.compatibility.common.util.ReportLog mReportLog;
-
- public ReportLog(com.android.compatibility.common.util.ReportLog reportLog) {
- mReportLog = reportLog;
- }
-
- /**
- * print array of values to output log
- * <p>Note: test identifier is inferred from call stack trace based on class and method name
- */
- public void printArray(String message, double[] values, ResultType type, ResultUnit unit) {
- doPrintArray(message, values, type, unit);
- }
-
- /**
- * print array of values to output log
- */
- public void printArray(String testId, String message,
- double[] values, ResultType type, ResultUnit unit) {
- doPrintArray(testId, message, values, type, unit);
- }
-
- /**
- * Print a value to output log
- * <p>Note: test identifier is inferred from call stack trace based on class and method name
- */
- public void printValue(String message, double value, ResultType type, ResultUnit unit) {
- double[] vals = { value };
- doPrintArray(message, vals, type, unit);
- }
-
- /**
- * Print a value to output log
- */
- public void printValue(String testId, String message,
- double value, ResultType type, ResultUnit unit) {
- double[] vals = { value };
- doPrintArray(testId, message, vals, type, unit);
- }
-
- private void doPrintArray(String message, double[] values, ResultType type, ResultUnit unit) {
- doPrintArray(getClassMethodNames(mDepth + 1, true), message, values, type, unit);
- }
-
- private void doPrintArray(String testId, String message,
- double[] values, ResultType type, ResultUnit unit) {
- mReportLog.addValues(testId, message, values,
- com.android.compatibility.common.util.ResultType.parseReportString(
- type.getXmlString()),
- com.android.compatibility.common.util.ResultUnit.parseReportString(
- unit.getXmlString()));
- }
-
- /**
- * record the result of benchmarking with performance target.
- * Depending on the ResultType, the function can fail if the result
- * does not meet the target. For example, for the type of HIGHER_BETTER,
- * value of 1.0 with target of 2.0 will fail.
- *
- * @param message message to be printed in the final report
- * @param target target performance for the benchmarking
- * @param value measured value
- * @param type
- * @param unit
- */
- public void printSummaryWithTarget(String message, double target, double value,
- ResultType type, ResultUnit unit) {
- // Ignore target
- mReportLog.setSummary(message, value,
- com.android.compatibility.common.util.ResultType.parseReportString(
- type.getXmlString()),
- com.android.compatibility.common.util.ResultUnit.parseReportString(
- unit.getXmlString()));
- }
-
- /**
- * For standard report summary without target value.
- * Note that this function will not fail as there is no target.
- * @param message
- * @param value
- * @param type type of the value
- * @param unit unit of the data
- */
- public void printSummary(String message, double value, ResultType type, ResultUnit unit) {
- mReportLog.setSummary(message, value,
- com.android.compatibility.common.util.ResultType.parseReportString(
- type.getXmlString()),
- com.android.compatibility.common.util.ResultUnit.parseReportString(
- unit.getXmlString()));
- }
-
- /**
- * @return a string representation of this report.
- */
- protected String generateReport() {
- try {
- return com.android.compatibility.common.util.ReportLog.serialize(mReportLog);
- } catch (IllegalArgumentException | IllegalStateException | XmlPullParserException
- | IOException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * calculate rate per sec for given change happened during given timeInMSec.
- * timeInSec with 0 value will be changed to small value to prevent divide by zero.
- * @param change total change of quality for the given duration timeInMSec.
- * @param timeInMSec
- * @return
- */
- public static double calcRatePerSec(double change, double timeInMSec) {
- return Stat.calcRatePerSec(change, timeInMSec);
- }
-
- /**
- * array version of calcRatePerSecArray
- */
- public static double[] calcRatePerSecArray(double change, double[] timeInMSec) {
- return Stat.calcRatePerSecArray(change, timeInMSec);
- }
-
- /**
- * copy array from src to dst with given offset in dst.
- * dst should be big enough to hold src
- */
- public static void copyArray(double[] src, double[] dst, int dstOffset) {
- for (int i = 0; i < src.length; i++) {
- dst[dstOffset + i] = src[i];
- }
- }
-
- /**
- * get classname#methodname from call stack of the current thread
- */
- public static String getClassMethodNames() {
- return getClassMethodNames(mDepth, false);
- }
-
- private static String getClassMethodNames(int depth, boolean addLineNumber) {
- StackTraceElement[] elements = Thread.currentThread().getStackTrace();
- String names = elements[depth].getClassName() + "#" + elements[depth].getMethodName() +
- (addLineNumber ? ":" + elements[depth].getLineNumber() : "");
- return names;
- }
-
-}
diff --git a/libs/commonutil/src/com/android/cts/util/ResultType.java b/libs/commonutil/src/com/android/cts/util/ResultType.java
deleted file mode 100644
index dbe8602..0000000
--- a/libs/commonutil/src/com/android/cts/util/ResultType.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.cts.util;
-
-/**
- * Enum for distinguishing performance results.
- *
- * This class is deprecated, use {@link com.android.compatibility.common.util.ResultType}
- * instead.
- */
-@Deprecated
-public enum ResultType {
- /** lower score shows better performance */
- LOWER_BETTER,
- /** higher score shows better performance */
- HIGHER_BETTER,
- /** This value is not directly correlated with performance. */
- NEUTRAL,
- /** presence of this type requires some attention although it may not be an error. */
- WARNING;
-
- /**
- * Return string used in CTS XML report
- */
- public String getXmlString() {
- return name().toLowerCase();
- }
-}
diff --git a/libs/commonutil/src/com/android/cts/util/ResultUnit.java b/libs/commonutil/src/com/android/cts/util/ResultUnit.java
deleted file mode 100644
index 2148821..0000000
--- a/libs/commonutil/src/com/android/cts/util/ResultUnit.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.cts.util;
-
-/**
- * Enum for representing the unit of performance results.
- *
- * This class is deprecated, use {@link com.android.compatibility.common.util.ResultUnit}
- * instead.
- */
-@Deprecated
-public enum ResultUnit {
- /** for value with no unit */
- NONE,
- /** milli-seconds */
- MS,
- /** frames per second */
- FPS,
- /** operations per second */
- OPS,
- /** kilo-bytes-per-second, not bits-per-second */
- KBPS,
- /** mega-bytes-per-second */
- MBPS,
- /** amount of data, bytes */
- BYTE,
- /** tell how many times it did happen. */
- COUNT,
- /** unit for benchmarking with generic score. */
- SCORE;
-
- /**
- * Return string used in CTS XML report
- */
- public String getXmlString() {
- return name().toLowerCase();
- }
-}
-
diff --git a/libs/deviceutil/src/android/cts/util/DeviceReportLog.java b/libs/deviceutil/src/android/cts/util/DeviceReportLog.java
deleted file mode 100644
index 4dd185e..0000000
--- a/libs/deviceutil/src/android/cts/util/DeviceReportLog.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.cts.util;
-
-import android.app.Instrumentation;
-import android.os.Bundle;
-import android.util.Log;
-
-import com.android.cts.util.ReportLog;
-
-/**
- * This class is deprecated, use {@link com.android.compatibility.common.util.DeviceReportLog}
- * instead.
- */
-@Deprecated
-public class DeviceReportLog extends ReportLog {
- private static final String TAG = "DeviceCtsReport";
- private static final String CTS_RESULT_KEY = "CTS_TEST_RESULT";
- private static final int INST_STATUS_IN_PROGRESS = 2;
- private static final int BASE_DEPTH = 4;
-
- public DeviceReportLog() {
- this(0);
- }
-
- public DeviceReportLog(int depth) {
- super(new com.android.compatibility.common.util.DeviceReportLog());
- mDepth = BASE_DEPTH + depth;
- }
-
- public void deliverReportToHost(Instrumentation instrumentation) {
- Log.i(TAG, "deliverReportToHost");
- String report = generateReport();
- if (report != null && !report.isEmpty()) {
- Bundle output = new Bundle();
- output.putString(CTS_RESULT_KEY, report);
- instrumentation.sendStatus(INST_STATUS_IN_PROGRESS, output);
- }
- }
-}
\ No newline at end of file
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/util/HostReportLog.java b/tools/tradefed-host/src/com/android/cts/tradefed/util/HostReportLog.java
deleted file mode 100644
index 7de3c10..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/util/HostReportLog.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.cts.tradefed.util;
-
-import com.android.compatibility.common.util.MetricsReportLog;
-import com.android.cts.util.ReportLog;
-import com.android.tradefed.build.IBuildInfo;
-
-/**
- * ReportLog for host tests
- * Note that setTestInfo should be set before throwing report
- *
- * This class is deprecated, use {@link MetricsReportLog} instead.
- */
-@Deprecated
-public class HostReportLog extends ReportLog {
- /**
- * @param buildInfo the test build info.
- * @param abiName the name of the ABI on which the test was run.
- * @param classMethodName class name and method name of the test in class#method format.
- * Note that ReportLog.getClassMethodNames() provide this.
- */
- public HostReportLog(IBuildInfo buildInfo, String abiName, String classMethodName) {
- super(new MetricsReportLog(buildInfo, abiName, classMethodName));
- }
-
- public void deliverReportToHost() {
- ((MetricsReportLog) mReportLog).submit();
- }
-}
\ No newline at end of file