Skip to contentSkip to conversation

perf kmem: Show usage if no option is specified

PATCH Applied Li Zefan 3 participants 7 messages Dec 10, 2009 perf events

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/2 perf kmem: Show usage if no option is specified

As Ingo suggested, make "perf kmem" show help information. "perf kmem stat [--caller] [--alloc] .." will show memory statistics.

---
 tools/perf/Documentation/perf-kmem.txt |   13 +++++---
 tools/perf/builtin-kmem.c              |   52 ++++++++++++++++++--------------
 2 files changed, 37 insertions(+), 28 deletions(-)
tools/perf/Documentation/perf-kmem.txt +8 -5
index 44b0ce3..eac4d85 100644
@@ -8,16 +8,16 @@ perf-kmem - Tool to trace/measure kernel memory(slab) properties
 SYNOPSIS
 --------
 [verse]
-'perf kmem' {record} [<options>]
+'perf kmem' {record|stat} [<options>]
 
 DESCRIPTION
 -----------
-There's two variants of perf kmem:
+There are two variants of perf kmem:
 
   'perf kmem record <command>' to record the kmem events
   of an arbitrary workload.
 
-  'perf kmem' to report kernel memory statistics.
+  'perf kmem stat' to report kernel memory statistics.
 
 OPTIONS
 -------
@@ -25,8 +25,11 @@ OPTIONS
 --input=<file>::
 	Select the input file (default: perf.data)
 
---stat=<caller|alloc>::
-	Select per callsite or per allocation statistics
+--caller::
+	Show per-callsite statistics
+
+--alloc::
+	Show per-allocation statistics
 
 -s <key[,key2...]>::
 --sort=<key[,key2...]>::
tools/perf/builtin-kmem.c +29 -23

86 lines not on this page · raw message

Signature · 1 line
1.6.3
author
#1 lore raw

PATCH 2/2 perf tools: Align long options which have no short forms

Before:

$ ./perf kmem
...
    -l, --line <num>      show n lines
    --raw-ip              show raw ip instead of symbol

After:

$ ./perf kmem
...
    -l, --line <num>      show n lines
        --raw-ip          show raw ip instead of symbol
---
 tools/perf/util/parse-options.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
