1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 03:12:34 +01:00

Add per-action instrumentation for UX performance

- Implement a new Marker API in BaseUiAutomation so workload can
  generate start and end markers with string name. Outputs to logcat.

- Document the Marker output log format in the WA documentation

- Create a results processor to take existing instrument fps logs and
  parse them based on the workload markers. Produce per-action fps
  metrics.

- Add simple timing results based on the workload markers
This commit is contained in:
John Richardson
2016-07-14 13:33:41 +01:00
parent b8d7956d4c
commit c49c5c4121
3 changed files with 295 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ import java.util.regex.Pattern;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
// Import the uiautomator libraries
import com.android.uiautomator.core.UiObject;
@@ -37,6 +38,47 @@ import com.android.uiautomator.testrunner.UiAutomatorTestCase;
public class BaseUiAutomation extends UiAutomatorTestCase {
/**
* Basic marker API for workloads to generate start and end markers for
* deliminating and timing actions. Markers are output to logcat with debug
* priority. Actions represent a series of UI interactions to time.
*
* The marker API provides a way for instruments and result processors to hook into
* per-action timings by parsing logcat logs produced per workload iteration.
*
* The marker output consists of a logcat tag 'UX_PERF' and a message. The
* message consists of a name for the action and a timestamp. The timestamp
* is separated by a single space from the name of the action.
*
* Typical usage:
*
* ActionLogger logger = ActionLogger("testTag", parameters);
* logger.start();
* // actions to be recorded
* logger.stop();
*/
public class ActionLogger {
private String testTag;
private boolean enabled;
public ActionLogger(String testTag, Bundle parameters) {
this.testTag = testTag;
this.enabled = Boolean.parseBoolean(parameters.getString("dumpsys_enabled"));
}
public void start() {
if (enabled) {
Log.d("UX_PERF", testTag + "_start " + System.nanoTime());
}
}
public void stop() throws Exception {
if (enabled) {
Log.d("UX_PERF", testTag + "_end " + System.nanoTime());
}
}
}
public void sleep(int second) {
super.sleep(second * 1000);