> > On Mon, Nov 24, 2014 at 11:00:29AM -0500, Kan Liang wrote: > > From: Kan Liang <kan.li...@intel.com> > > > > symoff can support both same binaries and different binaries. However, > > the offset may be changed for different binaries. This patch checks > > the buildid of perf.data. If they are from different binaries, print a > > warning to notify the user. > > > > Signed-off-by: Kan Liang <kan.li...@intel.com> > > --- > > tools/perf/builtin-diff.c | 25 +++++++++++++++++++++++++ > > tools/perf/util/sort.c | 3 +++ > > tools/perf/util/sort.h | 1 + > > 3 files changed, 29 insertions(+) > > > > diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c > > index 03a4001..2a8c17a 100644 > > --- a/tools/perf/builtin-diff.c > > +++ b/tools/perf/builtin-diff.c > > @@ -678,6 +678,28 @@ static void data__free(struct data__file *d) > > } > > } > > > > +static void buildid_check(void) > > +{ > > + struct dsos *base_k_dsos = &data__files[0].session- > >machines.host.kernel_dsos; > > + struct dsos *base_u_dsos = &data__files[0].session- > >machines.host.user_dsos; > > + struct dsos *k_dsos_tmp, *u_dsos_tmp; > > + struct data__file *d; > > + int i; > > + > > + data__for_each_file_new(i, d) { > > + k_dsos_tmp = &d->session->machines.host.kernel_dsos; > > + u_dsos_tmp = &d->session->machines.host.user_dsos; > > + > > + if (!dsos__build_ids_equal(base_k_dsos, k_dsos_tmp)) > > + pr_warning("The perf.data come from different > kernel. " > > + "The kernel symbol offset may vary for > different kernel.\n"); > > + > > + if (!dsos__build_ids_equal(base_u_dsos, u_dsos_tmp)) > > + pr_warning("The perf.data come from different > user binary. " > > + "The user space symbol offset may vary > for different > > +binaries.\n"); > > we dont specify the kernel version or dso path in the warning message, > maybe we want to print it out just once? In case there's more than 2 not > matching data? Could we print the header instead? It should be more informative. Maybe we can print it with --verbose.
What do you think about the patch as below? +static void buildid_check(void) +{ + struct dsos *base_k_dsos = &data__files[0].session->machines.host.kernel_dsos; + struct dsos *base_u_dsos = &data__files[0].session->machines.host.user_dsos; + struct dsos *k_dsos_tmp, *u_dsos_tmp; + struct data__file *d; + bool k_warn, u_warn; + bool first = true; + int i; + + data__for_each_file_new(i, d) { + k_dsos_tmp = &d->session->machines.host.kernel_dsos; + u_dsos_tmp = &d->session->machines.host.user_dsos; + + k_warn = !dsos__build_ids_equal(base_k_dsos, k_dsos_tmp); + u_warn = !dsos__build_ids_equal(base_u_dsos, u_dsos_tmp); + + if (k_warn || u_warn) { + pr_warning("The perf.data come from different %s%s%s. " + "The symbol offset may vary.\n", + k_warn ? "kernel" : "", + (k_warn && u_warn) ? " and " : "", + u_warn ? "user bunary" : ""); + + if (verbose) { + if (first) { + fprintf(stdout, "# ========%s (Baseline)\n", data__files[0].file.path); + perf_header__fprintf_info(data__files[0].session, stdout, false); + fprintf(stdout, "# ========\n#\n"); + first = false; + } + fprintf(stdout, "# ========%s\n", d->file.path); + perf_header__fprintf_info(d->session, stdout, false); + fprintf(stdout, "# ========\n#\n"); + } + } + } +} > > jirka -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/