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]

systemtap syntax of runtime/probes/tests4/test4.c


The test4 example in the runtime library that uses the histograms is a pretty cool example. However, I don't see any place in the writeups where we describe the syntax for histograms. Below is an attempt to write it in systemtap synax. A couple of issue with the write below are:

-overloading "+=" to put things in the histogram.
-print operations assume a certain order for the argument
-print operations probably shouldn't be using raw C formatting commands

Comments on the translation and improvements to syntax?

-Will

global opens;
global hist(reads);
global hist(writes);

probe kernel.function("sys_open")
{
	open[$pname] += 1;
}

probe kernel.function("sys_read")
{
	reads[$pname] += $count;
}

probe kernel.function("sys_write")
{
	write[$pname] += $count;
}

probe end
{
print(opens, "%d opens by process \"%1s\"");
print(reads, "reads by process \"%1s\": %C. Total bytes=%S. Average: %A\n%H"));
print(writes ,"writes by process \"%1s\": %C. Total bytes=%S. Average: %A\n%H");
}



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