OSDN Git Service

Merge "Additional setup and reduced file collision" into oc-dr1-dev am: b5aca0236f
authorMaggie White <maggiewhite@google.com>
Fri, 7 Jul 2017 18:45:26 +0000 (18:45 +0000)
committerandroid-build-merger <android-build-merger@google.com>
Fri, 7 Jul 2017 18:45:26 +0000 (18:45 +0000)
am: 7cf1adb901

Change-Id: I1c6bc4b85bbcbb2893db1df499db9cb7dd51635e

app-launcher/README
app-launcher/app-launcher

index 238350e..863a749 100644 (file)
@@ -5,6 +5,15 @@ Introduction: app-launcher is a script that launches apps many times,
 measures various system metrics, computes basic stats for the metrics
 and reports that stats.
 
+Setup:
+1) Make sure the device is seen via 'adb devices' and authorize adb via the
+popup dialog.
+2) Clear the setup wizard.
+3) Login to an android user test account.
+4) Clear the first time user dialogs on supported apps for your device (see
+below).
+5) Enable wifi and connect to a network (ex. GoogleGuest).
+
 Launching app-launcher :
 app-launcher -a|-b|-u [-c|-v|-s <serial number>] num-iterations
 -a:Run on all cores
index c9e4c8a..703aafa 100755 (executable)
@@ -306,48 +306,48 @@ get_volantis_devnames () {
 system_stats_before() {
     if [ $system_bdev_set == true ]; then
         # Get BEFORE read stats for /system
-        $adb shell 'cat /proc/diskstats' | grep -w $system_block_device > /tmp/$model-system
-        BEFORE_RD_IOS_SYSTEM=`awk '{ print $4 }' /tmp/$model-system`
-        BEFORE_RD_SECTORS_SYSTEM=`awk '{ print $6 }' /tmp/$model-system`
+        system=`$adb shell 'cat /proc/diskstats' | grep -w $system_block_device`
+        BEFORE_RD_IOS_SYSTEM=`echo $system | awk '{ print $4 }'`
+        BEFORE_RD_SECTORS_SYSTEM=`echo $system | awk '{ print $6 }'`
         # iowait% computation
-        $adb shell 'cat /proc/stat' | grep -w cpu > /tmp/procstat
-        user_ticks_before=`awk '{ print ($2 + $3) }' /tmp/procstat`
-        sys_ticks_before=`awk '{ print ($4 + $7 + $8) }' /tmp/procstat`
-        cpubusy_ticks_before=`awk '{ print ($2 + $3 + $4 + $7 + $8) }' /tmp/procstat`
-        iowait_ticks_before=`awk '{ print $6 }' /tmp/procstat`
-        total_ticks_before=`awk '{ print ($2 + $3 + $4 + $5 + $7 + $8) }' /tmp/procstat`
+        procstat=`$adb shell 'cat /proc/stat' | grep -w cpu`
+        user_ticks_before=`echo $procstat | awk '{ print ($2 + $3) }'`
+        sys_ticks_before=`echo $procstat | awk '{ print ($4 + $7 + $8) }'`
+        cpubusy_ticks_before=`echo $procstat | awk '{ print ($2 + $3 + $4 + $7 + $8) }'`
+        iowait_ticks_before=`echo $procstat | awk '{ print $6 }'`
+        total_ticks_before=`echo $procstat | awk '{ print ($2 + $3 + $4 + $5 + $7 + $8) }'`
         # Device util% computation
         # Note hz=100, so multiplying uptime (in seconds) by 100, gives us
         # the uptime in hz.
-        $adb shell 'cat /proc/uptime' > /tmp/uptime
-        uptime_before_hz=`awk '{ print ($1 * 100) }' /tmp/uptime`
+        uptime=`$adb shell 'cat /proc/uptime'`
+        uptime_before_hz=`echo $uptime | awk '{ print ($1 * 100) }'`
         # Note that the device (busy) ticks is in ms. Since hz=100, dividing
         # device (busy) ticks by 10, gives us this in the correct ticks units
-        device_util_before_hz=`awk '{ print ($13 / 10) }' /tmp/$model-system`
+        device_util_before_hz=`echo $uptime | awk '{ print ($13 / 10) }'`
     fi
 }
 
 system_stats_after() {
     if [ $system_bdev_set == true ]; then
         # Get AFTER read stats for /system
-        $adb shell 'cat /proc/diskstats' | grep -w $system_block_device > /tmp/$model-system
-        AFTER_RD_IOS_SYSTEM=`awk '{ print $4 }' /tmp/$model-system`
-        AFTER_RD_SECTORS_SYSTEM=`awk '{ print $6 }' /tmp/$model-system`
+        system=`$adb shell 'cat /proc/diskstats' | grep -w $system_block_device`
+        AFTER_RD_IOS_SYSTEM=`echo $system | awk '{ print $4 }'`
+        AFTER_RD_SECTORS_SYSTEM=`echo $system | awk '{ print $6 }'`
         # iowait% computation
-        $adb shell 'cat /proc/stat' | grep -w cpu > /tmp/procstat
-        user_ticks_after=`awk '{ print ($2 + $3) }' /tmp/procstat`
-        sys_ticks_after=`awk '{ print ($4 + $7 + $8) }' /tmp/procstat`
-        cpubusy_ticks_after=`awk '{ print ($2 + $3 + $4 + $7 + $8) }' /tmp/procstat`
-        iowait_ticks_after=`awk '{ print $6 }' /tmp/procstat`
-        total_ticks_after=`awk '{ print ($2 + $3 + $4 + $5 + $7 + $8) }' /tmp/procstat`
+        procstat=`$adb shell 'cat /proc/stat' | grep -w cpu`
+        user_ticks_after=`echo $procstat | awk '{ print ($2 + $3) }'`
+        sys_ticks_after=`echo $procstat | awk '{ print ($4 + $7 + $8) }'`
+        cpubusy_ticks_after=`echo $procstat | awk '{ print ($2 + $3 + $4 + $7 + $8) }'`
+        iowait_ticks_after=`echo $procstat | awk '{ print $6 }'`
+        total_ticks_after=`echo $procstat | awk '{ print ($2 + $3 + $4 + $5 + $7 + $8) }'`
         # Device util% computation
         # Note hz=100, so multiplying uptime (in seconds) by 100, gives us
         # the uptime in hz.
-        $adb shell 'cat /proc/uptime' > /tmp/uptime
-        uptime_after_hz=`awk '{ print ($1 * 100) }' /tmp/uptime`
+        uptime=`$adb shell 'cat /proc/uptime'`
+        uptime_after_hz=`echo $uptime | awk '{ print ($1 * 100) }'`
         # Note that the device (busy) ticks is in ms. Since hz=100, dividing
         # device (busy) ticks by 10, gives us this in the correct ticks units
-        device_util_after_hz=`awk '{ print ($13 / 10) }' /tmp/$model-system`
+        device_util_after_hz=`echo $system | awk '{ print ($13 / 10) }'`
     fi
 }
 
@@ -396,23 +396,23 @@ launch_app() {
 }
 
 launch_fugu_apps() {
-    launch_app com.google.android.youtube.tv com.google.android.apps.youtube.tv.activity.TvGuideActivity > youtube-$model
-    getstats youtube-$model YouTube
-    launch_app com.google.android.play.games com.google.android.gms.games.pano.activity.PanoGamesOnboardHostActivity > games-$model
-    getstats games-$model Games
-    launch_app com.google.android.music com.android.music.activitymanagement.TopLevelActivity > music-$model
-    getstats music-$model Music
+    launch_app com.google.android.youtube.tv com.google.android.apps.youtube.tv.activity.TvGuideActivity > $BASHPID-youtube-$model
+    getstats $BASHPID-youtube-$model YouTube
+    launch_app com.google.android.play.games com.google.android.gms.games.pano.activity.PanoGamesOnboardHostActivity > $BASHPID-games-$model
+    getstats $BASHPID-games-$model Games
+    launch_app com.google.android.music com.android.music.activitymanagement.TopLevelActivity > $BASHPID-music-$model
+    getstats $BASHPID-music-$model Music
 }
 
 launch_phone_apps() {
-    launch_app com.android.chrome com.google.android.apps.chrome.Main > chrome-$model
-    getstats chrome-$model Chrome
-    launch_app com.google.android.GoogleCamera com.android.camera.CameraActivity > camera-$model
-    getstats camera-$model Camera
-    launch_app com.google.android.apps.maps com.google.android.maps.MapsActivity > maps-$model
-    getstats maps-$model Maps
-    launch_app com.google.android.youtube com.google.android.apps.youtube.app.WatchWhileActivity > youtube-$model
-    getstats youtube-$model YouTube
+    launch_app com.android.chrome com.google.android.apps.chrome.Main > $BASHPID-chrome-$model
+    getstats $BASHPID-chrome-$model Chrome
+    launch_app com.google.android.GoogleCamera com.android.camera.CameraActivity > $BASHPID-camera-$model
+    getstats $BASHPID-camera-$model Camera
+    launch_app com.google.android.apps.maps com.google.android.maps.MapsActivity > $BASHPID-maps-$model
+    getstats $BASHPID-maps-$model Maps
+    launch_app com.google.android.youtube com.google.android.apps.youtube.app.WatchWhileActivity > $BASHPID-youtube-$model
+    getstats $BASHPID-youtube-$model YouTube
 }
 
 usage() {
@@ -432,21 +432,24 @@ usage() {
 }
 
 setup() {
-    # Disable automatic rotation, NFC and wifi
-    # This works on OC, but haven't tested on NYC or earlier
-    $adb shell 'content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0'
-    $adb shell 'svc nfc disable'
-    $adb shell 'svc wifi disable'
-
+    echo "Setting up device"
     # Set developer options, will automatically 'Stay Awake'
     $adb shell 'am start -n com.android.settings/.DevelopmentSettings'
     # Set screen timeout to 30 minutes
     $adb shell 'settings put system screen_off_timeout 1800000'
+
+    # TODO: Consider rebooting device to start with a clean state
+
+    # Disable automatic rotation and NFC
+    # This works on OC, but haven't tested on NYC or earlier
+    $adb shell 'content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0'
+    $adb shell 'svc nfc disable'
+
     # Clear all notifications
     $adb shell 'service call notification 1'
     # Go to home screen
     $adb shell 'input keyevent KEYCODE_WAKEUP' && sleep 0.5
-    $adb shell 'input keyevent KEYCODE_ENTER'  && sleep 0.5
+    $adb shell 'input keyevent KEYCODE_MENU'   && sleep 0.5
     $adb shell 'input keyevent KEYCODE_HOME'   && sleep 0.5
     sleep 2
     # TODO: kill all background apps
@@ -540,3 +543,6 @@ if [ $model == "fugu" ]; then
 else # Phone Apps
     launch_phone_apps
 fi
+
+# cleanup
+rm $BASHPID*