lkml.org 
[lkml]   [2017]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 12/23] perf kmem: Add -q/--quiet option
Date
The -q/--quiet option is to suppress any message.  Sometimes users just
want to run the command and it can be used for that case.

Before:

# perf kmem stat
Failed to open /usr/lib/libpthread-2.21.so, continuing without symbols
Failed to open /usr/lib/libc-2.21.so, continuing without symbols
Failed to open /lib/modules/3.18.6-1-ARCH/kernel/fs/ext4/ext4.ko.gz, continuing without symbols
SUMMARY (SLAB allocator)
========================
Total bytes requested: 172,628
Total bytes allocated: 173,088
Total bytes freed: 161,280
Net total bytes allocated: 11,808
Total bytes wasted on internal fragmentation: 460
Internal fragmentation: 0.265761%
Cross CPU allocations: 0/851

After:

# perf kmem stat -q
SUMMARY (SLAB allocator)
========================
Total bytes requested: 172,628
Total bytes allocated: 173,088
Total bytes freed: 161,280
Net total bytes allocated: 11,808
Total bytes wasted on internal fragmentation: 460
Internal fragmentation: 0.265761%
Cross CPU allocations: 0/851

Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/Documentation/perf-kmem.txt | 4 ++++
tools/perf/builtin-kmem.c | 4 ++++
2 files changed, 8 insertions(+)

diff --git a/tools/perf/Documentation/perf-kmem.txt b/tools/perf/Documentation/perf-kmem.txt
index 479fc3261a50..0731389501d4 100644
--- a/tools/perf/Documentation/perf-kmem.txt
+++ b/tools/perf/Documentation/perf-kmem.txt
@@ -29,6 +29,10 @@ OPTIONS
--verbose::
Be more verbose. (show symbol address, etc)

+-q::
+--quiet::
+ Do not show any message.
+
--caller::
Show per-callsite statistics

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 6da8d083e4e5..7148137c3a3d 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -1895,6 +1895,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_STRING('i', "input", &input_name, "file", "input file name"),
OPT_INCR('v', "verbose", &verbose,
"be more verbose (show symbol address, etc)"),
+ OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
OPT_CALLBACK_NOOPT(0, "caller", NULL, NULL,
"show per-callsite statistics", parse_caller_opt),
OPT_CALLBACK_NOOPT(0, "alloc", NULL, NULL,
@@ -1932,6 +1933,9 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
if (!argc)
usage_with_options(kmem_usage, kmem_options);

+ if (quiet)
+ perf_quiet_option();
+
if (kmem_slab == 0 && kmem_page == 0) {
if (kmem_default == KMEM_SLAB)
kmem_slab = 1;
--
2.11.0
\
 
 \ /
  Last update: 2017-03-07 16:23    [W:0.167 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site