Date: Wed, 18 Feb 2015 11:38:28 +0500 From: "Eugene M. Zheganin" <emz@norma.perm.ru> To: freebsd-dtrace@freebsd.org Subject: io provider, b_bcount Message-ID: <54E43364.7050000@norma.perm.ru>
next in thread | raw e-mail | index | archive | help
Hi. I'm trying to port the Solaris iotop script (not the complicated ksh-iottop, but rather simple iotop) to FreeBSD. Here's the script: #!/usr/sbin/dtrace -s #pragma D option quiet BEGIN { printf("%-6s %-20s %s\n", "PID", "COMMAND", "BYTES/SEC"); printf("------ -------------------- ---------"); last = timestamp; } io:::start { @io[pid, execname] = sum(args[0]->b_bcount); } tick-5sec { trunc(@io, 10); printf("\n"); normalize(@io, (timestamp - last) / 1000000000); printa("%-6d %-20s %@d\n", @io); trunc(@io, 0); last = timestamp; } It works fine on Solaris, but on FreeBSD I got the error dtrace: failed to compile script ./iotop.old: line 12: b_bcount is not a member of struct bio I figured out that since the bio struct is mentioned, I have to use the bio_bcount instead. Is this correct ? Second issue - when running this modified with bio_bcount script, I get the actual data, that seems to reflect reality, but I'm also getting tonnes of errors like: dtrace: error on enabled probe ID 2 (ID 56400: io:kernel::start): invalid address (0x20) in action #4 at DIF offset 16 dtrace: error on enabled probe ID 2 (ID 56400: io:kernel::start): invalid address (0x20) in action #4 at DIF offset 16 dtrace: error on enabled probe ID 2 (ID 56400: io:kernel::start): invalid address (0x20) in action #4 at DIF offset 16 dtrace: error on enabled probe ID 2 (ID 56400: io:kernel::start): invalid address (0x20) in action #4 at DIF offset 16 dtrace: error on enabled probe ID 2 (ID 56400: io:kernel::start): invalid address (0x20) in action #4 at DIF offset 16 - and I want to ask - why. I get no errors on Solaris (and yes - the modification may be the reason). Is it safe to ignore the errors, or should the script be modified in some manner ? Thanks. Eugene.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54E43364.7050000>