From owner-freebsd-dtrace@FreeBSD.ORG Wed Feb 18 06:38:36 2015 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 171B85C6 for ; Wed, 18 Feb 2015 06:38:36 +0000 (UTC) Received: from elf.hq.norma.perm.ru (unknown [IPv6:2a00:7540:1::5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.norma.perm.ru", Issuer "Vivat-Trade UNIX Root CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 70E75692 for ; Wed, 18 Feb 2015 06:38:34 +0000 (UTC) Received: from bsdrookie.norma.com. (bsdrookie.norma.com [192.168.7.224]) by elf.hq.norma.perm.ru (8.14.9/8.14.9) with ESMTP id t1I6cSMT051332 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Wed, 18 Feb 2015 11:38:29 +0500 (YEKT) (envelope-from emz@norma.perm.ru) Message-ID: <54E43364.7050000@norma.perm.ru> Date: Wed, 18 Feb 2015 11:38:28 +0500 From: "Eugene M. Zheganin" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: freebsd-dtrace@freebsd.org Subject: io provider, b_bcount Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (elf.hq.norma.perm.ru [192.168.3.10]); Wed, 18 Feb 2015 11:38:29 +0500 (YEKT) X-Spam-Status: No hits=-101.2 bayes=0.0000 testhits ALL_TRUSTED=-1, AWL=1.724, BAYES_00=-1.9, USER_IN_WHITELIST=-100 autolearn=ham autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on elf.hq.norma.perm.ru X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Feb 2015 06:38:36 -0000 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.