• Arnaldo Carvalho de Melo's avatar
    perf tests: No need to set attr.sample_freq for tracking !PERF_RECORD_SAMPLE · 239849dd
    Arnaldo Carvalho de Melo authored
    We were asking for a 4kHz sample_freq, making the test fail needlessly
    when the system reduced /proc/sys/kernel/perf_event_max_sample_rate
    below that.
    
    Before:
    
      # perf test -vv dummy
      23: Test using a dummy software event to keep tracking       :
      --- start ---
      test child forked, pid 32421
      ------------------------------------------------------------
      perf_event_attr:
        type                             1
        size                             112
        config                           0x9
        { sample_period, sample_freq }   4000
        sample_type                      IP|TID|ID|PERIOD
      <SNIP>
      sys_perf_event_open failed, error -22
      Unable to open dummy and cycles event
      test child finished with -2
      ---- end ----
      Test using a dummy software event to keep tracking: Skip
      #
      [root@zoo ~]# cat /proc/sys/kernel/perf_event_max_sample_rate
      1000
    
    After:
    
      [root@zoo ~]# perf test dummy
      23: Test using a dummy software event to keep tracking       : Ok
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-487iquegrs2379e5n0pi0tcp@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    239849dd
keep-tracking.c 3.3 KB