• Yang Jihong's avatar
    perf sched: Fix record failure when CONFIG_SCHEDSTATS is not set · b0f00855
    Yang Jihong authored
    The tracepoints trace_sched_stat_{wait, sleep, iowait} are not exposed to user
    if CONFIG_SCHEDSTATS is not set, "perf sched record" records the three events.
    As a result, the command fails.
      #perf sched record sleep 1
      event syntax error: 'sched:sched_stat_wait'
                           \___ unknown tracepoint
      Error:  File /sys/kernel/tracing/events/sched/sched_stat_wait not found.
      Hint:   Perhaps this kernel misses some CONFIG_ setting to enable this feature?.
      Run 'perf list' for a list of valid events
       Usage: perf record [<options>] [<command>]
          or: perf record [<options>] -- <command> [<options>]
          -e, --event <event>   event selector. use 'perf list' to list available events
      Check whether schedstat tracepoints are exposed. If no, these events are not recorded.
      # perf sched record sleep 1
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.163 MB perf.data (1091 samples) ]
      # perf sched report
      run measurement overhead: 4736 nsecs
      sleep measurement overhead: 9059979 nsecs
      the run test took 999854 nsecs
      the sleep test took 8945271 nsecs
      nr_run_events:        716
      nr_sleep_events:      785
      nr_wakeup_events:     0
    Fixes: 2a09b5de
     ("sched/fair: do not expose some tracepoints to user if CONFIG_SCHEDSTATS is not set")
    Signed-off-by: default avatarYang Jihong <yangjihong1@huawei.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Yafang Shao <laoar.shao@gmail.com>
    Link: http://lore.kernel.org/lkml/20210713112358.194693-1-yangjihong1@huawei.com
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
builtin-sched.c 89.7 KB