• Jiri Olsa's avatar
    perf script: Add 'tod' field to display time of day · e534bfb1
    Jiri Olsa authored
    Add a 'tod' field to display time of day column with time of date
    (wallclock) time.
    
      # perf record -k CLOCK_MONOTONIC kill
      kill: not enough arguments
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.033 MB perf.data (8 samples) ]
    
      # perf script
                perf 261340 152919.481538:          1 cycles:  ffffffff8106d104 ...
                perf 261340 152919.481543:          1 cycles:  ffffffff8106d104 ...
                perf 261340 152919.481545:          7 cycles:  ffffffff8106d104 ...
      ...
    
      # perf script --ns
                perf 261340 152919.481538922:          1 cycles:  ffffffff8106d ...
                perf 261340 152919.481543286:          1 cycles:  ffffffff8106d ...
                perf 261340 152919.481545397:          7 cycles:  ffffffff8106d ...
      ...
    
      # perf script -F+tod
                perf 261340 2020-07-13 18:26:55.620971 152919.481538:           ...
                perf 261340 2020-07-13 18:26:55.620975 152919.481543:           ...
                perf 261340 2020-07-13 18:26:55.620978 152919.481545:           ...
      ...
    
      # perf script -F+tod --ns
                perf 261340 2020-07-13 18:26:55.620971621 152919.481538922:     ...
                perf 261340 2020-07-13 18:26:55.620975985 152919.481543286:     ...
                perf 261340 2020-07-13 18:26:55.620978096 152919.481545397:     ...
      ...
    
    It's available only for recording with clockid specified, because it's
    the only case where we can get reference time to wallclock time. It's
    can't do that with perf clock yet.
    
    Error is display if you want to use --tod on data without clockid
    specified:
    
      # perf script -F+tod
      Can't provide 'tod' time, missing clock data. Please record with -k/--clockid option.
    Original-patch-by: default avatarDavid Ahern <dsahern@gmail.com>
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Geneviève Bastien <gbastien@versatic.net>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Jeremie Galarneau <jgalar@efficios.com>
    Cc: Michael Petlan <mpetlan@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lore.kernel.org/lkml/20200805093444.314999-8-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    e534bfb1
builtin-script.c 103 KB