From 16e0e1f7ca0859367ee94884ed1ae463bdab4643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 4 May 2017 16:42:41 +0200 Subject: [PATCH] perf: add documentation --- src/systemcmds/perf/perf.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/systemcmds/perf/perf.c b/src/systemcmds/perf/perf.c index 49551aec93..b030ee8df1 100644 --- a/src/systemcmds/perf/perf.c +++ b/src/systemcmds/perf/perf.c @@ -31,36 +31,30 @@ * ****************************************************************************/ -/**************************************************************************** - * Included Files - ****************************************************************************/ #include +#include #include #include #include #include "systemlib/perf_counter.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - __EXPORT int perf_main(int argc, char *argv[]); -/**************************************************************************** - * user_start - ****************************************************************************/ + +static void print_usage(void) +{ + PRINT_MODULE_DESCRIPTION("Tool to print performance counters"); + + PRINT_MODULE_USAGE_NAME_SIMPLE("perf", "command"); + PRINT_MODULE_USAGE_COMMAND_DESCR("reset", "Reset all counters"); + PRINT_MODULE_USAGE_COMMAND_DESCR("latency", "Print HRT timer latency histogram"); + + PRINT_MODULE_USAGE_PARAM_COMMENT("Prints all performance counters if no arguments given"); +} + int perf_main(int argc, char *argv[]) { @@ -75,7 +69,7 @@ int perf_main(int argc, char *argv[]) return 0; } - printf("Usage: perf [reset | latency]\n"); + print_usage(); return -1; }