• Jiri Olsa's avatar
    perf c2c report: Fix crash for empty browser · 73978332
    Jiri Olsa authored
    'perf c2c' scans read/write accesses and tries to find false sharing
    cases, so when the events it wants were not asked for or ended up not
    taking place, we get no histograms.
    So do not try to display entry details if there's not any. Currently
    this ends up in crash:
      $ perf c2c report # then press 'd'
      perf: Segmentation fault
    Committer testing:
    Record a perf.data file without events of interest to 'perf c2c report',
    then call it and press 'd':
      # perf record sleep 1
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.001 MB perf.data (6 samples) ]
      # perf c2c report
      perf: Segmentation fault
      -------- backtrace --------
    After the patch the segfault doesn't take place, a follow up patch to
    tell the user why nothing changes when 'd' is pressed would be good.
    Reported-by: rodia@autistici.org
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Don Zickus <dzickus@redhat.com>
    Cc: Joe Mario <jmario@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Fixes: f1c5fd4d ("perf c2c report: Add TUI cacheline browser")
    Link: http://lkml.kernel.org/r/20180724062008.26126-1-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
builtin-c2c.c 69.8 KB