mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] perf/sched: fix for getting task's execute time
Date: Sun, 6 Dec 2009 12:50:40 +0100	[thread overview]
Message-ID: <20091206115040.GB871@elte.hu> (raw)
In-Reply-To: <1260097609.7818.349.camel@laptop>


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Sun, 2009-12-06 at 12:05 +0100, Peter Zijlstra wrote:
> > On Sun, 2009-12-06 at 18:57 +0800, Xiao Guangrong wrote:
> > > In current code, we get task's execute time by reading
> > > "/proc/<pid>/sched" file, it's wrong if the task is created
> > > by pthread_create(), because every thread task has same pid.
> > > So, the correct way is reading "/proc/<ppid>/task/<tid>/sched"
> > > file.
> > > 
> > > This patch also remove redundant include files since <sys/types.h>
> > > is included in "perf.h"
> > 
> > We really should not be using these proc files but instead make sure
> > this information gets transferred through a tracepoint or similar.
> > 
> > Reading these proc files is too prone to races.

yeah. Ideally we'd want all valuable information that is available via 
/proc to be available via perf events as well. In the future it should 
be possible to run perf even without /proc mounted for example.

Furthermore it's good for consistency and simplicity as well, plus it's 
faster too to get the information from the perf syscall and mmap-ed 
ringbuffer than to read things via /proc. No need for ASCII conversion, 
fixed record formats, fast streaming and buffering, no read() overhead, 
etc.

> We can probably get the runtime by grouping a task-clock swcounter 
> with an appropriate other event.

Would be lovely.

	Ingo

  reply	other threads:[~2009-12-06 11:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-06 10:57 Xiao Guangrong
2009-12-06 11:05 ` Peter Zijlstra
2009-12-06 11:06   ` Peter Zijlstra
2009-12-06 11:50     ` Ingo Molnar [this message]
2009-12-06 17:10     ` Xiao Guangrong
2009-12-07  7:20       ` [PATCH v2] perf/sched: fix for getting task's execution time Xiao Guangrong
2009-12-07  7:30         ` Ingo Molnar
2009-12-09  9:51           ` [PATCH v3] " Xiao Guangrong
2009-12-09  9:54             ` Xiao Guangrong
2009-12-09  9:59               ` Ingo Molnar
2009-12-09  9:57             ` Xiao Guangrong
2009-12-09  9:57             ` Ingo Molnar
2009-12-09 10:03             ` [tip:perf/urgent] perf sched: Fix " tip-bot for Xiao Guangrong

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=20091206115040.GB871@elte.hu \
    --to=mingo@elte.hu \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.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

all inboxes | Powered by JetHome®