lkml.org 
[lkml]   [2009]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] perf/sched: fix for getting task's execution time

* Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> wrote:

> 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 not compile with
> 'CONFIG_SCHED_DEBUG' option
> 2: perf tool should depend on proc file system
>
> So, this patch call getrusage() to get task's execution time instead
> of reading /proc file

ok, that's better than /proc, but how about using
PERF_COUNT_SW_TASK_CLOCK instead of rusage, to recover the CPU time
used? It would be more precise, and it would use the perf API. (Some
helper functions in tools/perf/lib/ would be nice to make it as easy to
use as rusage (or even easier if possible).)

Ingo


\
 
 \ /
  Last update: 2009-12-07 08:35    [W:0.082 / U:0.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site