mkdir -p /lib/modules/2.6.18-194.el5/kernel/fs/$MOD/
cd /mnt/fmt/
cp modules/2.6.18-194.el5.x86_64/*.ko /lib/modules/2.6.18-194.el5/kernel/fs/$MOD/
cd /mnt/fmt/fs
stap_timing.sh $FILENAME #without path
stap -v timing.stp
Press ctrl-c will show the result.
#more stap_timing.sh
<pre>
cat >timing.stp <<EOF
global timing, intervals, avg_intervals
probe begin
{
printf("Timing functions. Press Ctrl+C to print summary and exit.\n");
}
EOF
while [ $# -gt 0 ]
do
file=$1; shift;
cat >>timing.stp <<EOF
probe module("MOD").function("*@$file").call {
timing[tid(), probefunc()] = gettimeofday_us()
}
probe module("MOD").function("*@$file").return {
t = gettimeofday_us()
old_t = timing[tid(), probefunc()]
if (old_t) intervals[probefunc()] <<< t - old_t
delete timing[tid(), probefunc()]
}
EOF
done
cat >>timing.stp <<EOF
probe end
{
foreach (func in intervals)
avg_intervals[func] = @avg(intervals[func])
printf("%30s %10s %10s %10s %10s %15s\n",
"Func", "Min (us)", "Avg (us)", "Max (us)", "Count", "Total (usec)");
foreach (func in avg_intervals+)
printf("%30s %10d %10d %10d %10d %15d\n",
func, @min(intervals[func]), @avg(intervals[func]), @max(intervals[func]),
@count(intervals[func]), @sum(intervals[func]))
exit()
}
EOF
</pre>
No comments:
Post a Comment