Eliminating duplicate code in tapset files
Mike Mason
mmlnx@us.ibm.com
Tue Jul 10 21:13:00 GMT 2007
Suppose I have a tapset with many probes and most of the variables exposed by these probes are the same. Rather than duplicating the same code over and over, I'd like to define the variables once and reference that definition in each probe, similar to a macro. I envision something like below (details TBD). Is there some way to accomplish this now in SystemTap? If not, how do others feel about adding this capability?
Mike
macro VFS_COMMON
{
file = $file
count = $count
pos = $pos
buf = $buf
dev = __file_dev($file)
devname = __find_bdevname(dev, __file_bdev($file))
ino = __file_ino($file)
filename = __file_filename($file)
}
probe vfs.read = kernel.function ("vfs_read")
{
%VFS_COMMON
size = count
}
probe vfs.read.return = kernel.function ("vfs_read").return
{
%VFS_COMMON
size = $return
}
probe vfs.write = kernel.function ("vfs_write")
{
%VFS_COMMON
size = count
}
probe vfs.write.return = kernel.function ("vfs_write").return
{
%VFS_COMMON
size = $return
}
More information about the Systemtap
mailing list