This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Linux VFS cache hit rate script
On Fri, Apr 22, 2011 at 1:28 PM, Josh Stone <jistone@redhat.com> wrote:
> That should do it. ?I should have been more clear - the effect I
> intended was just to relieve the need for MAXMAPENTRIES. ?The
> "__devnames" map should now only contain the real device names, and not
> waste any time/space on "N/A" entries. ?Your script's output would not
> be affected though.
>
> Josh
>
Ah. Well, in that case, sorry, still no good. I cut out that bit of
the output, but:
# time stap -DSTP_NO_OVERLOAD devnames.stp -c "sleep 35" | sort | uniq -c
ERROR: Array overflow, check MAXMAPENTRIES near identifier '$file' at
/usr/share/systemtap/tapset/vfs.stp:780:9
WARNING: Number of errors: 1, skipped probes: 2126
Pass 5: run failed. Try again with another '--vp 00001' option.
Here's an interesting note though: the line numbers are different. The
only difference between the runs is which of the 2 functions is
commented out.
With stock function:
ERROR: Array overflow, check MAXMAPENTRIES near identifier '$file' at
/usr/share/systemtap/tapset/vfs.stp:769:9
With your function:
ERROR: Array overflow, check MAXMAPENTRIES near identifier '$file' at
/usr/share/systemtap/tapset/vfs.stp:780:9
Here's that snippet in vfs.stp (pasting here because the line numbers
are going to be off now, as compared to the stock file):
761 probe vfs.read = kernel.function("vfs_read")
762 {
763 file = $file
764 pos = $pos
765 buf = $buf
766 bytes_to_read = $count
767 dev = __file_dev($file)
768 devname = __find_bdevname(dev, __file_bdev($file))
769 ino = __file_ino($file)
770
771 name = "vfs.read"
772 argstr = sprintf("%d, %d, %p", $count, $pos, $buf)
773 }
774
775 probe vfs.read.return = kernel.function("vfs_read").return
776 {
777 name = "vfs.read"
778 retstr = sprintf("%d", $return)
779
780 file = $file
781 pos = $pos
782 buf = $buf
783 bytes_to_read = $count
784 dev = __file_dev($file)
785 devname = __find_bdevname(dev, __file_bdev($file))
786 ino = __file_ino($file)
787
788 ret = $return
789 bytes_read = $return > 0 ? $return : 0
790 error = $return < 0 ? $return : 0
791 error_str = error ? errno_str(error) : ""
792 }
So as you can see, one errors in vfs.read, the other in
vfs.read.return. In both cases something to do with $file gets
assigned to a normal variable.
Side note: I wonder if the "name" variables are messed up... vfs.read*
and vfs.write* don't follow quite the same pattern:
probe vfs.read = kernel.function("vfs_read")
name = "vfs.read"
probe vfs.read.return = kernel.function("vfs_read").return
name = "vfs.read"
probe vfs.readv = kernel.function("vfs_readv")
name = "vfs.read"
probe vfs.readv.return = kernel.function("vfs_readv").return
name = "vfs.readv"
probe vfs.write = kernel.function("vfs_write")
name = "vfs.write"
probe vfs.write.return = kernel.function("vfs_write").return
name = "vfs.write"
probe vfs.writev = kernel.function("vfs_writev")
name = "vfs.writev"
probe vfs.writev.return = kernel.function("vfs_writev").return
name = "vfs.writev"
Jake