public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: "Török Edwin" <edwintorok@gmail.com>,
	"Paul Mackerras" <paulus@samba.org>,
	"Ingo Molnar" <mingo@elte.hu>,
	"Linux Kernel" <linux-kernel@vger.kernel.org>
Subject: Re: Unable to use tools/perf sched and timechart correctly
Date: Sun, 06 Dec 2009 11:55:05 +0100	[thread overview]
Message-ID: <1260096905.7818.309.camel@laptop> (raw)
In-Reply-To: <4B1B8A66.6040302@cn.fujitsu.com>

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.




  reply	other threads:[~2009-12-06 10:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-04 10:21 Unable to use tools/perf sched and timechart correctly Török Edwin
2009-12-06 10:41 ` Xiao Guangrong
2009-12-06 10:55   ` Peter Zijlstra [this message]
2009-12-06 12:52   ` Török Edwin
2009-12-06 17:16   ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1260096905.7818.309.camel@laptop \
    --to=peterz@infradead.org \
    --cc=edwintorok@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=xiaoguangrong@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox