top: add keyboard commands to --help
authorDenys Vlasenko <dvlasenk@redhat.com>
Thu, 13 Jan 2011 15:07:51 +0000 (16:07 +0100)
committerDenys Vlasenko <dvlasenk@redhat.com>
Thu, 13 Jan 2011 15:07:51 +0000 (16:07 +0100)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
include/usage.src.h
procps/top.c

index ef2bebd8b3c1ca1fad02944e36ade0f896e3ce19..a4776a2d6779df45f6b2d7f85a9e13d5b2701922 100644 (file)
@@ -3826,14 +3826,6 @@ INSERT
        "Runs PROG. Sends SIG to it if it is not gone in SECS seconds.\n" \
        "Defaults: SECS: 10, SIG: TERM." \
 
-#define top_trivial_usage \
-       "[-b] [-nCOUNT] [-dSECONDS]" IF_FEATURE_TOPMEM(" [-m]")
-#define top_full_usage "\n\n" \
-       "Provide a view of process activity in real time.\n" \
-       "Read the status of all processes from /proc each SECONDS\n" \
-       "and display a screenful of them." \
-//TODO: add options and keyboard commands
-
 #define tr_trivial_usage \
        "[-cds] STRING1 [STRING2]"
 #define tr_full_usage "\n\n" \
index f9106fac7af6c067222a701c29916773752bbffd..1eb33dc5d3d3d39a1224ce2472f23d5993c2906a 100644 (file)
@@ -833,6 +833,35 @@ enum {
                | PSSCAN_COMM,
 };
 
+//usage:#if ENABLE_FEATURE_SHOW_THREADS || ENABLE_FEATURE_TOP_SMP_CPU
+//usage:# define IF_SHOW_THREADS_OR_TOP_SMP(...) __VA_ARGS__
+//usage:#else
+//usage:# define IF_SHOW_THREADS_OR_TOP_SMP(...)
+//usage:#endif
+//usage:#define top_trivial_usage
+//usage:       "[-b] [-nCOUNT] [-dSECONDS]" IF_FEATURE_TOPMEM(" [-m]")
+//usage:#define top_full_usage "\n\n"
+//usage:       "Provide a view of process activity in real time."
+//usage:   "\n""Read the status of all processes from /proc each SECONDS"
+//usage:   "\n""and display a screenful of them."
+//usage:   "\n""Keys:"
+//usage:   "\n""       N/M"
+//usage:                IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE("/P")
+//usage:                IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE("/T")
+//usage:           ": " IF_FEATURE_TOPMEM("show CPU usage, ") "sort by pid/mem"
+//usage:                IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE("/cpu")
+//usage:                IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE("/time")
+//usage:       IF_FEATURE_TOPMEM(
+//usage:   "\n""       S: show memory, R: reverse memory sort"
+//usage:       )
+//usage:       IF_SHOW_THREADS_OR_TOP_SMP(
+//usage:   "\n""       "
+//usage:                IF_FEATURE_SHOW_THREADS("H: toggle threads")
+//usage:                IF_FEATURE_SHOW_THREADS(IF_FEATURE_TOP_SMP_CPU(", "))
+//usage:                IF_FEATURE_TOP_SMP_CPU("1: toggle SMP")
+//usage:       )
+//usage:   "\n""       Q,^C: exit"
+
 int top_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int top_main(int argc UNUSED_PARAM, char **argv)
 {