diff options
author | Jaegeuk Kim <jaegeuk@google.com> | 2022-08-19 17:22:04 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@google.com> | 2022-09-20 15:38:26 -0700 |
commit | fa1d990a913ed08ad1b15283954241fc9177f597 (patch) | |
tree | 036452b19b203f06e153b13275b76ac0fddb00b9 | |
parent | 78b1b1b752ad9d49b04b9f74aaac97fea977f2f1 (diff) | |
download | extras-fa1d990a913ed08ad1b15283954241fc9177f597.tar.gz |
Replace android_fs tracepoints with f2fs tracepoints
Bug: 225959108
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I883a4c3860016e63e95268355eb7a8588d2f12f4
-rw-r--r-- | ioblame/androidFsParser.py | 10 | ||||
-rw-r--r-- | ioblame/ioblame.py | 18 | ||||
-rwxr-xr-x | ioblame/ioblame.sh | 36 | ||||
-rw-r--r-- | ioshark/collect-straces-ftraces.sh | 8 | ||||
-rw-r--r-- | ioshark/compile-only.sh | 4 |
5 files changed, 38 insertions, 38 deletions
diff --git a/ioblame/androidFsParser.py b/ioblame/androidFsParser.py index 6ea38dc3..c47b6f1d 100644 --- a/ioblame/androidFsParser.py +++ b/ioblame/androidFsParser.py @@ -14,16 +14,16 @@ # See the License for the specific language governing permissions and # limitations under the License. # -"""Trace parser for android_fs traces.""" +"""Trace parser for f2fs traces.""" import collections import re -# ex) bt_stack_manage-21277 [000] .... 5879.043608: android_fs_datawrite_start: entry_name /misc/bluedroid/bt_config.bak.new, offset 0, bytes 408, cmdline bt_stack_manage, pid 21277, i_size 0, ino 9103 -RE_WRITE_START = r".+-([0-9]+).*\s+([0-9]+\.[0-9]+):\s+android_fs_datawrite_start:\sentry_name\s(\S+)\,\soffset\s([0-9]+)\,\sbytes\s([0-9]+)\,\scmdline\s(\S+)\,\spid\s([0-9]+)\,\si_size\s([0-9]+)\,\sino\s([0-9]+)" +# ex) bt_stack_manage-21277 [000] .... 5879.043608: f2fs_datawrite_start: entry_name /misc/bluedroid/bt_config.bak.new, offset 0, bytes 408, cmdline bt_stack_manage, pid 21277, i_size 0, ino 9103 +RE_WRITE_START = r".+-([0-9]+).*\s+([0-9]+\.[0-9]+):\s+f2fs_datawrite_start:\sentry_name\s(\S+)\,\soffset\s([0-9]+)\,\sbytes\s([0-9]+)\,\scmdline\s(\S+)\,\spid\s([0-9]+)\,\si_size\s([0-9]+)\,\sino\s([0-9]+)" -# ex) dumpsys-21321 [001] .... 5877.599324: android_fs_dataread_start: entry_name /system/lib64/libbinder.so, offset 311296, bytes 4096, cmdline dumpsys, pid 21321, i_size 848848, ino 2397 -RE_READ_START = r".+-([0-9]+).*\s+([0-9]+\.[0-9]+):\s+android_fs_dataread_start:\sentry_name\s(\S+)\,\soffset\s([0-9]+)\,\sbytes\s([0-9]+)\,\scmdline\s(\S+)\,\spid\s([0-9]+)\,\si_size\s([0-9]+)\,\sino\s([0-9]+)" +# ex) dumpsys-21321 [001] .... 5877.599324: f2fs_dataread_start: entry_name /system/lib64/libbinder.so, offset 311296, bytes 4096, cmdline dumpsys, pid 21321, i_size 848848, ino 2397 +RE_READ_START = r".+-([0-9]+).*\s+([0-9]+\.[0-9]+):\s+f2fs_dataread_start:\sentry_name\s(\S+)\,\soffset\s([0-9]+)\,\sbytes\s([0-9]+)\,\scmdline\s(\S+)\,\spid\s([0-9]+)\,\si_size\s([0-9]+)\,\sino\s([0-9]+)" MIN_PID_BYTES = 1024 * 1024 # 1 MiB SMALL_FILE_BYTES = 1024 # 1 KiB diff --git a/ioblame/ioblame.py b/ioblame/ioblame.py index e00a5ecc..d69dda4e 100644 --- a/ioblame/ioblame.py +++ b/ioblame/ioblame.py @@ -60,7 +60,7 @@ def signal_handler(sig, frame): def init_arguments(): parser = argparse.ArgumentParser( - description="Collect and process android_fs traces") + description="Collect and process f2fs traces") parser.add_argument( "-s", "--serial", @@ -73,14 +73,14 @@ def init_arguments(): default=False, action="store_true", dest="traceReads", - help="Trace android_fs_dataread_start") + help="Trace f2fs_dataread_start") parser.add_argument( "-w", "--trace_writes", default=False, action="store_true", dest="traceWrites", - help="Trace android_fs_datawrite_start") + help="Trace f2fs_datawrite_start") parser.add_argument( "-d", "--trace_duration", @@ -187,7 +187,7 @@ def setup_tracepoints(shouldTraceReads, shouldTraceWrites): # This is a good point to check if the Android FS tracepoints are enabled in the # kernel or not isTraceEnabled = run_adb_shell_cmd( - "'if [ -d /sys/kernel/tracing/events/android_fs ]; then echo 0; else echo 1; fi'" + "'if [ -d /sys/kernel/tracing/events/f2fs ]; then echo 0; else echo 1; fi'" ) if isTraceEnabled == 0: @@ -200,12 +200,12 @@ def setup_tracepoints(shouldTraceReads, shouldTraceWrites): if shouldTraceReads: run_adb_shell_cmd( - "'echo 1 > /sys/kernel/tracing/events/android_fs/android_fs_dataread_start/enable'" + "'echo 1 > /sys/kernel/tracing/events/f2fs/f2fs_dataread_start/enable'" ) if shouldTraceWrites: run_adb_shell_cmd( - "'echo 1 > /sys/kernel/tracing/events/android_fs/android_fs_datawrite_start/enable'" + "'echo 1 > /sys/kernel/tracing/events/f2fs/f2fs_datawrite_start/enable'" ) run_adb_shell_cmd("'echo 1 > /sys/kernel/tracing/tracing_on'") @@ -214,12 +214,12 @@ def setup_tracepoints(shouldTraceReads, shouldTraceWrites): def clear_tracing(shouldTraceReads, shouldTraceWrites): if shouldTraceReads: run_adb_shell_cmd( - "'echo 0 > /sys/kernel/tracing/events/android_fs/android_fs_dataread_start/enable'" + "'echo 0 > /sys/kernel/tracing/events/f2fs/f2fs_dataread_start/enable'" ) if shouldTraceWrites: run_adb_shell_cmd( - "'echo 0 > /sys/kernel/tracing/events/android_fs/android_fs_datawrite_start/enable'" + "'echo 0 > /sys/kernel/tracing/events/f2fs/f2fs_datawrite_start/enable'" ) run_adb_shell_cmd("'echo 0 > /sys/kernel/tracing/tracing_on'") @@ -227,7 +227,7 @@ def clear_tracing(shouldTraceReads, shouldTraceWrites): def start_streaming_trace(traceFile): return run_bg_adb_shell_cmd( - "'cat /sys/kernel/tracing/trace_pipe | grep -e android_fs_data -e android_fs_writepages'\ + "'cat /sys/kernel/tracing/trace_pipe | grep -e f2fs_data -e f2fs_writepages'\ > {}".format(traceFile)) diff --git a/ioblame/ioblame.sh b/ioblame/ioblame.sh index d6943e92..7b6d6465 100755 --- a/ioblame/ioblame.sh +++ b/ioblame/ioblame.sh @@ -157,7 +157,7 @@ disk_stats_delta_wr() { clean_up_tracepoints() { # This is a good point to check if the Android FS tracepoints are enabled in the # kernel or not - tracepoint_exists=`adb shell 'if [ -d /sys/kernel/debug/tracing/events/android_fs ]; then echo 0; else echo 1; fi' ` + tracepoint_exists=`adb shell 'if [ -d /sys/kernel/debug/tracing/events/f2fs ]; then echo 0; else echo 1; fi' ` if [ $tracepoint_exists == 1 ]; then echo "Android FS tracepoints not enabled in kernel. Exiting..." exit 1 @@ -165,14 +165,14 @@ clean_up_tracepoints() { adb shell 'echo 0 > /sys/kernel/debug/tracing/tracing_on' adb shell 'echo 0 > /sys/kernel/debug/tracing/trace' if [ $trace_reads == true ]; then - adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_dataread_start/enable' + adb shell 'echo 1 > /sys/kernel/debug/tracing/events/f2fs/f2fs_dataread_start/enable' fi if [ $trace_writes == true ]; then - adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_datawrite_start/enable' + adb shell 'echo 1 > /sys/kernel/debug/tracing/events/f2fs/f2fs_datawrite_start/enable' fi if [ $f2fs_fs == 1 ] ; then if [ $trace_writepages == true ]; then - adb shell 'echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_writepages/enable' + adb shell 'echo 1 > /sys/kernel/debug/tracing/events/f2fs/f2fs_writepages/enable' fi fi adb shell 'echo 1 > /sys/kernel/debug/tracing/tracing_on' @@ -197,14 +197,14 @@ streamtrace_end() { copyout_trace() { streamtrace_end if [ $trace_reads == true ]; then - adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_dataread_start/enable' + adb shell 'echo 0 > /sys/kernel/debug/tracing/events/f2fs/f2fs_dataread_start/enable' fi if [ $trace_writes == true ]; then - adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_datawrite_start/enable' + adb shell 'echo 0 > /sys/kernel/debug/tracing/events/f2fs/f2fs_datawrite_start/enable' fi if [ $f2fs_fs == 1 ] ; then if [ $trace_writepages == true ]; then - adb shell 'echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_writepages/enable' + adb shell 'echo 0 > /sys/kernel/debug/tracing/events/f2fs/f2fs_writepages/enable' fi fi adb shell 'echo 0 > /sys/kernel/debug/tracing/tracing_on' @@ -218,11 +218,11 @@ prep_tracefile_common() { } prep_tracefile_rd() { - prep_tracefile_common android_fs_dataread + prep_tracefile_common f2fs_dataread # Strip away unnecessary stuff so we can compute latencies easily - fgrep android_fs_dataread_start $infile > foo0 - # Throw away everything upto and including android_fs_dataread: - cat foo0 | sed -n -e 's/^.*android_fs_dataread_start //p' > foo1 + fgrep f2fs_dataread_start $infile > foo0 + # Throw away everything upto and including f2fs_dataread: + cat foo0 | sed -n -e 's/^.*f2fs_dataread_start //p' > foo1 mv foo1 $infile # At this stage, $infile should the following format : # entry_name <filename> offset <offset> bytes <bytes> cmdline <cmdline> pid <pid> i_size <i_size> ino <ino> @@ -230,9 +230,9 @@ prep_tracefile_rd() { } prep_tracefile_writepages() { - prep_tracefile_common android_fs_writepages - # Throw away everything up to and including android_fs_writepages_start: - cat $infile | sed -n -e 's/^.*android_fs_writepages //p' > foo1 + prep_tracefile_common f2fs_writepages + # Throw away everything up to and including f2fs_writepages_start: + cat $infile | sed -n -e 's/^.*f2fs_writepages //p' > foo1 mv foo1 $infile # At this stage, $infile should the following format : # entry_name <filename> bytes <bytes> ino <ino> @@ -241,10 +241,10 @@ prep_tracefile_writepages() { # Latencies not supported for Writes. 'Write End' is just when the data has been # written back to page cache. prep_tracefile_wr() { - prep_tracefile_common android_fs_datawrite - fgrep android_fs_datawrite_start $infile > foo0 - # Throw away everything upto and including android_fs_datawrite: - cat foo0 | sed -n -e 's/^.*android_fs_datawrite_start //p' > foo1 + prep_tracefile_common f2fs_datawrite + fgrep f2fs_datawrite_start $infile > foo0 + # Throw away everything upto and including f2fs_datawrite: + cat foo0 | sed -n -e 's/^.*f2fs_datawrite_start //p' > foo1 mv foo1 $infile # At this stage, $infile should the following format : # entry_name <filename> offset <offset> bytes <bytes> cmdline <cmdline> pid <pid> i_size <i_size> ino <ino> diff --git a/ioshark/collect-straces-ftraces.sh b/ioshark/collect-straces-ftraces.sh index 6e83a248..3590f80a 100644 --- a/ioshark/collect-straces-ftraces.sh +++ b/ioshark/collect-straces-ftraces.sh @@ -26,9 +26,9 @@ process_strace() prep_fstrace() { # Remove leading junk - fgrep android_fs_data $1 | sed 's/^.* \[.*\] //' | sed s/://g | sed s/,//g > foo + fgrep f2fs_data $1 | sed 's/^.* \[.*\] //' | sed s/://g | sed s/,//g > foo # Sanitize the filenames, removing spaces within the filename etc - sed 's/android_fs_dataread_start/read/' foo > bar1 + sed 's/f2fs_dataread_start/read/' foo > bar1 mv bar1 bar # First column is timestamp SECONDS SINCE BOOT awk '{ print $2, "ftrace", $3, $5, $7, $9, $13 }' bar > foo @@ -125,13 +125,13 @@ catch_sigint() enable_tracepoints() { - adb shell "echo 1 > /sys/kernel/debug/tracing/events/android_fs/android_fs_dataread_start/enable" + adb shell "echo 1 > /sys/kernel/debug/tracing/events/f2fs/f2fs_dataread_start/enable" adb shell "echo 1 > /sys/kernel/debug/tracing/tracing_on" } disable_tracepoints() { - adb shell "echo 0 > /sys/kernel/debug/tracing/events/android_fs/android_fs_dataread_start/enable" + adb shell "echo 0 > /sys/kernel/debug/tracing/events/f2fs/f2fs_dataread_start/enable" adb shell "echo 0 > /sys/kernel/debug/tracing/tracing_on" } diff --git a/ioshark/compile-only.sh b/ioshark/compile-only.sh index 7a6b3cd2..ac703440 100644 --- a/ioshark/compile-only.sh +++ b/ioshark/compile-only.sh @@ -26,8 +26,8 @@ process_strace() prep_fstrace() { # Remove leading junk - fgrep android_fs_data $1 | sed 's/^.* \[.*\] //' | sed s/://g | sed s/,//g > foo - sed 's/android_fs_dataread_start/read/' foo > bar1 + fgrep f2fs_data $1 | sed 's/^.* \[.*\] //' | sed s/://g | sed s/,//g > foo + sed 's/f2fs_dataread_start/read/' foo > bar1 mv bar1 bar # First column is timestamp SECONDS SINCE BOOT awk '{ print $2, "ftrace", $3, $5, $7, $9, $13 }' bar > foo |