Hi,

Is there a way to read the current count of the performance registers
in libpfm-3.2-070725 without system call overhead?


I'm integrating libpfm into an application that does context-sensitive
profiling.  That means that I frequently update a pointer to a
location where I want the time/eventcount spent since the last call
accumulated.  Each call means I need to read the current
time/evntcount.

Pseudocode:

#define MAX_CODE_SECTIONS 4
struct profvalues[MAX_CODE_SECTIONS];
set_currently_active_section(0);
// code;...
// code;...
set_currently_active_section(1);
// more code...
set_currently_active_section(0);
// code...
set_currently_active_section(3);
[...]


Where set_currently_active_section(n) updates the section that went out of
scope with the time spent since the last call and marks where to store
the next results, e.g.
  profvalues[previous_section].time += gettimeofday() - last_call_gettimeofday;

I was hoping that I could read perfmon results without any systemcall
overhead at all, which I think was possible with the self_view style
interface in pervious versions, via requesting a memory mapping that
the kernel provided.  (can anybody confirm that this assumption is
correct?)

Right now it seems I have to call at least pfm_read_pmds() every time,
and possibly stop/start, too, which adds considerable overhead.

A call to pfm_read_pmds takes about 350 nsec on my system, compared to
130 nsec for gettimeofday.  My original intend was to get rid of any
system calls and even replace gettimeofday() with the perfmon clock
counter.

(Clarification: the events I want monitored do not change during any
of the above profiling)

Any hints appreciated.

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <[EMAIL PROTECTED]>   http://www.cons.org/cracauer/
_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

Reply via email to