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: Implementing a generic binary trace interface.


Martin Hunt wrote:

Sorry for jumping in this discussion so late.  I read quickly through
the thread. The problem appears to be

1. Need for binary data
2. Need for flexible formating
3. printf too slow (although it really isn't too bad)

I like the gBTI proposal a lot, but it doesn't allow mixing strings and
ints and doesn't use varargs.  However that can be easily changed. But
lets consider just using something similar to printf, except it is far
simpler and doesn't do integer-to-ascii conversion, just writes binary.

probe kernel.function("sys_open")
{
	trace("%d%d%d%s%d", HOOKID_OPEN, $flags, $mode, $filename, $fd)
}
so that would write:
64-bit integer, HOOKID_OPEN
64-bit integer, $flags
64-bit integer, $mode
Null-terminated string, $filename
64-bit integer, $fd

Of course we could add length modifiers if we prefer more compact
output. We could also make it totally compatible with printf if we use
something other than %d and %s for binary. Something like:
%d - ASCII int
%1b - 1 byte binary number
%4b - 4 byte binary number
%8b - 8 byte binary number
%s  - string
%0s - null-terminated string
Which would make the previous example something like
trace("%1b%1b%1b%0s%1b", HOOKID_OPEN, $flags, $mode, $filename, $fd)

The trace function would then just directly call _stp_trace(), which
would be simple to implement.

This seems low-level enough to allow implementing almost any desired
output format.

Martin


This sound like a good idea, but I wonder how it will perform compared to gBTI. For the purposes of trace, I think the best implementation is the one with the best performance and smallest impact on the system. If we can get something like this to perform as good or better that gBTI the is also a good candidate. It does have some of the flexibility that we would like to see on a trace interface.

-JRS


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