lkml.org 
[lkml]   [2009]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Unable to use tools/perf sched and timechart correctly
From
Date
On Sun, 2009-12-06 at 18:41 +0800, Xiao Guangrong wrote:

> You should enable "CONFIG_SCHED_DEBUG", because we use
> "/proc/<pid>/sched" file to get the task's cpu usage.
>
> Ingo, I think we do better show the reason about this error,
> just like:
>
> ---
> tools/perf/builtin-sched.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> index 26b782f..f823631 100644
> --- a/tools/perf/builtin-sched.c
> +++ b/tools/perf/builtin-sched.c
> @@ -427,7 +427,11 @@ static u64 get_cpu_usage_nsec_self(void)
>
> sprintf(filename, "/proc/%d/sched", getpid());
> file = fopen(filename, "r");
> - BUG_ON(!file);
> + if (!file)
> + {
> + printf("You should compile your kernel with CONFIG_SCHED_DEBUG option\n");
> + BUG_ON(1);
> + }
>
> while ((chars = getline(&line, &len, file)) != -1) {
> ret = sscanf(line, "se.sum_exec_runtime : %ld.%06ld\n",

Hrmm, we shouldn't be using a proc file at all, the best solution is to
remove this dependency.





\
 
 \ /
  Last update: 2009-12-06 11:57    [W:0.060 / U:5.220 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site