This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Implementing a generic binary trace interface.
Hi,
Frank Ch. Eigler wrote:
> Hi -
>
>
>>[...] One of simpler ways, I think, is to allow the script functions
>>to take long arrays as its arguments. Thus, we can transport whole
>>the array to user space as like below;
>>
>>function array_log ( map:long[] ) %{
>>[...]
>>%}
>
>
> Can you think of a scenario where tracing an entire array could be
> necessary in a time-critical place? If not, then coding the array
> printing by an explicit foreach would not be a serious burden.
I think this feature is useful for the cases below.
- Shortage of Stack
There may be trace points at where there is not enough memory of
stack. The variable arguments may consume a lot of memory from
the stack.
On the other hand, an array argument consumes a bit of memory to
store a pointer.
- Single Probe for Various Events
For simplicity, single probe should be able to handle various
events. Please Assume a probe which traces two events; One event
has two argument, and another has five arguments. Obviously, the
probe should record five arguments for each event as below:
// definitions of events
probe kernel.trace.event1 = kernel.function("sys_gettimeofday").return {
etype = 1; arg1 = retval(); nargs = 1
}
probe kernel.trace.event2 = kernel.function(""do_fork") {
etype = 2; arg1 = pid(); arg2 = $clone_flags;
arg3 = $stack_start;arg4 = $stack_size; nargs = 4;
}
// probe handler
probe kernel.trace.* {
binary_log(nargs + 1,etype, arg1,arg2,arg3,arg4);
}
In this case, binary_log() function *always* gets six arguments,
and transports two or five arguments to user space. I think it
would be just wastes of stack.
On the other hand, an array uses only necessary memory.
Best regards,
--
Masami HIRAMATSU
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory
E-mail: hiramatu@sdl.hitachi.co.jp