tools/perf/util/parse-options.c +3 -0
index 6d8af48..efebd5b 100644
@@ -430,6 +430,9 @@ int usage_with_options_internal(const char * const *usagestr,
 		pos = fprintf(stderr, "    ");
 		if (opts->short_name)
 			pos += fprintf(stderr, "-%c", opts->short_name);
+		else
+			pos += fprintf(stderr, "    ");
+
 		if (opts->long_name && opts->short_name)
 			pos += fprintf(stderr, ", ");
 		if (opts->long_name)
Signature · 1 line
1.6.3
#5 lore raw
In reply to Li Zefan
Commit-ID:  90b86a9f7dc22e7ff8e8c79ed553860454ff8dd9
Gitweb:     http://git.kernel.org/tip/90b86a9f7dc22e7ff8e8c79ed553860454ff8dd9
Author:     Li Zefan <[email protected]>
AuthorDate: Thu, 10 Dec 2009 15:21:57 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 10 Dec 2009 08:30:27 +0100

perf kmem: Show usage if no option is specified

As Ingo suggested, make "perf kmem" show help information. "perf kmem stat [--caller] [--alloc] .." will show memory statistics.

LKML-Reference: <[email protected]>

---
 tools/perf/Documentation/perf-kmem.txt |   13 +++++---
 tools/perf/builtin-kmem.c              |   52 ++++++++++++++++++--------------
 2 files changed, 37 insertions(+), 28 deletions(-)
tools/perf/Documentation/perf-kmem.txt +8 -5
index 44b0ce3..eac4d85 100644
@@ -8,16 +8,16 @@ perf-kmem - Tool to trace/measure kernel memory(slab) properties
 SYNOPSIS
 --------
 [verse]
-'perf kmem' {record} [<options>]
+'perf kmem' {record|stat} [<options>]
 
 DESCRIPTION
 -----------
-There's two variants of perf kmem:
+There are two variants of perf kmem:
 
   'perf kmem record <command>' to record the kmem events
   of an arbitrary workload.
 
-  'perf kmem' to report kernel memory statistics.
+  'perf kmem stat' to report kernel memory statistics.
 
 OPTIONS
 -------
@@ -25,8 +25,11 @@ OPTIONS
 --input=<file>::
 	Select the input file (default: perf.data)
 
---stat=<caller|alloc>::
-	Select per callsite or per allocation statistics
+--caller::
+	Show per-callsite statistics
+
+--alloc::
+	Show per-allocation statistics
 
 -s <key[,key2...]>::
 --sort=<key[,key2...]>::
tools/perf/builtin-kmem.c +29 -23

86 lines not on this page · raw message

#6 lore raw

[tip:perf/urgent] perf kmem: Fix unused argument build warning

In reply to Li Zefan
Commit-ID:  7931241694b25589658b1ceb02218d2750540ae0
Gitweb:     http://git.kernel.org/tip/7931241694b25589658b1ceb02218d2750540ae0
Author:     Ingo Molnar <[email protected]>
AuthorDate: Thu, 10 Dec 2009 08:43:34 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 10 Dec 2009 08:44:39 +0100

perf kmem: Fix unused argument build warning

Fix:

builtin-kmem.c: In function 'parse_caller_opt':
builtin-kmem.c:690: error: unused parameter 'arg' builtin-kmem.c: In function 'parse_alloc_opt':
builtin-kmem.c:697: error: unused parameter 'arg'

Cc: Li Zefan <[email protected]>
Cc: Pekka Enberg <[email protected]>
LKML-Reference: <[email protected]>

---
 tools/perf/builtin-kmem.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-kmem.c +2 -2
index 1b04787..5f20951 100644
@@ -687,14 +687,14 @@ static int parse_sort_opt(const struct option *opt __used,
 }
 
 static int parse_caller_opt(const struct option *opt __used,
-			  const char *arg, int unset __used)
+			  const char *arg __used, int unset __used)
 {
 	caller_flag = (alloc_flag + 1);
 	return 0;
 }
 
 static int parse_alloc_opt(const struct option *opt __used,
-			  const char *arg, int unset __used)
+			  const char *arg __used, int unset __used)
 {
 	alloc_flag = (caller_flag + 1);
 	return 0;
#2 lore raw

[tip:perf/urgent] perf tools: Align long options which have no short forms

In reply to Li Zefan
Commit-ID:  bc3abfb1b50964ffbbd0fc4e1ffe598b1b63a8c7
Gitweb:     http://git.kernel.org/tip/bc3abfb1b50964ffbbd0fc4e1ffe598b1b63a8c7
Author:     Li Zefan <[email protected]>
AuthorDate: Thu, 10 Dec 2009 15:22:17 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 10 Dec 2009 08:30:28 +0100

perf tools: Align long options which have no short forms

Before:

$ ./perf kmem
...
    -l, --line <num>      show n lines
    --raw-ip              show raw ip instead of symbol

After:

$ ./perf kmem
...
    -l, --line <num>      show n lines
        --raw-ip          show raw ip instead of symbol
Cc Pekka Enberg <[email protected]>

LKML-Reference: <[email protected]>

---
 tools/perf/util/parse-options.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
tools/perf/util/parse-options.c +3 -0
index 6d8af48..efebd5b 100644
@@ -430,6 +430,9 @@ int usage_with_options_internal(const char * const *usagestr,
 		pos = fprintf(stderr, "    ");
 		if (opts->short_name)
 			pos += fprintf(stderr, "-%c", opts->short_name);
+		else
+			pos += fprintf(stderr, "    ");
+
 		if (opts->long_name && opts->short_name)
 			pos += fprintf(stderr, ", ");
 		if (opts->long_name)