lkml.org 
[lkml]   [2014]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/8] perf, tools: Support handling complete branch stacks as histograms
On Fri, Sep 26, 2014 at 04:37:09PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>

SNIP

>
> struct callchain_list {
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index b2ec38b..8ba32ce 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -12,6 +12,7 @@
> #include <stdbool.h>
> #include <symbol/kallsyms.h>
> #include "unwind.h"
> +#include "linux/hash.h"
>
> int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
> {
> @@ -1364,9 +1365,84 @@ struct branch_info *sample__resolve_bstack(struct perf_sample *sample,
> return bi;
> }
>
> +static int add_callchain_ip(struct machine *machine,
> + struct thread *thread,
> + struct symbol **parent,
> + struct addr_location *root_al,
> + int cpumode,
> + u64 ip)
> +{
> + struct addr_location al;
> +
> + al.filtered = 0;
> + al.sym = NULL;
> + if (cpumode == -1)
> + thread__find_cpumode_addr_location(thread, machine, MAP__FUNCTION, ip, &al);
> + else
> + thread__find_addr_location(thread, machine, cpumode, MAP__FUNCTION,
> + ip, &al);

this cpumode condition is new (wrt below comment)

> + if (al.sym != NULL) {
> + if (sort__has_parent && !*parent &&
> + symbol__match_regex(al.sym, &parent_regex))
> + *parent = al.sym;
> + else if (have_ignore_callees && root_al &&
> + symbol__match_regex(al.sym, &ignore_callees_regex)) {
> + /* Treat this symbol as the root,
> + forgetting its callees. */
> + *root_al = al;
> + callchain_cursor_reset(&callchain_cursor);
> + }
> + if (!symbol_conf.use_callchain)
> + return -EINVAL;

why is this condition here?

could you please split this change into
- adding add_callchain_ip function
- adding more functionality to add_callchain_ip function?

IMO it'd make it cleaner and easier to understand

thanks,
jirka


\
 
 \ /
  Last update: 2014-10-20 12:21    [W:0.219 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site