]> granicus.if.org Git - strace/commitdiff
count: provide alternative names for sorting options
authorEugene Syromyatnikov <evgsyr@gmail.com>
Tue, 4 Sep 2018 11:22:11 +0000 (13:22 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 6 Aug 2019 13:38:20 +0000 (13:38 +0000)
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 <ldv@altlinux.org>
count.c
strace.1.in
tests/strace-S.test

diff --git a/count.c b/count.c
index 329909ec3583c234213d6581007c7cc078d5eff2..57af23f87937fc38b3f1ae7dae48f8d1452ec050 100644 (file)
--- 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" },
        };
 
index 390bd5d10005cb848e6e19073b2fd7287c7ba865..1437bb72520b6f5db821dff16809b96db2faea64 100644 (file)
@@ -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
index 8ced679b24025163e975e299075987f18e9d0160..25f095e23e24a7b4c6c80afad3b7ecf2a5eae193 100755 (executable)
@@ -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