This is the mail archive of the systemtap@sources.redhat.com 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]

Few queries on tapset interface


Hi,

I am trying to write down some tapsets to trace all the system calls. 
System call tapsets can be used to find the time taken to complete the 
system call and dump the arguments and return value as shown in the example 
below.

struct read_trace {
	unsigned long entry_time;
	unsigned long my_count;
	unsigned long my_fd;	
};


#define NUM_SYSCALL XXX;
static struct read_trace self;
static unsigned long read_times[NUM_SYSCALL];

probe syscall:entry("read")
{
	self->entry_time = $timestamp;
	self->my_count = count;
	self->my_fd = fd;
	printk("my_count =0x%x,my_fd = 0x%x\n", self->my_count, self->my_fd);
}

probe syscall:exit("read")
{
	if (self->entry_time) {
		read_times[$syscall_name] += $timestamp - self->entry_time;
		self->entry_time = 0;
	}
	printk("sys_read: return value =0x%x\n",*(ri->ret_addr));
}

I came across few questions while writing the tapsets, Please
provide your comments.

Is the above tapset syntax ok?
Are there some documents to assist in writing the tapsets?
How can one access the function arguments?
Is there a built-in function to print the variable?
Is there some other way to allocate tapset global variables?

Thanks
Prasanna
-- 

Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Ph: 91-80-25044636
<prasanna@in.ibm.com>


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