1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-04-13 06:10:50 +01:00

Adds applaunch start time

Added a variable applaunch_start_time in ApkWorkload class that captures the applaunch start time.
The value is appended to the beginning of the logcat.log file in the method update_result.

Changes Actionlogger to give epoch time

Applaunch time is obtained as epoch time from the device. For uxperf result processor to work for applaunch time
as well, log time changed to epoch time

Removes the nano to mill second conversion

As the previous commit changed the system time to give epoch time in
milli seconds, the conversion from nano to milli seconds is not required.

Adds applaunch end time marker for workloads

End time of applaunch is currently considered as the time until the screen orientation is set in all
the applications dealt with so far. This marker can later be moved to the most apt point after close
observation on every workload.

Pylint and pep8 checks done
This commit is contained in:
jummp01 2016-11-11 15:54:55 +00:00
parent 40d281b336
commit 5bed26397b
16 changed files with 24 additions and 3 deletions

View File

@ -200,6 +200,7 @@ class ApkWorkload(Workload):
self.apk_version = None
self.logcat_log = None
self.exact_apk_version = None
self.applaunch_start_time = None
def setup(self, context):
Workload.setup(self, context)
@ -246,6 +247,7 @@ class ApkWorkload(Workload):
context.add_classifiers(apk_version=self.apk_version)
if self.launch_main:
self.applaunch_start_time = int(float(self.device.execute('echo $EPOCHREALTIME')) * 1000)
self.launch_package() # launch default activity without intent data
self.device.execute('am kill-all') # kill all *background* activities
self.device.clear_logcat()
@ -430,6 +432,13 @@ class ApkWorkload(Workload):
def update_result(self, context):
self.logcat_log = os.path.join(context.output_directory, 'logcat.log')
self.device.dump_logcat(self.logcat_log)
#Appending applaunch start time to logcat file
logcatfile = open(self.logcat_log, "r+")
logcat_content = logcatfile.read()
logcatfile.seek(0, 0)
applaunchMarker = "UX_PERF : applaunch_start " + str(self.applaunch_start_time)
logcatfile.write(applaunchMarker.rstrip('\r\n') + '\n' + logcat_content)
logcatfile.close()
context.add_iteration_artifact(name='logcat',
path='logcat.log',
kind='log',

View File

@ -89,13 +89,13 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
public void start() {
if (enabled) {
Log.d("UX_PERF", testTag + "_start " + System.nanoTime());
Log.d("UX_PERF", testTag + "_start " + System.currentTimeMillis());
}
}
public void stop() throws Exception {
if (enabled) {
Log.d("UX_PERF", testTag + "_end " + System.nanoTime());
Log.d("UX_PERF", testTag + "_end " + System.currentTimeMillis());
}
}
}

View File

@ -185,7 +185,7 @@ class UxPerfParser(object):
for action, timestamps in self.actions.iteritems():
# nanosecond precision, but not necessarily nanosecond resolution
# truncate to guarantee millisecond precision
ts_ms = tuple(int(ts[:-6]) for ts in timestamps)
ts_ms = tuple(int(ts) for ts in timestamps)
if len(ts_ms) == 2:
start, finish = ts_ms
duration = finish - start

View File

@ -16,6 +16,7 @@
package com.arm.wlauto.uiauto.adobereader;
import android.os.Bundle;
import android.util.Log;
// Import the uiautomator libraries
import com.android.uiautomator.core.UiObject;
@ -52,6 +53,7 @@ public class UiAutomation extends UxPerfUiAutomation {
String[] searchStrings =
parameters.getString("search_string_list").replace("0space0", " ").split("0newline0");
Log.d("UX_PERF", "applaunch_end " + System.currentTimeMillis());
setScreenOrientation(ScreenOrientation.NATURAL);
dismissWelcomeView();

View File

@ -17,6 +17,7 @@ package com.arm.wlauto.uiauto.googlephotos;
import android.os.Bundle;
import android.graphics.Rect;
import android.util.Log;
// Import the uiautomator libraries
import com.android.uiautomator.core.UiObject;
@ -50,6 +51,7 @@ public class UiAutomation extends UxPerfUiAutomation {
packageID = packageName + ":id/";
sleep(5); // Pause while splash screen loads
Log.d("UX_PERF", "applaunch_end " + System.currentTimeMillis());
setScreenOrientation(ScreenOrientation.NATURAL);
dismissWelcomeView();
closePromotionPopUp();

View File

@ -16,6 +16,7 @@
package com.arm.wlauto.uiauto.googleplaybooks;
import android.os.Bundle;
import android.util.Log;
// Import the uiautomator libraries
import com.android.uiautomator.core.UiObject;
@ -62,6 +63,7 @@ public class UiAutomation extends UxPerfUiAutomation {
String noteText = "This is a test note";
String account = parameters.getString("account");
Log.d("UX_PERF", "applaunch_end " + System.currentTimeMillis());
setScreenOrientation(ScreenOrientation.NATURAL);
chooseAccount(account);

View File

@ -22,6 +22,7 @@ import java.util.Map;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.Log;
// Import the uiautomator libraries
import com.android.uiautomator.core.Configurator;
@ -57,6 +58,7 @@ public class UiAutomation extends UxPerfUiAutomation {
boolean doTextEntry = Boolean.parseBoolean(parameters.getString("do_text_entry"));
String workingDirectoryName = parameters.getString("workdir_name");
Log.d("UX_PERF", "applaunch_end " + System.currentTimeMillis());
setScreenOrientation(ScreenOrientation.NATURAL);
changeAckTimeout(100);
// UI automation begins here

View File

@ -16,6 +16,7 @@
package com.arm.wlauto.uiauto.skype;
import android.os.Bundle;
import android.util.Log;
// Import the uiautomator libraries
import com.android.uiautomator.core.UiObject;
@ -55,6 +56,7 @@ public class UiAutomation extends UxPerfUiAutomation {
String callType = parameters.getString("action");
String resultsFile = parameters.getString("results_file");
Log.d("UX_PERF", "applaunch_end " + System.currentTimeMillis());
setScreenOrientation(ScreenOrientation.NATURAL);
UiWatcher infoPopUpWatcher = createInfoPopUpWatcher();

View File

@ -17,6 +17,7 @@ package com.arm.wlauto.uiauto.youtube;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.Log;
// Import the uiautomator libraries
import com.android.uiautomator.core.UiObject;
@ -54,6 +55,7 @@ public class UiAutomation extends UxPerfUiAutomation {
searchTerm = searchTerm.replace("0space0", " ");
}
Log.d("UX_PERF", "applaunch_end " + System.currentTimeMillis());
setScreenOrientation(ScreenOrientation.NATURAL);
clearFirstRunDialogues();