perf record: Improve 'Workload failed' message printing events + what was exec'ed
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 14 Apr 2021 12:32:14 +0000 (09:32 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 15 Apr 2021 19:34:05 +0000 (16:34 -0300)
commit3535a6967c0d590381c16d6676c6fdfa60f4d733
treecab4cffd407d568b4646950745f2fb444aeb2df4
parent9865ea8ab31f2e56be59125099ee251ce573f293
perf record: Improve 'Workload failed' message printing events + what was exec'ed

Before:

  # perf record -a cycles,instructions,cache-misses
  Workload failed: No such file or directory
  #

After:

  # perf record -a cycles,instructions,cache-misses
  Failed to collect 'cycles' for the 'cycles,instructions,cache-misses' workload: No such file or directory
  #

Helps disambiguating other error scenarios:

  # perf record -a -e cycles,instructions,cache-misses bla
  Failed to collect 'cycles,instructions,cache-misses' for the 'bla' workload: No such file or directory
  # perf record -a cycles,instructions,cache-misses sleep 1
  Failed to collect 'cycles' for the 'cycles,instructions,cache-misses' workload: No such file or directory
  #

When all goes well we're back to the usual:

  # perf record -a -e cycles,instructions,cache-misses sleep 1
  [ perf record: Woken up 3 times to write data ]
  [ perf record: Captured and wrote 3.151 MB perf.data (21242 samples) ]
  #

Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lore.kernel.org/lkml/20210414131628.2064862-3-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-record.c