From 3843af638cd7d0cd0aa46121d45cb52ed23596b0 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Tue, 4 Sep 2018 13:22:11 +0200 Subject: [PATCH] count: provide alternative names for sorting options as some might be easier to remember than others. * count.c (set_sortby): Add aliases for the existing sorting options. * strace.1.in (.SH OPTIONS) <-S>: Document new aliases. * tests/strace-S.test: Check new sort keys. Co-Authored-by: Dmitry V. Levin --- count.c | 6 ++++++ strace.1.in | 12 ++++++------ tests/strace-S.test | 6 +++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/count.c b/count.c index 329909ec..57af23f8 100644 --- a/count.c +++ b/count.c @@ -96,8 +96,14 @@ set_sortby(const char *sortby) const char *name; } sort_fns[] = { { time_cmp, "time" }, + { time_cmp, "time_total" }, + { time_cmp, "total_time" }, { count_cmp, "calls" }, + { count_cmp, "count" }, { syscall_cmp, "name" }, + { syscall_cmp, "syscall" }, + { syscall_cmp, "syscall_name" }, + { NULL, "none" }, { NULL, "nothing" }, }; diff --git a/strace.1.in b/strace.1.in index 390bd5d1..1437bb72 100644 --- a/strace.1.in +++ b/strace.1.in @@ -794,13 +794,13 @@ system call time to the total produced using Sort the output of the histogram printed by the .B \-c option by the specified criterion. Legal values are -.BR time , -.BR calls , -.BR name , +.BR time " (or " time_total " or " total_time ), +.BR calls " (or " count ), +.BR name " (or " syscall " or " syscall_name ), and -.B nothing -(default is -.BR time ). +.BR nothing " (or " none ); +default is +.BR time . .TP .B \-w Summarise the time difference between the beginning and end of diff --git a/tests/strace-S.test b/tests/strace-S.test index 8ced679b..25f095e2 100755 --- a/tests/strace-S.test +++ b/tests/strace-S.test @@ -31,15 +31,15 @@ test_c() } c='[[:space:]]+([^[:space:]]+)' -for s in '' time; do +for s in '' time time_total total_time; do test_c "$s" '-n -r' \ 's/^[[:space:]]+([0-9]+)[.,]([0-9]+)[[:space:]].*/\1\t\2/p' done -for s in calls; do +for s in calls count; do test_c "$s" '-n -r' \ '/^[[:space:]]+[0-9]/ s/^'"$c$c$c$c"'[[:space:]].*/\4/p' done -for s in name; do +for s in name syscall syscall_name; do test_c "$s" '' \ '/^[[:space:]]+[0-9]/ s/^'"$c$c$c$c"'([[:space:]]+[0-9]+)?'"$c"'$/\6/p' done -- 2.40.0