• Yang Jihong's avatar
    perf record: Check conflict between '--timestamp-filename' option and pipe mode before recording · 02f9b50e
    Yang Jihong authored
    In pipe mode, no need to switch perf data output, therefore,
    '--timestamp-filename' option should not take effect.
    Check the conflict before recording and output WARNING.
    In this case, the check pipe mode in perf_data__switch() can be removed.
    
    Before:
    
      # perf record --timestamp-filename -o- perf test -w noploop | perf report -i- --percent-limit=1
      # To display the perf.data header info, please use --header/--header-only options.
      #
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Dump -.2024011812110182 ]
      #
      # Total Lost Samples: 0
      #
      # Samples: 4K of event 'cycles:P'
      # Event count (approx.): 2176784359
      #
      # Overhead  Command  Shared Object         Symbol
      # ........  .......  ....................  ......................................
      #
          97.83%  perf     perf                  [.] noploop
    
      #
      # (Tip: Print event counts in CSV format with: perf stat -x,)
      #
    
    After:
    
      # perf record --timestamp-filename -o- perf test -w noploop | perf report -i- --percent-limit=1
      WARNING: --timestamp-filename option is not available in pipe mode.
      # To display the perf.data header info, please use --header/--header-only options.
      #
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.000 MB - ]
      #
      # Total Lost Samples: 0
      #
      # Samples: 4K of event 'cycles:P'
      # Event count (approx.): 2185575421
      #
      # Overhead  Command  Shared Object          Symbol
      # ........  .......  .....................  .............................................
      #
          97.75%  perf     perf                   [.] noploop
    
      #
      # (Tip: Profiling branch (mis)predictions with: perf record -b / perf report)
      #
    
    Fixes: ecfd7a9c ("perf record: Add '--timestamp-filename' option to append timestamp to output file name")
    Signed-off-by: default avatarYang Jihong <yangjihong1@huawei.com>
    Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Link: https://lore.kernel.org/r/20240119040304.3708522-3-yangjihong1@huawei.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    02f9b50e
builtin-record.c 112 KB