Re: [PATCH 1/8] perf, tools: Support handling complete branch stacks as histograms

From: Jiri Olsa
Date: Mon Oct 20 2014 - 06:11:24 EST


On Fri, Sep 26, 2014 at 04:37:09PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@xxxxxxxxxxxxxxx>

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/