• Han Pingtian's avatar
    perf test: Use cpu_map->[cpu] when setting affinity · ffb5e0fb
    Han Pingtian authored
    When some of CPUs are offline:
    
     # cat /sys/devices/system/cpu/online
     0,6-31
    
    perf test will fail on #3 testcase:
    
       3: detect open syscall event on all cpus:
       --- start ---
       perf_evsel__read_on_cpu: expected to intercept 111 calls on cpu 0, got 681
       perf_evsel__read_on_cpu: expected to intercept 112 calls on cpu 1, got 117
       perf_evsel__read_on_cpu: expected to intercept 113 calls on cpu 2, got 118
       perf_evsel__read_on_cpu: expected to intercept 114 calls on cpu 3, got 119
       perf_evsel__read_on_cpu: expected to intercept 115 calls on cpu 4, got 120
       perf_evsel__read_on_cpu: expected to intercept 116 calls on cpu 5, got 121
       perf_evsel__read_on_cpu: expected to intercept 117 calls on cpu 6, got 122
       perf_evsel__read_on_cpu: expected to intercept 118 calls on cpu 7, got 123
       perf_evsel__read_on_cpu: expected to intercept 119 calls on cpu 8, got 124
       perf_evsel__read_on_cpu: expected to intercept 120 calls on cpu 9, got 125
       perf_evsel__read_on_cpu: expected to intercept 121 calls on cpu 10, got 126
       ....
    
    This patch try to use 'cpus->map[cpu]' when setting cpu affinity, and
    will check the return code of sched_setaffinity()
    
    LKML-Reference: <20110120114707.GA11781@hpt.nay.redhat.com>
    Signed-off-by: default avatarHan Pingtian <phan@redhat.com>
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    ffb5e0fb
builtin-test.c 11.9 KB