From: Jiri Olsa <jolsa@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Jiri Olsa <jolsa@redhat.com>,
Corey Ashford <cjashfor@linux.vnet.ibm.com>,
David Ahern <dsahern@gmail.com>, Ingo Molnar <mingo@elte.hu>,
Namhyung Kim <namhyung@kernel.org>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Andi Kleen <andi@firstfloor.org>,
Adrian Hunter <adrian.hunter@intel.com>
Subject: [PATCH 1/4] perf tools: Split -g and --call-graph for record command
Date: Sat, 26 Oct 2013 16:25:33 +0200 [thread overview]
Message-ID: <1382797536-32303-2-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1382797536-32303-1-git-send-email-jolsa@redhat.com>
Splitting -g and --call-graph for record command, so we could
use '-g' with no option.
The '-g' option now takes NO argument and enables the configured
unwind method, which is currently the frame pointers method.
It will be possible to configure unwind method via config
file in upcoming patches.
All current '-g' arguments is overtaken by --call-graph option.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/Documentation/perf-record.txt | 6 ++-
tools/perf/builtin-record.c | 71 ++++++++++++++++++++++----------
tools/perf/util/callchain.h | 3 ++
3 files changed, 58 insertions(+), 22 deletions(-)
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index f10ab63..7be62770 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -92,8 +92,12 @@ OPTIONS
size is rounded up to have nearest pages power of two value.
-g::
+ Enables call-graph (stack chain/backtrace) recording.
+
--call-graph::
- Do call-graph (stack chain/backtrace) recording.
+ Setup and enable call-graph (stack chain/backtrace) recording,
+ implies -g.
+
-q::
--quiet::
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index ab8d15e..27622bb 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -678,21 +678,12 @@ static int get_stack_size(char *str, unsigned long *_size)
}
#endif /* HAVE_LIBUNWIND_SUPPORT */
-int record_parse_callchain_opt(const struct option *opt,
- const char *arg, int unset)
+int record_parse_callchain(const char *arg, struct perf_record_opts *opts)
{
- struct perf_record_opts *opts = opt->value;
char *tok, *name, *saveptr = NULL;
char *buf;
int ret = -1;
- /* --no-call-graph */
- if (unset)
- return 0;
-
- /* We specified default option if none is provided. */
- BUG_ON(!arg);
-
/* We need buffer that we know we can write to. */
buf = malloc(strlen(arg) + 1);
if (!buf)
@@ -730,10 +721,6 @@ int record_parse_callchain_opt(const struct option *opt,
ret = get_stack_size(tok, &size);
opts->stack_dump_size = size;
}
-
- if (!ret)
- pr_debug("callchain: stack dump size %d\n",
- opts->stack_dump_size);
#endif /* HAVE_LIBUNWIND_SUPPORT */
} else {
pr_err("callchain: Unknown -g option "
@@ -744,13 +731,52 @@ int record_parse_callchain_opt(const struct option *opt,
} while (0);
free(buf);
+ return ret;
+}
+
+static void callchain_debug(struct perf_record_opts *opts)
+{
+ pr_debug("callchain: type %d\n", opts->call_graph);
+ if (opts->call_graph == CALLCHAIN_DWARF)
+ pr_debug("callchain: stack dump size %d\n",
+ opts->stack_dump_size);
+}
+
+int record_parse_callchain_opt(const struct option *opt,
+ const char *arg,
+ int unset)
+{
+ struct perf_record_opts *opts = opt->value;
+ int ret;
+
+ /* --no-call-graph */
+ if (unset) {
+ opts->call_graph = CALLCHAIN_NONE;
+ pr_debug("callchain: disabled\n");
+ return 0;
+ }
+
+ ret = record_parse_callchain(arg, opts);
if (!ret)
- pr_debug("callchain: type %d\n", opts->call_graph);
+ callchain_debug(opts);
return ret;
}
+int record_callchain_opt(const struct option *opt,
+ const char *arg __maybe_unused,
+ int unset __maybe_unused)
+{
+ struct perf_record_opts *opts = opt->value;
+
+ if (opts->call_graph == CALLCHAIN_NONE)
+ opts->call_graph = CALLCHAIN_FP;
+
+ callchain_debug(opts);
+ return 0;
+}
+
static const char * const record_usage[] = {
"perf record [<options>] [<command>]",
"perf record [<options>] -- <command> [<options>]",
@@ -779,12 +805,12 @@ static struct perf_record record = {
},
};
-#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
+#define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: "
#ifdef HAVE_LIBUNWIND_SUPPORT
-const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
+const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf";
#else
-const char record_callchain_help[] = CALLCHAIN_HELP "[fp]";
+const char record_callchain_help[] = CALLCHAIN_HELP "fp";
#endif
/*
@@ -825,9 +851,12 @@ const struct option record_options[] = {
perf_evlist__parse_mmap_pages),
OPT_BOOLEAN(0, "group", &record.opts.group,
"put the counters into a counter group"),
- OPT_CALLBACK_DEFAULT('g', "call-graph", &record.opts,
- "mode[,dump_size]", record_callchain_help,
- &record_parse_callchain_opt, "fp"),
+ OPT_CALLBACK(0, "call-graph", &record.opts,
+ "mode[,dump_size]", record_callchain_help,
+ &record_parse_callchain_opt),
+ OPT_CALLBACK_NOOPT('g', NULL, &record.opts,
+ NULL, "enables call-graph recording" ,
+ &record_callchain_opt),
OPT_INCR('v', "verbose", &verbose,
"be more verbose (show counter open errors, etc)"),
OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"),
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 7bb3602..4f7f989 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -146,6 +146,9 @@ static inline void callchain_cursor_advance(struct callchain_cursor *cursor)
struct option;
+int record_parse_callchain(const char *arg, struct perf_record_opts *opts);
int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset);
+int record_callchain_opt(const struct option *opt, const char *arg, int unset);
+
extern const char record_callchain_help[];
#endif /* __PERF_CALLCHAIN_H */
--
1.7.11.7
next prev parent reply other threads:[~2013-10-26 14:26 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 5:15 [PATCHSET 0/8] perf tools: Fix scalability problem on callchain merging (v5) Namhyung Kim
2013-10-11 5:15 ` [PATCH 1/8] perf callchain: Convert children list to rbtree Namhyung Kim
2013-10-23 7:54 ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-10-23 11:07 ` Frederic Weisbecker
2013-10-23 12:45 ` Arnaldo Carvalho de Melo
2013-10-11 5:15 ` [PATCH 2/8] perf ui/progress: Add new helper functions for progress bar Namhyung Kim
2013-10-21 18:13 ` Arnaldo Carvalho de Melo
2013-10-22 18:12 ` Namhyung Kim
2013-10-22 13:06 ` Arnaldo Carvalho de Melo
2013-10-11 5:15 ` [PATCH 3/8] perf tools: Show progress on histogram collapsing Namhyung Kim
2013-10-25 10:33 ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-10-28 15:03 ` [tip:perf/urgent] perf script python: Fix mem leak due to missing Py_DECREFs on dict entries tip-bot for Joseph Schuchart
2013-10-11 5:15 ` [PATCH 4/8] perf tools: Use an accessor to read thread comm Namhyung Kim
2013-10-11 5:15 ` [PATCH 5/8] perf tools: Add time argument on comm setting Namhyung Kim
2013-10-11 5:15 ` [PATCH 6/8] perf tools: Add new comm infrastructure Namhyung Kim
2013-10-25 10:56 ` Frederic Weisbecker
2013-10-25 13:04 ` Arnaldo Carvalho de Melo
2013-10-25 15:33 ` David Ahern
2013-10-25 18:12 ` Frederic Weisbecker
2013-10-25 18:14 ` Arnaldo Carvalho de Melo
2013-10-25 18:19 ` David Ahern
2013-10-28 5:38 ` Namhyung Kim
2013-10-28 9:09 ` Frederic Weisbecker
2013-10-28 9:15 ` Namhyung Kim
2013-10-28 10:12 ` Frederic Weisbecker
2013-10-28 12:43 ` Arnaldo Carvalho de Melo
2013-10-28 14:29 ` Arnaldo Carvalho de Melo
2013-10-28 16:05 ` Frederic Weisbecker
2013-10-28 17:01 ` Arnaldo Carvalho de Melo
2013-10-28 17:48 ` Arnaldo Carvalho de Melo
2013-10-29 9:20 ` Frederic Weisbecker
2013-10-29 13:06 ` Arnaldo Carvalho de Melo
2013-10-11 5:15 ` [PATCH 7/8] perf tools: Compare hists comm by addresses Namhyung Kim
2013-11-04 20:19 ` [tip:perf/core] " tip-bot for Frederic Weisbecker
2013-10-11 5:15 ` [PATCH 8/8] perf tools: Get current comm instead of last one Namhyung Kim
2013-10-11 5:58 ` [PATCHSET 0/8] perf tools: Fix scalability problem on callchain merging (v5) Ingo Molnar
2013-10-11 7:34 ` Jiri Olsa
2013-10-11 8:24 ` Namhyung Kim
2013-10-11 12:59 ` Ingo Molnar
2013-10-11 13:04 ` Peter Zijlstra
2013-10-11 15:11 ` David Ahern
2013-10-11 15:20 ` David Ahern
2013-10-11 21:51 ` Andi Kleen
2013-10-11 22:04 ` David Ahern
2013-10-13 10:25 ` Jiri Olsa
2013-10-13 21:18 ` [RFC] perf record,top: Add callchain option into .perfconfig Jiri Olsa
2013-10-13 21:32 ` Andi Kleen
2013-10-14 7:56 ` [PATCHSET 0/8] perf tools: Fix scalability problem on callchain merging (v5) Ingo Molnar
2013-10-12 16:53 ` Ingo Molnar
2013-10-12 19:42 ` David Ahern
2013-10-13 5:23 ` Ingo Molnar
2013-10-25 19:09 ` RFP: Fixing "-ga -ag -g fp -g dwarf" was " Arnaldo Carvalho de Melo
2013-10-25 19:22 ` David Ahern
2013-10-25 19:46 ` Arnaldo Carvalho de Melo
2013-10-26 12:03 ` Ingo Molnar
2013-10-26 12:35 ` Jiri Olsa
2013-10-26 14:25 ` [PATCH 0/4] perf tools: Fix -g option handling Jiri Olsa
2013-10-26 14:25 ` Jiri Olsa [this message]
2013-10-27 15:30 ` [PATCH 1/4] perf tools: Split -g and --call-graph for record command David Ahern
2013-10-28 17:46 ` Arnaldo Carvalho de Melo
2013-10-28 18:20 ` David Ahern
2013-10-29 5:13 ` Namhyung Kim
2013-10-28 7:59 ` Namhyung Kim
2013-10-29 10:18 ` Jiri Olsa
2013-10-29 12:42 ` Arnaldo Carvalho de Melo
2013-10-29 8:22 ` [tip:perf/urgent] perf record: Split -g and --call-graph tip-bot for Jiri Olsa
2013-10-26 14:25 ` [PATCH 2/4] perf tools: Split -G and --call-graph for top command Jiri Olsa
2013-10-27 15:34 ` David Ahern
2013-10-28 8:06 ` Namhyung Kim
2013-10-29 8:22 ` [tip:perf/urgent] perf top: Split -G and --call-graph tip-bot for Jiri Olsa
2013-10-26 14:25 ` [PATCH 3/4] perf tools: Add call-graph option support into .perfconfig Jiri Olsa
2013-10-27 15:36 ` David Ahern
2013-10-28 8:10 ` Namhyung Kim
2013-10-29 10:18 ` Jiri Olsa
2013-10-29 12:43 ` Arnaldo Carvalho de Melo
2013-10-29 12:46 ` Ingo Molnar
2013-11-01 15:20 ` Jiri Olsa
2013-10-26 14:25 ` [PATCH 4/4] perf tools: Add readable output for callchain debug Jiri Olsa
2013-10-27 15:39 ` David Ahern
2013-10-26 14:32 ` [PATCH 0/4] perf tools: Fix -g option handling Jiri Olsa
2013-10-27 6:56 ` Ingo Molnar
2013-10-29 10:21 ` Jiri Olsa
2013-10-29 10:25 ` Ingo Molnar
2013-10-13 12:34 ` [PATCHSET 0/8] perf tools: Fix scalability problem on callchain merging (v5) Jiri Olsa
2013-10-14 1:06 ` Namhyung Kim
2013-10-14 4:50 ` Namhyung Kim
2013-10-14 8:01 ` Jiri Olsa
2013-10-14 8:41 ` Namhyung Kim
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=1382797536-32303-2-git-send-email-jolsa@redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=andi@firstfloor.org \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=dsahern@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=namhyung@kernel.org \
--cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).