systemtap syntax of runtime/probes/tests4/test4.c
William Cohen
wcohen@redhat.com
Fri Jul 15 19:29:00 GMT 2005
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");
}
More information about the Systemtap
mailing list