This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Capturing load average from within systemtap script...
On Thu, 2008-02-07 at 17:30 +0000, Frank Ch. Eigler wrote:
> Very sorry, I sent you untested code. The API for embedded-C
> functions is different than normal functions, since parameters and
> return values are passed in an explicit stack-like data structure.
> This should work better:
>
> -------------------
> function get_avenrun:long (idx:long) %{ /* pure */
> if (THIS->idx < 0 || THIS->idx > 2) THIS->__retvalue = 0;
> else THIS->__retvalue = avenrun[THIS->idx];
> %}
> -------------------
Argh. This was staring me right in the face and I didn't
see it. I was even looking at another example that did
this. Thanks again.
> By the way, you will find scanning "stap -p3" useful in decoding error
> messages like those from "stap -p4 -v".
Nice. I hadn't used this option. I had been using -k to
save the temp directory and then go look at the contents.
The biggest challenge I have with systemtap is identifying
where in the processing the errors are being generated. While
gross syntactical errors are easy to identify, the ones
from generated code can be somewhat challenging unless you
are intimately familiar with the process.
Rick
--
+----------------------------------------------------------------------+
| Rick Beldin | Hewlett-Packard Company |
| email: Rick.Beldin@hp.com | Global Solutions Engineering |
| WTEC Linux, RHCE | 5555 Windward Parkway West |
| | Alpharetta, GA 30004 |
+----------------------------------------------------------------------+