• Xiao Guangrong's avatar
    perf sched: Fix for getting task's execution time · c0c9e721
    Xiao Guangrong authored
    In current code, task's execute time is got by reading
    '/proc/<pid>/sched' file, it's wrong if the task is created
    by pthread_create(), because every thread task has same pid.
    
    This way also has two demerits:
    
     1: 'perf sched replay' can't work if the kernel is not
        compiled with the 'CONFIG_SCHED_DEBUG' option
    
     2: perf tool should depend on proc file system
    
    So, this patch uses PERF_COUNT_SW_TASK_CLOCK to get task's
    execution time instead of reading /proc file.
    
    Changelog v2 -> v3:
    use PERF_COUNT_SW_TASK_CLOCK instead of rusage() as Ingo's
    suggestion
    Reported-by: default avatarTorok Edwin <edwintorok@gmail.com>
    Signed-off-by: default avatarXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
    Cc: Xiao Guangrong <ericxiao.gr@gmail.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Paul Mackerras <paulus@samba.org>
    LKML-Reference: <4B1F7322.80103@cn.fujitsu.com>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    c0c9e721
builtin-sched.c 42.7 KB