perf stat record: Do not allow record with multiple runs mode
authorJiri Olsa <[email protected]>
Thu, 5 Nov 2015 14:40:53 +0000 (15:40 +0100)
committerArnaldo Carvalho de Melo <[email protected]>
Thu, 17 Dec 2015 19:00:32 +0000 (16:00 -0300)
We currently don't support storing multiple session in perf.data,
so we can't allow -r option in stat record.

  $ perf stat -e cycles -r 2 record ls
  Cannot use -r option with perf stat record.

Committer note:

Before this patch we would a perf.data file such as:

  $ perf stat -e cycles -r 2 record ls
  <SNIP>

   Performance counter stats for 'ls' (2 runs):

         3,935,236      cycles

       0.002353261 seconds time elapsed                                          ( +-  4.76% )

  $ perf report -D | grep PERF_RECORD | grep ROUND
  0xf0 [0]: failed to process type: 16
  Error:
  failed to process sample
  $

Reported-by: Kan Liang <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/builtin-stat.c

index fcece42c2611925c571c6f90f4f25ac33a7d4035..10f86a6d7b15228170b47b506a94701640a0bab3 100644 (file)
@@ -1449,6 +1449,11 @@ static int __cmd_record(int argc, const char **argv)
        if (output_name)
                file->path = output_name;
 
+       if (run_count != 1 || forever) {
+               pr_err("Cannot use -r option with perf stat record.\n");
+               return -1;
+       }
+
        session = perf_session__new(file, false, NULL);
        if (session == NULL) {
                pr_err("Perf session creation failed.\n");