Em Thu, Sep 22, 2016 at 05:36:48PM +0200, Jiri Olsa escreveu:
> Adding dcacheline dimension key support. It
> displays cacheline address as hex number.
> 
> Using c2c wrapper to standard 'dcacheline' object
> to defined own header and simple (just address)
> cacheline output.

So, at this point I move from:

  # perf c2c report
   Error: Invalid --fields key: `dcacheline'
  #

To:

  [root@jouet ~]# perf c2c report
  Error: Unknown --fields key: `offset'
  Segmentation fault (core dumped)
  [root@jouet ~]#


  Error: Unknown --fields key: `offset'

Program received signal SIGSEGV, Segmentation fault.
0x0000000000524e1e in hist_entry__cmp (left=0x31a6590, right=0x7fffffffcf10) at 
util/hist.c:1071
1071            hists__for_each_sort_list(hists, fmt) {
Missing separate debuginfos, use: dnf debuginfo-install 
audit-libs-2.6.7-1.fc24.x86_64 bzip2-libs-1.0.6-20.fc24.x86_64 
elfutils-libelf-0.167-1.fc24.x86_64 elfutils-libs-0.167-1.fc24.x86_64 
libcap-ng-0.7.8-1.fc24.x86_64 libunwind-1.1-11.fc24.x86_64 
numactl-libs-2.0.11-2.fc24.x86_64 openssl-libs-1.0.2j-1.fc24.x86_64 
perl-libs-5.22.2-362.fc24.x86_64 python-libs-2.7.12-5.fc24.x86_64 
slang-2.3.0-5.fc24.x86_64 xz-libs-5.2.2-2.fc24.x86_64 zlib-1.2.8-10.fc24.x86_64
(gdb) bt
#0  0x0000000000524e1e in hist_entry__cmp (left=0x31a6590, 
right=0x7fffffffcf10) at util/hist.c:1071
#1  0x00000000005238cf in hists__findnew_entry (hists=0x31a6230, 
entry=0x7fffffffcf10, al=0x7fffffffd160, sample_self=true) at util/hist.c:513
#2  0x0000000000523cc9 in __hists__add_entry (hists=0x31a6230, 
al=0x7fffffffd160, sym_parent=0x0, bi=0x0, mi=0x3497a10, sample=0x7fffffffd360, 
    sample_self=true, ops=0x96a530 <c2c_entry_ops>) at util/hist.c:604
#3  0x0000000000523dba in hists__add_entry_ops (hists=0x31a6230, ops=0x96a530 
<c2c_entry_ops>, al=0x7fffffffd160, sym_parent=0x0, bi=0x0, mi=0x3497a10, 
    sample=0x7fffffffd360, sample_self=true) at util/hist.c:628
#4  0x0000000000464d1b in process_sample_event (tool=0x96a100 <c2c>, 
event=0x7ffff41be638, sample=0x7fffffffd360, evsel=0x2072b00, machine=0x2071c78)
    at builtin-c2c.c:148
#5  0x00000000004fca6a in perf_evlist__deliver_sample (evlist=0x2071f30, 
tool=0x96a100 <c2c>, event=0x7ffff41be638, sample=0x7fffffffd360, 
evsel=0x2072b00, 
    machine=0x2071c78) at util/session.c:1196
#6  0x00000000004fcbfe in machines__deliver_event (machines=0x2071c78, 
evlist=0x2071f30, event=0x7ffff41be638, sample=0x7fffffffd360, tool=0x96a100 
<c2c>, 
    file_offset=5256760) at util/session.c:1233
#7  0x00000000004fcf1c in perf_session__deliver_event (session=0x2071b90, 
event=0x7ffff41be638, sample=0x7fffffffd360, tool=0x96a100 <c2c>, 
    file_offset=5256760) at util/session.c:1290
#8  0x00000000004f9cad in ordered_events__deliver_event (oe=0x2071e90, 
event=0x3196098) at util/session.c:114
#9  0x0000000000500293 in __ordered_events__flush (oe=0x2071e90) at 
util/ordered-events.c:207
#10 0x0000000000500557 in ordered_events__flush (oe=0x2071e90, 
how=OE_FLUSH__ROUND) at util/ordered-events.c:274
#11 0x00000000004fbc12 in process_finished_round (tool=0x96a100 <c2c>, 
event=0x7ffff41c7bc0, oe=0x2071e90) at util/session.c:852
#12 0x00000000004fd0ba in perf_session__process_user_event (session=0x2071b90, 
event=0x7ffff41c7bc0, file_offset=5295040) at util/session.c:1329
#13 0x00000000004fd6e5 in perf_session__process_event (session=0x2071b90, 
event=0x7ffff41c7bc0, file_offset=5295040) at util/session.c:1455
#14 0x00000000004fe47c in __perf_session__process_events (session=0x2071b90, 
data_offset=424, data_size=5294624, file_size=5295048) at util/session.c:1824
#15 0x00000000004fe67a in perf_session__process_events (session=0x2071b90) at 
util/session.c:1878
#16 0x0000000000465d3b in perf_c2c__report (argc=0, argv=0x7fffffffe1d0) at 
builtin-c2c.c:617
#17 0x0000000000466535 in cmd_c2c (argc=1, argv=0x7fffffffe1d0, prefix=0x0) at 
builtin-c2c.c:755
#18 0x00000000004aa677 in run_builtin (p=0x975548 <commands+72>, argc=2, 
argv=0x7fffffffe1d0) at perf.c:358
#19 0x00000000004aa8e4 in handle_internal_command (argc=2, argv=0x7fffffffe1d0) 
at perf.c:420
#20 0x00000000004aaa29 in run_argv (argcp=0x7fffffffe02c, argv=0x7fffffffe020) 
at perf.c:466
#21 0x00000000004aae12 in main (argc=2, argv=0x7fffffffe1d0) at perf.c:610
(gdb) 
 
> Link: http://lkml.kernel.org/n/tip-j5enppr8e7h27nskqhgq3...@git.kernel.org
> Signed-off-by: Jiri Olsa <jo...@kernel.org>
> ---
>  tools/perf/builtin-c2c.c | 38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
> index cfa12930b77b..335c0fd30757 100644
> --- a/tools/perf/builtin-c2c.c
> +++ b/tools/perf/builtin-c2c.c
> @@ -1,5 +1,6 @@
>  #include <linux/compiler.h>
>  #include <linux/kernel.h>
> +#include <linux/stringify.h>
>  #include "util.h"
>  #include "debug.h"
>  #include "builtin.h"
> @@ -7,6 +8,7 @@
>  #include "mem-events.h"
>  #include "session.h"
>  #include "hist.h"
> +#include "sort.h"
>  #include "tool.h"
>  #include "data.h"
>  #include "sort.h"
> @@ -271,6 +273,33 @@ static int c2c_header(struct perf_hpp_fmt *fmt, struct 
> perf_hpp *hpp,
>       return scnprintf(hpp->buf, hpp->size, "%*s", width, text);
>  }
>  
> +static char *hex_str(u64 val)
> +{
> +     static char buf[20];
> +
> +     snprintf(buf, 20, "0x%" PRIx64, val);
> +     return buf;
> +}
> +
> +static int64_t
> +dcacheline_cmp(struct perf_hpp_fmt *fmt __maybe_unused,
> +            struct hist_entry *left, struct hist_entry *right)
> +{
> +     return sort__dcacheline_cmp(left, right);
> +}
> +
> +static int dcacheline_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
> +                         struct hist_entry *he)
> +{
> +     uint64_t addr = 0;
> +     int width = c2c_width(fmt, hpp, he->hists);
> +
> +     if (he->mem_info)
> +             addr = cl_address(he->mem_info->daddr.addr);
> +
> +     return snprintf(hpp->buf, hpp->size, "%*s", width, hex_str(addr));
> +}
> +
>  #define HEADER_LOW(__h)                      \
>       {                               \
>               .line[1] = {            \
> @@ -306,7 +335,16 @@ static int c2c_header(struct perf_hpp_fmt *fmt, struct 
> perf_hpp *hpp,
>               },                      \
>       }
>  
> +static struct c2c_dimension dim_dcacheline = {
> +     .header         = HEADER_LOW("Cacheline"),
> +     .name           = "dcacheline",
> +     .cmp            = dcacheline_cmp,
> +     .entry          = dcacheline_entry,
> +     .width          = 18,
> +};
> +
>  static struct c2c_dimension *dimensions[] = {
> +     &dim_dcacheline,
>       NULL,
>  };
>  
> -- 
> 2.7.4

Reply via email to