Messages in this thread | | | Subject | Re: Unable to use tools/perf sched and timechart correctly | From | Peter Zijlstra <> | Date | Sun, 06 Dec 2009 11:55:05 +0100 |
| |
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.
| |