From 56edb4e321f54ab583950e3637faa79d4cf74391 Mon Sep 17 00:00:00 2001 From: Raghavendra D Prabhu Date: Sun, 5 Jul 2015 18:43:46 +0530 Subject: [PATCH] syscount: Fix for perf list and perf script. perf list adds the header 'List of ..' which requires to be filtered, otherwise follow up commands fail. perf script has had its option for fields changed from '-f' to '-F' in recent perf. Hence, using longer option for compatibility. --- syscount | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/syscount b/syscount index ab9c4bd..c7f68ce 100755 --- a/syscount +++ b/syscount @@ -142,7 +142,7 @@ if (( opt_count && opt_verbose )); then if (( write_workaround )); then # this list must end in write to associate the filter tp=$(perf list syscalls:sys_enter_* | awk ' - $1 != "syscalls:sys_enter_write" { printf "-e %s ", $1 }') + $1 != "syscalls:sys_enter_write" && $1 ~ /syscalls:/ { printf "-e %s ", $1 }') tp="$tp -e syscalls:sys_enter_write" sh -c "perf record $tp --filter 'common_pid != '\$\$ $cpus $cmd" else @@ -151,8 +151,8 @@ if (( opt_count && opt_verbose )); then fi printf "%-6s %-16s %-17s %8s\n" "PID" "COMM" "SYSCALL" "COUNT" - perf script -f pid,comm,event | awk '$1 != "#" { - sub("sys_enter_", ""); sub(":", "") + perf script --fields pid,comm,event | awk '$1 != "#" { + sub("syscalls:sys_enter_", ""); sub(":", "") a[$1 ";" $2 ";" $3]++ } END { @@ -174,7 +174,7 @@ fi if (( opt_verbose )); then printf "%-6s %-16s %8s\n" "PID" "COMM" "COUNT" - perf script -f pid,comm | awk '$1 != "#" { a[$1 ";" $2]++ } + perf script --fields pid,comm | awk '$1 != "#" { a[$1 ";" $2]++ } END { for (k in a) { split(k, b, ";"); @@ -183,7 +183,7 @@ if (( opt_verbose )); then }' | sort -n -k3 | $tcmd else printf "%-16s %8s\n" "COMM" "COUNT" - perf script -f comm | awk '$1 != "#" { a[$1]++ } + perf script --fields comm | awk '$1 != "#" { a[$1]++ } END { for (k in a) { printf "%-16s %8d\n", k, a[k]