This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
systemtap syntax of runtime/probes/tests4/test4.c
- From: William Cohen <wcohen at redhat dot com>
- To: SystemTAP <systemtap at sources dot redhat dot com>
- Date: Fri, 15 Jul 2005 15:29:35 -0400
- Subject: 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");
}