lkml.org 
[lkml]   [2008]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [patch 0/3] [Announcement] Performance Counters for Linux
From
From: Ingo Molnar <mingo@elte.hu>
Date: Fri, 5 Dec 2008 09:08:13 +0100

>
> * Paul Mackerras <paulus@samba.org> wrote:
>
> > Ingo Molnar writes:
> > >
> > > * Paul Mackerras <paulus@samba.org> wrote:
> > [snip]
> > > > One thing that this sort of thing can't do is to get values from
> > > > multiple counters that correlate with each other. For instance, we
> > > > would often want to count, say, L2 cache misses and instructions
> > > > completed at the same time, and be able to read both counters at very
> > > > close to the same time, so that we can measure average L2 cache misses
> > > > per instruction completed, which is useful.
> > >
> > > This can be done in a very natural way with our abstraction, and the
> > > "hello.c" example happens to do exactly that:
> >
> > Has hello.c been posted? I can't find it in any of the posts from you
> > or Thomas. Am I just being blind? :)
>
> Sorry, was late at night when we did the release - monitor.c was posted -
> and i just posted hello.c it half an hour ago :)
>
> > > aldebaran:~/perf-counter-test> ./hello
> > > doing perf_counter_open() call:
> > > counter[0]... fd: 3.
> > > counter[1]... fd: 4.
> > > counter[0] delta: 10866 cycles
> > > counter[1] delta: 414 cycles
> > > counter[0] delta: 23640 cycles
> > > counter[1] delta: 3673 cycles
> > > counter[0] delta: 28225 cycles
> > > counter[1] delta: 3695 cycles
> > >
> > > This counts cycles executed and instructions executed, and reads the two
> > > counters out at the same time.
> >
> > Isn't it two separate read() calls to read the two counters? If so,
> > the only way the two values are actually going to correspond to the
> > same point in time is if the task being monitored is stopped. In which
> > case the monitoring task needs to use ptrace or something similar in
> > order to make sure that the monitored task is actually stopped.
>
> It doesnt matter in practice.

Yes it DOES!

If I want to know if a code block triggers event X or Y, and your read
call triggers one of those events, I can't figure out the answer to my
profiling problem.

That is completely fundamental to all of this. And this is why this
proposal is a non-workable solution.


> Also, look at our code: we buffer notification events and do not have to
> stop the thread for recording the context information.

But that's what monitoring libraries want, they want to stop the task
and inspect it.

Look at the PAPI library. If you can't implement what that thing
provides, all the real users of profiling information can't use
this stuff.

> Even if the two read()s are done apart, stopping a task is _far_ more
> intrusive to the event flow of a single application.

I really don't think you get the use case for these kinds of
facilities.

Once again I encourage you to look at the test programs, test cases,
and wonderful documentation provided with the PAPI and perfmon2
library bits. That's how people want to use this stuff. Ignore
at your own peril :-)



\
 
 \ /
  Last update: 2008-12-05 09:17    [W:0.162 / U:0.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site