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...


<quote sender="Rick Beldin">
> Hi... 
> 
> I'm still having troubles - this time with embedded C code to access
> avenrun.   After modifying the code (pardon the mess): 
> 
> global timer_count
> global x1
> global x2
> global x3
> 
> // 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];
> %}

Change it to:

if (THIS->idx < 0 || THIS->idx > 2) THIS->__retvalue = 0;
	else THIS->__retvalue = avenrun[THIS->idx];

Thanks,
Eugene


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