From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
David Ahern <dsahern@gmail.com>,
Milian Wolff <milian.wolff@kdab.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Wang Nan <wangnan0@huawei.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 1/7] perf callchain: Move initial entry call into get_entries function
Date: Mon, 23 Nov 2015 18:53:48 -0300 [thread overview]
Message-ID: <1448315634-13592-2-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1448315634-13592-1-git-send-email-acme@kernel.org>
From: Jiri Olsa <jolsa@kernel.org>
Moving initial entry call into get_entries function so all entries
processing is on one place. It will be useful for next change that adds
ordering logic.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1447772739-18471-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/unwind-libunwind.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index c83832b555e5..0ae8844fe7a6 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -614,10 +614,22 @@ void unwind__finish_access(struct thread *thread)
static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
void *arg, int max_stack)
{
+ u64 val;
unw_addr_space_t addr_space;
unw_cursor_t c;
int ret;
+ ret = perf_reg_value(&val, &ui->sample->user_regs, PERF_REG_IP);
+ if (ret)
+ return ret;
+
+ ret = entry(val, ui->thread, cb, arg);
+ if (ret)
+ return -ENOMEM;
+
+ if (--max_stack == 0)
+ return 0;
+
addr_space = thread__priv(ui->thread);
if (addr_space == NULL)
return -1;
@@ -640,24 +652,17 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
struct thread *thread,
struct perf_sample *data, int max_stack)
{
- u64 ip;
struct unwind_info ui = {
.sample = data,
.thread = thread,
.machine = thread->mg->machine,
};
- int ret;
if (!data->user_regs.regs)
return -EINVAL;
- ret = perf_reg_value(&ip, &data->user_regs, PERF_REG_IP);
- if (ret)
- return ret;
-
- ret = entry(ip, thread, cb, arg);
- if (ret)
- return -ENOMEM;
+ if (max_stack <= 0)
+ return -EINVAL;
- return --max_stack > 0 ? get_entries(&ui, cb, arg, max_stack) : 0;
+ return get_entries(&ui, cb, arg, max_stack);
}
--
2.1.0
next prev parent reply other threads:[~2015-11-23 21:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 21:53 [GIT PULL 0/7] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-11-23 21:53 ` Arnaldo Carvalho de Melo [this message]
2015-11-23 21:53 ` [PATCH 2/7] perf callchain: Add order support for libunwind DWARF unwinder Arnaldo Carvalho de Melo
2015-11-23 21:53 ` [PATCH 3/7] perf test: Add callchain order setup for DWARF unwinder test Arnaldo Carvalho de Melo
2015-11-23 21:53 ` [PATCH 4/7] perf callchain: Add order support for libdw DWARF unwinder Arnaldo Carvalho de Melo
2015-11-23 21:53 ` [PATCH 5/7] perf tools: Add 'perf config' command Arnaldo Carvalho de Melo
2015-11-23 21:53 ` [PATCH 6/7] perf config: Add initial man page Arnaldo Carvalho de Melo
2015-11-23 21:53 ` [PATCH 7/7] perf callchain: Add missing parent_val initialization Arnaldo Carvalho de Melo
2015-11-24 8:10 ` [GIT PULL 0/7] perf/core improvements and fixes Ingo Molnar
2015-11-24 8:28 ` Jiri Olsa
2015-11-24 8:42 ` Ingo Molnar
2015-11-24 9:26 ` Jiri Olsa
2015-11-24 9:47 ` Jiri Olsa
2015-11-26 11:00 ` Ingo Molnar
2015-11-26 12:47 ` Jiri Olsa
2015-11-26 7:56 ` Ingo Molnar
2015-11-26 8:12 ` Ingo Molnar
2015-11-26 9:09 ` Jiri Olsa
2015-11-24 10:28 ` Jiri Olsa
2015-11-26 8:13 ` Ingo Molnar
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=1448315634-13592-2-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=milian.wolff@kdab.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=wangnan0@huawei.com \
/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).