From: Jiri Olsa <jolsa@redhat.com>
To: Milian Wolff <milian.wolff@kdab.com>
Cc: acme@kernel.org, jolsa@kernel.org,
Jin Yao <yao.jin@linux.intel.com>,
Linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
David Ahern <dsahern@gmail.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH v3 03/13] perf report: create real callchain entries for inlined frames
Date: Tue, 19 Sep 2017 14:27:19 +0200 [thread overview]
Message-ID: <20170919122719.GB13388@krava> (raw)
In-Reply-To: <20170906135501.306-4-milian.wolff@kdab.com>
On Wed, Sep 06, 2017 at 03:54:51PM +0200, Milian Wolff wrote:
SNIP
> +void inlines__tree_insert(struct rb_root *tree, struct inline_node *inlines)
> +{
> + struct rb_node **p = &tree->rb_node;
> + struct rb_node *parent = NULL;
> + const u64 addr = inlines->addr;
> + struct inline_node *i;
> +
> + while (*p != NULL) {
> + parent = *p;
> + i = rb_entry(parent, struct inline_node, rb_node);
> + if (addr < i->addr)
> + p = &(*p)->rb_left;
> + else
> + p = &(*p)->rb_right;
> + }
> + rb_link_node(&inlines->rb_node, parent, p);
> + rb_insert_color(&inlines->rb_node, tree);
> +}
> +
> +struct inline_node *inlines__tree_find(struct rb_root *tree, u64 addr)
> +{
> + struct rb_node *n = tree->rb_node;
> +
> + while (n) {
> + struct inline_node *i = rb_entry(n, struct inline_node,
> + rb_node);
> +
> + if (addr < i->addr)
> + n = n->rb_left;
> + else if (addr > i->addr)
> + n = n->rb_right;
> + else
> + return i;
> + }
> +
> + return NULL;
> +}
> +
> +void inlines__tree_delete(struct rb_root *tree)
> +{
> + struct inline_node *pos;
> + struct rb_node *next = rb_first(tree);
> +
> + while (next) {
> + pos = rb_entry(next, struct inline_node, rb_node);
> + next = rb_next(&pos->rb_node);
> + rb_erase(&pos->rb_node, tree);
> + inline_node__delete(pos);
> + }
> +}
could you please split the patch at least into
above 'adding related inline_node tree managing functions + append_inlines'
and below 'struct inline_list' changes
not sure the 'struct symbol::inlined' could be separated,
I'd take it as a bonus and nice gesture to reviewers ;-)
thanks,
jirka
> diff --git a/tools/perf/util/srcline.h b/tools/perf/util/srcline.h
> index 7b52ba88676e..0d2aca92e8c7 100644
> --- a/tools/perf/util/srcline.h
> +++ b/tools/perf/util/srcline.h
> @@ -2,6 +2,7 @@
> #define PERF_SRCLINE_H
>
> #include <linux/list.h>
> +#include <linux/rbtree.h>
> #include <linux/types.h>
>
> struct dso;
> @@ -17,18 +18,28 @@ void free_srcline(char *srcline);
> #define SRCLINE_UNKNOWN ((char *) "??:0")
>
> struct inline_list {
> - char *filename;
> - char *funcname;
> - unsigned int line_nr;
> + struct symbol *symbol;
> + char *srcline;
> struct list_head list;
> };
>
> struct inline_node {
> u64 addr;
> struct list_head val;
> + struct rb_node rb_node;
> };
>
> -struct inline_node *dso__parse_addr_inlines(struct dso *dso, u64 addr);
> +// parse inlined frames for the given address
> +struct inline_node *dso__parse_addr_inlines(struct dso *dso, u64 addr,
> + struct symbol *sym);
> +// free resources associated to the inline node list
> void inline_node__delete(struct inline_node *node);
>
> +// insert the inline node list into the DSO, which will take ownership
> +void inlines__tree_insert(struct rb_root *tree, struct inline_node *inlines);
> +// find previously inserted inline node list
> +struct inline_node *inlines__tree_find(struct rb_root *tree, u64 addr);
> +// delete all nodes within the tree of inline_node s
> +void inlines__tree_delete(struct rb_root *tree);
> +
> #endif /* PERF_SRCLINE_H */
> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
> index 2bd6a1f01a1c..8f072c28b6d3 100644
> --- a/tools/perf/util/symbol.h
> +++ b/tools/perf/util/symbol.h
> @@ -59,6 +59,7 @@ struct symbol {
> u8 binding;
> u8 idle:1;
> u8 ignore:1;
> + u8 inlined:1;
> u8 arch_sym;
> char name[0];
> };
> --
> 2.14.1
>
next prev parent reply other threads:[~2017-09-19 12:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 13:54 [PATCH v3 00/13] generate full callchain cursor entries for inlined frames Milian Wolff
2017-09-06 13:54 ` [PATCH v3 01/13] perf report: remove code to handle inline frames from browsers Milian Wolff
2017-09-18 11:56 ` Jiri Olsa
2017-09-18 12:43 ` Milian Wolff
2017-09-06 13:54 ` [PATCH v3 02/13] perf util: store srcline in callchain_cursor_node Milian Wolff
2017-09-06 13:54 ` [PATCH v3 03/13] perf report: create real callchain entries for inlined frames Milian Wolff
2017-09-19 12:27 ` Jiri Olsa
2017-10-01 12:37 ` Milian Wolff
2017-10-01 17:40 ` Joe Perches
2017-09-19 12:27 ` Jiri Olsa [this message]
2017-10-01 14:12 ` Milian Wolff
2017-09-19 12:27 ` Jiri Olsa
2017-10-01 12:40 ` Milian Wolff
2017-09-06 13:54 ` [PATCH v3 04/13] perf report: fall-back to function name comparison for -g srcline Milian Wolff
2017-09-06 13:54 ` [PATCH v3 05/13] perf report: mark inlined frames in output by " (inlined)" suffix Milian Wolff
2017-09-06 13:54 ` [PATCH v3 06/13] perf script: mark inlined frames and do not print DSO for them Milian Wolff
2017-09-06 13:54 ` [PATCH v3 07/13] perf report: compare symbol name for inlined frames when matching Milian Wolff
2017-09-06 13:54 ` [PATCH v3 08/13] perf report: compare symbol name for inlined frames when sorting Milian Wolff
2017-09-06 13:54 ` [PATCH v3 09/13] perf report: properly handle branch count in match_chain Milian Wolff
2017-09-06 13:54 ` [PATCH v3 10/13] perf report: cache failed lookups of inlined frames Milian Wolff
2017-09-06 13:54 ` [PATCH v3 11/13] perf report: cache srclines for callchain nodes Milian Wolff
2017-09-06 13:55 ` [PATCH v3 12/13] perf report: use srcline from callchain for hist entries Milian Wolff
2017-09-06 13:55 ` [PATCH v3 13/13] perf util: enable handling of inlined frames by default 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=20170919122719.GB13388@krava \
--to=jolsa@redhat.com \
--cc=Linux-kernel@vger.kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=milian.wolff@kdab.com \
--cc=namhyung@kernel.org \
--cc=yao.jin@linux.intel.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).