summaryrefslogtreecommitdiff
path: root/app-launcher
diff options
context:
space:
mode:
authorMohan Srinivasan <srmohan@google.com>2017-10-02 11:54:45 -0700
committerMohan Srinivasan <srmohan@google.com>2017-10-02 11:54:45 -0700
commitc89c14d6edba9375830fade85de0a717c8168a0c (patch)
tree4ace517a8803d7f8ddf560bbfd41490b2a9033ea /app-launcher
parentcf3b4cbe1dd3947541d5fa32c1e71f67107cf298 (diff)
downloadextras-c89c14d6edba9375830fade85de0a717c8168a0c.tar.gz
Fix device utilization reporting breakage.
Device utilization computation converted the values to hz, assuming the device is 100 HZ, which is not necessarily the case. This change converts everything to ms. Device utilization computation now works on marlin (P). Test: Test app-launcher and make sure device util% reported is correct. Change-Id: Id1dfe7e21fbd07d89fbe8a87ec49f76b17f7429e Signed-off-by: Mohan Srinivasan <srmohan@google.com>
Diffstat (limited to 'app-launcher')
-rwxr-xr-xapp-launcher/app-launcher18
1 files changed, 5 insertions, 13 deletions
diff --git a/app-launcher/app-launcher b/app-launcher/app-launcher
index 94707fbb..076d70b2 100755
--- a/app-launcher/app-launcher
+++ b/app-launcher/app-launcher
@@ -335,13 +335,9 @@ system_stats_before() {
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.
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=`echo $uptime | awk '{ print ($13 / 10) }'`
+ uptime_before_ms=`echo $uptime | awk '{ print ($1 * 1000) }'`
+ device_util_before_ms=`echo $system | awk '{ print ($13) }'`
fi
}
@@ -359,13 +355,9 @@ system_stats_after() {
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.
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=`echo $system | awk '{ print ($13 / 10) }'`
+ uptime_after_ms=`echo $uptime | awk '{ print ($1 * 1000) }'`
+ device_util_after_ms=`echo $system | awk '{ print ($13) }'`
fi
}
@@ -377,7 +369,7 @@ system_stats_delta() {
echo Read IOs /system = `expr $AFTER_RD_IOS_SYSTEM - $BEFORE_RD_IOS_SYSTEM`
echo Read KB /system = $READ_KB_SYSTEM
echo $iowait_ticks_before $iowait_ticks_after $total_ticks_before $total_ticks_after | awk '{ printf "IOwait = %.2f\n", (($2 - $1) * 100.0) / ($4 - $3) }'
- echo $device_util_before_hz $device_util_after_hz $uptime_before_hz $uptime_after_hz | awk '{ printf "Device util% = %.2f\n", (($2 - $1) * 100.0) / ($4 - $3) }'
+ echo $device_util_before_ms $device_util_after_ms $uptime_before_ms $uptime_after_ms | awk '{ printf "Device util% = %.2f\n", (($2 - $1) * 100.0) / ($4 - $3) }'
echo $user_ticks_after $user_ticks_before $total_ticks_after $total_ticks_before | awk '{ printf "User CPU util% = %.2f\n", (($1 - $2) * 100.0) / ($3 - $4) }'
echo $sys_ticks_after $sys_ticks_before $total_ticks_after $total_ticks_before | awk '{ printf "Sys CPU util% = %.2f\n", (($1 - $2) * 100.0) / ($3 - $4) }'
echo $cpubusy_ticks_after $cpubusy_ticks_before $total_ticks_after $total_ticks_before | awk '{ printf "Total CPU util% = %.2f\n", (($1 - $2) * 100.0) / ($3 - $4) }'