summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xapp-launcher/app-launcher189
-rwxr-xr-xboottime_tools/bootanalyze/bootanalyze.py37
-rw-r--r--boottime_tools/bootanalyze/config.yaml4
-rwxr-xr-xioblame/ioblame.sh6
-rw-r--r--zram-perf/zram-perf.cpp75
5 files changed, 166 insertions, 145 deletions
diff --git a/app-launcher/app-launcher b/app-launcher/app-launcher
index aeae025b..525e06ac 100755
--- a/app-launcher/app-launcher
+++ b/app-launcher/app-launcher
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
parseoptions() {
verbose=false
@@ -23,7 +23,7 @@ parseoptions() {
usage
;;
-s)
- if [ -z $2 ]; then
+ if [ -z "$2" ]; then
usage
fi
adb="adb -s $2"
@@ -43,7 +43,7 @@ parseoptions() {
done
iterations=$1
- if [ $iterations -lt 100 ]; then
+ if [ "$iterations" -lt 100 ]; then
usage
fi
}
@@ -59,47 +59,47 @@ getstats () {
# From Activity Manager
echo "Launch Time (TotalTime) :"
- fgrep TotalTime $infile | awk '{print $2}' | computestats
+ grep -F TotalTime "$infile" | awk '{print $2}' | computestats
# Data from simpleperf
echo "cpu-cycles :"
- fgrep cpu-cycles $infile | awk '{print $1}' | sed s/,//g | computestats
+ grep -F cpu-cycles "$infile" | awk '{print $1}' | sed s/,//g | computestats
# CPU util% Data from /proc/stat
echo "cpu-util% :"
- fgrep 'Total CPU util' $infile | awk '{print $5}' | computestatsf
+ grep -F 'Total CPU util' "$infile" | awk '{print $5}' | computestatsf
echo "user-cpu-util% :"
- fgrep 'User CPU util' $infile | awk '{print $5}' | computestatsf
+ grep -F 'User CPU util' "$infile" | awk '{print $5}' | computestatsf
echo "sys-cpu-util% (incl hardirq/softirq) :"
- fgrep 'Sys CPU util' $infile | awk '{print $5}' | computestatsf
+ grep -F 'Sys CPU util' "$infile" | awk '{print $5}' | computestatsf
if [ $verbose == true ]; then
echo "instructions : "
- fgrep instructions $infile | awk '{print $1}' | sed s/,//g | computestats
+ grep -F instructions "$infile" | awk '{print $1}' | sed s/,//g | computestats
echo "cycles per instruction : "
- fgrep instructions $infile | awk '{print $4}' | sed s/,//g | computestatsf
+ grep -F instructions "$infile" | awk '{print $4}' | sed s/,//g | computestatsf
echo "branch-misses : "
- fgrep branch-misses $infile | awk '{print $1}' | sed s/,//g | computestats
+ grep -F branch-misses "$infile" | awk '{print $1}' | sed s/,//g | computestats
echo "context-switches : "
- fgrep context-switches $infile | awk '{print $1}' | sed s/,//g | computestats
+ grep -F context-switches "$infile" | awk '{print $1}' | sed s/,//g | computestats
echo "page-faults : "
- fgrep page-faults $infile | awk '{print $1}' | sed s/,//g | computestats
+ grep -F page-faults "$infile" | awk '{print $1}' | sed s/,//g | computestats
fi
- if [ $system_bdev_set == true ]; then
+ if [ "$system_bdev_set" == true ]; then
# (Storage) Data from /proc we've collected
echo "KB read for $system_block_device blkdev :"
- fgrep KB $infile | grep system | awk '{print $5}' | computestats
+ grep -F KB "$infile" | grep system | awk '{print $5}' | computestats
echo "iowait% :"
- fgrep IOwait $infile | awk '{print $3}' | computestatsf
+ grep -F IOwait "$infile" | awk '{print $3}' | computestatsf
echo "Device util% for $system_block_device blkdev :"
- fgrep 'Device util' $infile | awk '{print $4}' | computestatsf
+ grep -F 'Device util' "$infile" | awk '{print $4}' | computestatsf
fi
}
@@ -117,7 +117,7 @@ cpufreq_volantis() {
overnor"
$adb shell "echo 2499000 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_fr\
eq"
- i=`expr $i + 1`
+ i=$((i + 1))
done
# Lock the GPU frequencies
echo -n 852000000 > /d/clock/override.gbus/rate
@@ -136,7 +136,7 @@ cpufreq_fugu() {
do
$adb shell "echo performance > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
$adb shell "echo 1833000 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
- i=`expr $i + 1`
+ i=$((i + 1))
done
}
@@ -210,7 +210,7 @@ cpufreq_angler () {
while [ $i -lt $num_cores ]
do
$adb shell "echo 0 > /sys/devices/system/cpu/cpu$i/online"
- i=`expr $i + 1`
+ i=$((i + 1))
done
else
echo "Enabling All Cores"
@@ -224,7 +224,7 @@ cpufreq_angler () {
$adb shell "echo performance > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
# Lock frequency of little cores
$adb shell "echo 1555200 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
- i=`expr $i + 1`
+ i=$((i + 1))
done
fi
i=4
@@ -234,7 +234,7 @@ cpufreq_angler () {
$adb shell "echo performance > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
# Lock frequency of big cores
$adb shell "echo 1958400 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
- i=`expr $i + 1`
+ i=$((i + 1))
done
}
@@ -291,20 +291,20 @@ get_marlin_sailfish_devnames () {
get_angler_devnames () {
# Get the underlying bdev from the "by-name" mapping
- system_block_device=`$adb shell 'find /dev/block/platform -name by-name | xargs ls -l' | grep system | awk '{ print $10 }' `
+ system_block_device=$($adb shell 'find /dev/block/platform -name by-name | xargs ls -l' | grep system | awk '{ print $10 }')
# extract the last component of the absolute device pathname we got above
- system_block_device=`echo $system_block_device | awk 'BEGIN { FS ="/" } ; { print $4 }' `
+ system_block_device=$(echo "$system_block_device" | awk 'BEGIN { FS ="/" } ; { print $4 }')
# vendor is unused right now, but get the bdev anyway in case we decide to use it
# Get the underlying bdev from the "by-name" mapping
- vendor_block_device=`$adb shell 'find /dev/block/platform -name by-name | xargs ls -l' | grep vendor | awk '{ print $10 }' `
+ vendor_block_device=$($adb shell 'find /dev/block/platform -name by-name | xargs ls -l' | grep vendor | awk '{ print $10 }')
# extract the last component of the absolute device pathname we got above
- vendor_block_device=`echo $vendor_block_device | awk 'BEGIN { FS ="/" } ; { print $4 }' `
- system_bdev_set=true
+ vendor_block_device=$(echo "$vendor_block_device" | awk 'BEGIN { FS ="/" } ; { print $4 }')
+ system_bdev_set=true
}
get_fugu_devnames () {
- system_block_device=`$adb shell ls -l /dev/block/by-name/system | awk '{ print $10 }' `
- system_block_device=`echo $system_block_device | awk 'BEGIN { FS ="/" } ; { print $4 }' `
+ system_block_device=$($adb shell ls -l /dev/block/by-name/system | awk '{ print $10 }')
+ system_block_device=$(echo "$system_block_device" | awk 'BEGIN { FS ="/" } ; { print $4 }')
system_bdev_set=true
}
@@ -324,55 +324,55 @@ get_go_devnames () {
system_stats_before() {
if [ $system_bdev_set == true ]; then
# Get BEFORE read stats for /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 }'`
+ 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
- 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) }'`
+ 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
- uptime=`$adb shell 'cat /proc/uptime'`
- uptime_before_ms=`echo $uptime | awk '{ print ($1 * 1000) }'`
- device_util_before_ms=`echo $system | awk '{ print ($13) }'`
+ uptime=$($adb shell 'cat /proc/uptime')
+ uptime_before_ms=$(echo "$uptime" | awk '{ print ($1 * 1000) }')
+ device_util_before_ms=$(echo "$system" | awk '{ print ($13) }')
fi
}
system_stats_after() {
if [ $system_bdev_set == true ]; then
# Get AFTER read stats for /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 }'`
+ 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
- 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) }'`
+ 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
- uptime=`$adb shell 'cat /proc/uptime'`
- uptime_after_ms=`echo $uptime | awk '{ print ($1 * 1000) }'`
- device_util_after_ms=`echo $system | awk '{ print ($13) }'`
+ uptime=$($adb shell 'cat /proc/uptime')
+ uptime_after_ms=$(echo "$uptime" | awk '{ print ($1 * 1000) }')
+ device_util_after_ms=$(echo "$system" | awk '{ print ($13) }')
fi
}
system_stats_delta() {
if [ $system_bdev_set == true ]; then
# Sectors to KB
- READ_KB_SYSTEM=`expr $AFTER_RD_SECTORS_SYSTEM - $BEFORE_RD_SECTORS_SYSTEM`
- READ_KB_SYSTEM=`expr $READ_KB_SYSTEM / 2`
- echo Read IOs /system = `expr $AFTER_RD_IOS_SYSTEM - $BEFORE_RD_IOS_SYSTEM`
+ READ_KB_SYSTEM=$((AFTER_RD_SECTORS_SYSTEM - BEFORE_RD_SECTORS_SYSTEM))
+ READ_KB_SYSTEM=$((READ_KB_SYSTEM / 2))
+ echo Read IOs /system = $((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_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) }'
+ 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_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) }'
fi
}
@@ -384,12 +384,12 @@ launch_app() {
printf "Testing %s: \n" "$package" 1>&2
i=0
- while [ $i -lt $iterations ]
+ while [ $i -lt "$iterations" ]
do
if [ $pagecached == false ]; then
$adb shell 'echo 3 > /proc/sys/vm/drop_caches'
fi
- printf '[ %d%% ]\r' "$(($i * 100 / $iterations))" 1>&2
+ printf '[ %d%% ]\r' "$((i * 100 / iterations))" 1>&2
# The -W argument to am start forces am start to wait till the launch completes.
# The -S argument forces it to kill any existing app that is running first
# eg. adb shell 'am start -W -S -n com.android.chrome/com.google.android.apps.chrome.Main'
@@ -400,40 +400,42 @@ launch_app() {
sleep 1
$adb shell "am force-stop $package"
sleep 1
- i=`expr $i + 1`
+ i=$((i + 1))
done
printf "\n" 1>&2
}
launch_fugu_apps() {
- 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_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 > $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
+ 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
}
launch_go_apps() {
- launch_app com.android.chrome com.google.android.apps.chrome.Main > $BASHPID-chrome-$model
- getstats $BASHPID-chrome-$model Chrome
- launch_app com.google.android.gm .ConversationListActivityGmail > $BASHPID-gmail-$model
- getstats $BASHPID-gmail-$model Gmail
- launch_app com.google.android.videos .mobile.usecase.home.RootActivity > $BASHPID-movies-$model
- getstats $BASHPID-movies-$model Movies
- launch_app com.android.vending com.google.android.finsky.activities.MainActivity > $BASHPID-play-$model
- getstats $BASHPID-play-$model Play
+ launch_app com.android.chrome com.google.android.apps.chrome.Main > "$BASHPID-chrome-$model"
+ getstats "$BASHPID-chrome-$model" Chrome
+ launch_app com.google.android.gm.lite com.google.android.gm.ConversationListActivityGmail > "$BASHPID-gmailgo-$model"
+ getstats "$BASHPID-gmailgo-$model" GmailGo
+ launch_app com.google.android.apps.youtube.mango com.google.android.apps.youtube.lite.frontend.activities.SplashActivity > "$BASHPID-youtubego-$model"
+ getstats "$BASHPID-youtubego-$model" YouTubeGo
+ launch_app com.android.vending com.google.android.finsky.activities.MainActivity > "$BASHPID-play-$model"
+ getstats "$BASHPID-play-$model" Play
+ launch_app com.android.settings com.android.settings.Settings > "$BASHPID-settings-$model"
+ getstats "$BASHPID-settings-$model" Settings
}
usage() {
@@ -485,19 +487,17 @@ if [ $# -lt 2 ]; then
usage
fi
-which computestats > /dev/null
-if [ $? != 0 ]; then
+if ! which computestats > /dev/null ; then
echo "ERROR: Please add computestats utiliy to your PATH"
exit 1
fi
-which computestatsf > /dev/null
-if [ $? != 0 ]; then
+if ! which computestatsf > /dev/null ; then
echo "Error: Please add computestatsf utility to your PATH"
exit 1
fi
-parseoptions $@
+parseoptions "$@"
$adb root && $adb wait-for-device
@@ -510,11 +510,10 @@ else
echo "User Experience: Default Configs. No changes to cpufreq settings"
fi
-model=`$adb shell getprop ro.product.name`
# Releases are inconsistent with various trailing characters, remove them all
-model=`echo $model | sed 's/[ \t\r\n]*$//' `
+model=$($adb shell getprop ro.product.name | sed 's/[ \t\r\n]*$//')
-echo Found $model Device
+echo "Found $model Device"
system_bdev_set=false
case $model in
@@ -556,7 +555,7 @@ case $model in
get_volantis_devnames
;;
*)
- echo Unknown Device $model
+ echo "Unknown Device $model"
exit 1
;;
esac
diff --git a/boottime_tools/bootanalyze/bootanalyze.py b/boottime_tools/bootanalyze/bootanalyze.py
index e5c1f555..f765cb99 100755
--- a/boottime_tools/bootanalyze/bootanalyze.py
+++ b/boottime_tools/bootanalyze/bootanalyze.py
@@ -250,23 +250,25 @@ def capture_bugreport(bugreport_hint, boot_complete_time):
def generate_timing_points(timing_events, timings):
timing_points = collections.OrderedDict()
+ monitor_contention_points = collections.OrderedDict()
for k, l in timing_events.iteritems():
for v in l:
- name, time_v = extract_timing(v, timings)
+ name, time_v, dict = extract_timing(v, timings)
if name and time_v:
if v.find("SystemServerTimingAsync") > 0:
name = "(" + name + ")"
+ if k.endswith("_secs"):
+ time_v = time_v * 1000.0
+ if k.startswith("long_monitor_contention"):
+ monitor_contention_points[v] = time_v
+ continue
new_name = name
name_index = 0
while timing_points.get(new_name): # if the name is already taken, append #digit
name_index += 1
new_name = name + "#" + str(name_index)
- name = new_name
- if k.endswith("_secs"):
- timing_points[name] = time_v * 1000.0
- else:
- timing_points[name] = time_v
- return timing_points
+ timing_points[new_name] = time_v
+ return timing_points, monitor_contention_points
def dump_timing_points(msg_header, timing_points):
print msg_header + " event timing in time order, key: time"
@@ -281,6 +283,13 @@ def dump_timing_points(msg_header, timing_points):
item[0], item[1])
print "-----------------"
+def dump_monitor_contentions(logcat_monitor_contentions):
+ print "Monitor contentions over 100ms:"
+ for item in logcat_monitor_contentions.items():
+ if item[1] > 100:
+ print '{0:<7.5}ms: {1}'.format(item[1], item[0])
+ print "-----------------"
+
def handle_reboot_log(capture_log_on_error, shutdown_events_pattern, components_to_monitor):
shutdown_events, shutdown_timing_events = collect_logcat_for_shutdown(capture_log_on_error,\
shutdown_events_pattern, components_to_monitor)
@@ -361,8 +370,8 @@ def iterate(args, search_events_pattern, timings_pattern, shutdown_events_patter
print "BootAnimEnd time or BootComplete-kernel not captured in both log" +\
", cannot get time diff"
return None, None, None, None, None, None
- diffs.append((logcat_event_time[KERNEL_BOOT_COMPLETE],\
- logcat_event_time[KERNEL_BOOT_COMPLETE] - dmesg_event_time[KERNEL_BOOT_COMPLETE]))
+ diffs.append((logcat_event_time[LOGCAT_BOOT_COMPLETE],\
+ logcat_event_time[LOGCAT_BOOT_COMPLETE] - dmesg_event_time[KERNEL_BOOT_COMPLETE]))
for k, v in logcat_event_time.iteritems():
debug("event[{0}, {1}]".format(k, v))
@@ -398,10 +407,12 @@ def iterate(args, search_events_pattern, timings_pattern, shutdown_events_patter
print "-----------------"
if args.timings:
- kernel_timing_points = generate_timing_points(kernel_timing_events, timings_pattern)
- logcat_timing_points = generate_timing_points(logcat_timing_events, timings_pattern)
+ kernel_timing_points, _ = generate_timing_points(kernel_timing_events, timings_pattern)
+ logcat_timing_points, logcat_monitor_contentions =\
+ generate_timing_points(logcat_timing_events, timings_pattern)
dump_timing_points("Kernel", kernel_timing_points)
dump_timing_points("Logcat", logcat_timing_points)
+ dump_monitor_contentions(logcat_monitor_contentions)
for item in sorted(events.items(), key=operator.itemgetter(1)):
data_points[item[0]] = {
@@ -472,8 +483,8 @@ def extract_timing(s, patterns):
for k, p in patterns.iteritems():
m = p.search(s)
if m:
- g_dict = m.groupdict()
- return g_dict['name'], float(g_dict['time'])
+ dict = m.groupdict()
+ return dict['name'], float(dict['time']), dict
return None, None
def init_arguments():
diff --git a/boottime_tools/bootanalyze/config.yaml b/boottime_tools/bootanalyze/config.yaml
index 17730dc9..e4f0ef42 100644
--- a/boottime_tools/bootanalyze/config.yaml
+++ b/boottime_tools/bootanalyze/config.yaml
@@ -9,6 +9,8 @@ timings:
init_service_exec_secs: init:\sService\s.*exec\s\S+\s\((?P<name>\S.+)\).*pid.*\swaiting\stook\s(?P<time>[.0-9]+)\sseconds
zygote64_timing: (?P<name>Zygote64Timing\:\s\S+)\stook\sto\scomplete\:\s(?P<time>[0-9]+)ms
zygote32_timing: (?P<name>Zygote32Timing\:\s\S+)\stook\sto\scomplete\:\s(?P<time>[0-9]+)ms
+ long_monitor_contention_secs: \s(?P<component>\S+)\sLong\smonitor\scontention\swith\sowner\s(?P<name>\S.+).*\sfor\s(?P<time>[.0-9]+)s
+ long_monitor_contention_ms: \s(?P<component>\S+)\sLong\smonitor\scontention\swith\sowner\s(?P<name>\S.+).*\sfor\s(?P<time>[.0-9]+)ms
events:
kernel: Linux version
android_init_1st_stage: init first stage started
@@ -55,7 +57,7 @@ events:
KeyguardShown: KeyguardServiceDelegate.*\*\*\*\* SHOWN CALLED \*\*\*\*
BootComplete: Starting phase 1000
BootComplete_kernel: processing action \(sys\.boot_completed=1\)
- LauncherStart: START.*HOME.*(NexusLauncherActivity|GEL|LensPickerTrampolineActivity|SetupWizardActivity)
+ LauncherStart: START.*HOME.*(NexusLauncherActivity|GEL|LensPickerTrampolineActivity|SetupWizardActivity|CarLauncher)
FsStat: fs_stat, partition:userdata stat:(0x\S+)
shutdown_events:
ShutdownStart: ShutdownThread:\sNotifying thread to start shutdown
diff --git a/ioblame/ioblame.sh b/ioblame/ioblame.sh
index c9ef54be..d6943e92 100755
--- a/ioblame/ioblame.sh
+++ b/ioblame/ioblame.sh
@@ -44,7 +44,7 @@ getmodel() {
aosp_gobo | gobo | gobo_512)
get_go_devnames
;;
- marlin | sailfish)
+ marlin | sailfish | walleye | taimen | blueline | crosshatch)
get_marlin_sailfish_devnames
;;
angler)
@@ -57,8 +57,8 @@ getmodel() {
get_volantis_devnames
;;
*)
- echo Unknown Device $model
- exit 1
+ echo Unknown Device $model -- trying Pixel config
+ get_marlin_sailfish_devnames
;;
esac
}
diff --git a/zram-perf/zram-perf.cpp b/zram-perf/zram-perf.cpp
index 32a03ad2..93a2cc15 100644
--- a/zram-perf/zram-perf.cpp
+++ b/zram-perf/zram-perf.cpp
@@ -1,29 +1,38 @@
-#include <iostream>
-#include <chrono>
-#include <numeric>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
#include <linux/fs.h>
-#include <unistd.h>
+#include <sys/stat.h>
#include <sys/swap.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <chrono>
+#include <iostream>
+#include <numeric>
+#include <vector>
using namespace std;
-const char zram_blkdev_path[] = "/dev/block/zram0";
-const size_t sector_size = 512;
-const size_t page_size = 4096;
+static const size_t kPageSize = sysconf(_SC_PAGESIZE);
+static constexpr char kZramBlkdevPath[] = "/dev/block/zram0";
+static constexpr size_t kPatternSize = 4;
+static constexpr size_t kSectorSize = 512;
void fillPageRand(uint32_t *page) {
- int start = rand();
- for (int i = 0; i < page_size / sizeof(int); i++) {
+ uint32_t start = rand();
+ for (int i = 0; i < kPageSize / sizeof(start); i++) {
page[i] = start+i;
}
}
-void fillPageCompressible(uint32_t *page) {
- int val = rand() & 0xfff;
- for (int i = 0; i < page_size / sizeof(int); i++) {
- page[i] = val;
+void fillPageCompressible(void* page) {
+ uint32_t val = rand() & 0xfff;
+ auto page_ptr = reinterpret_cast<typeof(val)*>(page);
+ std::vector<typeof(val)> pattern(kPatternSize, 0);
+
+ for (auto i = 0u; i < kPatternSize; i++) {
+ pattern[i] = val + i;
+ }
+ // fill in ABCD... pattern
+ for (int i = 0; i < kPageSize / sizeof(val); i += kPatternSize) {
+ std::copy_n(pattern.data(), kPatternSize, (page_ptr + i));
}
}
@@ -51,9 +60,9 @@ public:
size_t blockSize = 0;
int result = ioctl(m_fd, BLKGETSIZE, &blockSize);
if (result < 0) {
- cout << "ioctl failed" << endl;
+ cout << "ioctl block size failed" << endl;
}
- return blockSize * sector_size;
+ return blockSize * kSectorSize;
}
~BlockFd() {
if (m_fd >= 0) {
@@ -62,11 +71,11 @@ public:
}
void fillWithCompressible() {
size_t devSize = getSize();
- AlignedAlloc page(page_size, page_size);
- for (uint64_t offset = 0; offset < devSize; offset += page_size) {
+ AlignedAlloc page(kPageSize, kPageSize);
+ for (uint64_t offset = 0; offset < devSize; offset += kPageSize) {
fillPageCompressible((uint32_t*)page.ptr());
- ssize_t ret = write(m_fd, page.ptr(), page_size);
- if (ret != page_size) {
+ ssize_t ret = write(m_fd, page.ptr(), kPageSize);
+ if (ret != kPageSize) {
cout << "write() failed" << endl;
}
}
@@ -75,15 +84,15 @@ public:
chrono::time_point<chrono::high_resolution_clock> start, end;
size_t devSize = getSize();
size_t passes = 4;
- AlignedAlloc page(page_size, page_size);
+ AlignedAlloc page(kPageSize, kPageSize);
start = chrono::high_resolution_clock::now();
for (int i = 0; i < passes; i++) {
- for (uint64_t offset = 0; offset < devSize; offset += page_size) {
+ for (uint64_t offset = 0; offset < devSize; offset += kPageSize) {
if (offset == 0)
lseek(m_fd, offset, SEEK_SET);
- ssize_t ret = read(m_fd, page.ptr(), page_size);
- if (ret != page_size) {
+ ssize_t ret = read(m_fd, page.ptr(), kPageSize);
+ if (ret != kPageSize) {
cout << "read() failed" << endl;
}
}
@@ -96,16 +105,16 @@ public:
chrono::time_point<chrono::high_resolution_clock> start, end;
size_t devSize = getSize();
size_t passes = 4;
- AlignedAlloc page(page_size, page_size);
+ AlignedAlloc page(kPageSize, kPageSize);
start = chrono::high_resolution_clock::now();
for (int i = 0; i < passes; i++) {
- for (uint64_t offset = 0; offset < devSize; offset += page_size) {
+ for (uint64_t offset = 0; offset < devSize; offset += kPageSize) {
fillPageCompressible((uint32_t*)page.ptr());
if (offset == 0)
lseek(m_fd, offset, SEEK_SET);
- ssize_t ret = write(m_fd, page.ptr(), page_size);
- if (ret != page_size) {
+ ssize_t ret = write(m_fd, page.ptr(), kPageSize);
+ if (ret != kPageSize) {
cout << "write() failed" << endl;
}
}
@@ -119,7 +128,7 @@ public:
int bench(bool direct)
{
- BlockFd zramDev{zram_blkdev_path, direct};
+ BlockFd zramDev{kZramBlkdevPath, direct};
zramDev.fillWithCompressible();
zramDev.benchSequentialRead();
@@ -129,20 +138,20 @@ int bench(bool direct)
int main(int argc, char *argv[])
{
- int result = swapoff(zram_blkdev_path);
+ int result = swapoff(kZramBlkdevPath);
if (result < 0) {
cout << "swapoff failed: " << strerror(errno) << endl;
}
bench(1);
- result = system((string("mkswap ") + string(zram_blkdev_path)).c_str());
+ result = system((string("mkswap ") + string(kZramBlkdevPath)).c_str());
if (result < 0) {
cout << "mkswap failed: " << strerror(errno) << endl;
return -1;
}
- result = swapon(zram_blkdev_path, 0);
+ result = swapon(kZramBlkdevPath, 0);
if (result < 0) {
cout << "swapon failed: " << strerror(errno) << endl;
return -1;