This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Capturing load average from within systemtap script...


On Thu, 2008-02-07 at 17:16 +0000, Rick Beldin wrote:

> 
> // avenrun declared as extern long int avenrun[3] in sched.h
> %{
> #include <linux/timer.h>
> %}
> function get_avenrun:long (idx:long) %{ /* pure */
>     if (idx < 0 || idx > 2) return 0;
>         else return avenrun[idx];
> %}

Embedded C functions have special rules about accessing parameters and
setting the return value.  Try

%{
#include <linux/timer.h>
%}
function get_avenrun:long (idx:long) %{ /* pure */
    if (THIS->idx < 0 || THIS->idx > 2)
	THIS->__retvalue = 0;
    else 
	THIS->__retvalue = avenrun[THIS->idx];
%}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]