Vince,

Perfmon allows pure user-level sampling, but pfmon is not using
this mode. Without using a sampling format, and by requesint
notification on counter overflow, you would effectively get
a notification per counter overflow in your tool which could
then send a SIGUSR1 to the final process.

Now, I think there is a way to force pfmon into this behavior
by telling it to use a sampling buffer with only one entry
(--smpl-entries=1). Then you could simply hack pfmon to send you signal
which is much cleaner than hacking the kernel.



On Thu, Aug 30, 2007 at 05:59:39PM -0400, Vince Weaver wrote:
> 
> In the end I did come up with a simple hack that would send
> a signal to the monitored process when the counter overflowed.
> 
> This might not be safe, and definitely is not how you'd implement things
> if you were setting up a proper interface, but I thought I would send it
> to the list in case anyone else was curious about how to do this.
> 
> I put the call in the pfm_handle_work() function.
> 
> This particular code sends the SIGUSR1 function, and I successfully used
> it to have that signal sent to my code every 100Million retired
> instructions.
> 
> Vince
> 
> 
> diff -ur linux-source-2.6.22/perfmon/perfmon.c 
> linux-source-2.6.22.new/perfmon/perfmon.c
> --- linux-source-2.6.22/perfmon/perfmon.c     2007-08-30 17:22:12.000000000 
> -0400
> +++ linux-source-2.6.22.new/perfmon/perfmon.c 2007-07-26 21:50:25.000000000 
> -0400
> @@ -625,6 +625,8 @@
>        * restore flags as they were upon entry
>        */
>       spin_unlock_irqrestore(&ctx->lock, flags);
> +        kill_pid(find_pid(current->pid),10,0);
> +
>       return;
> 
>  do_zombie:
> 
> _______________________________________________
> perfmon mailing list
> [email protected]
> http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

-- 

-Stephane

_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

Reply via email to