From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Jiri Olsa <jolsa@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
kernel-team@lge.com, Milian Wolff <milian.wolff@kdab.com>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH] perf report: Fix invalid warning on callchain param
Date: Wed, 17 May 2017 16:08:37 +0900 [thread overview]
Message-ID: <20170517070837.6263-1-namhyung@kernel.org> (raw)
Currently "perf report -g srcline --stdio" shows two warnings like
below:
Invalid callchain mode: srcline
Invalid callchain order: srcline
This is because it always tries to parse callchain mode, order, sort-key
and value-type in a row. So even if 'srcline' is a valid sort-key, it
shows invalid mode and order warnings.
Change it to show a warning only if failed to parse the given token as
any of valid parameter. Also code under try_numbers requires the token
to be a number, it's good to show the warning there.
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/callchain.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 9ab68682c6d0..89dbfd9e6d24 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -15,6 +15,7 @@
#include <stdbool.h>
#include <errno.h>
#include <math.h>
+#include <ctype.h>
#include "asm/bug.h"
@@ -65,7 +66,6 @@ static int parse_callchain_mode(const char *value)
return 0;
}
- pr_err("Invalid callchain mode: %s\n", value);
return -1;
}
@@ -82,7 +82,6 @@ static int parse_callchain_order(const char *value)
return 0;
}
- pr_err("Invalid callchain order: %s\n", value);
return -1;
}
@@ -105,7 +104,6 @@ static int parse_callchain_sort_key(const char *value)
return 0;
}
- pr_err("Invalid callchain sort key: %s\n", value);
return -1;
}
@@ -124,7 +122,6 @@ static int parse_callchain_value(const char *value)
return 0;
}
- pr_err("Invalid callchain config key: %s\n", value);
return -1;
}
@@ -197,6 +194,9 @@ __parse_callchain_report_opt(const char *arg, bool allow_record_opt)
}
try_numbers:
+ if (!isdigit(*tok))
+ pr_err("Invalid callchain param: %s\n", tok);
+
if (try_stack_size) {
unsigned long size = 0;
--
2.12.2
next reply other threads:[~2017-05-17 7:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-17 7:08 Namhyung Kim [this message]
2017-05-17 8:17 ` [PATCH] perf report: Fix invalid warning on callchain param Milian Wolff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170517070837.6263-1-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=fweisbec@gmail.com \
--cc=jolsa@kernel.org \
--cc=kernel-team@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=milian.wolff@kdab.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox