mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 07:04:17 +00: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:
		| @@ -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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user