dtrace script for io latency/throughput

Michael W. Lucas mwlucas at michaelwlucas.com
Tue Aug 18 17:25:49 UTC 2015


Hi,

I'm working on the performance part of allanjude@'s & mine next ZFS
book. There's an incredibly useful latency/throughput script at
http://dtrace.org/blogs/ahl/2014/08/31/openzfs-tuning/, but it doesn't
work on FreeBSD.

I try to run this script on FreeBSD and get:

# dtrace -s rw.d -c 'sleep 60'
dtrace: failed to compile script rw.d: line 10: b_edev is not a member of struct bio

Which seems pretty clear: FreeBSD is not Solarisy.

Is there a similar (or simpler) way to map latency vs throughput on FreeBSD?

Thanks,
==ml

PS: The script is:

#pragma D option quiet

BEGIN
{
        start = timestamp;
	}

io:::start
{
        ts[args[0]->b_edev, args[0]->b_lblkno] = timestamp;
	}

io:::done
/ts[args[0]->b_edev, args[0]->b_lblkno]/
{
        this->delta = (timestamp - ts[args[0]->b_edev, args[0]->b_lblkno]) / 1000;
	this->name = (args[0]->b_flags & (B_READ | B_WRITE)) == B_READ ?
	"read " : "write ";

        @q[this->name] = quantize(this->delta);
	@a[this->name] = avg(this->delta);
	@v[this->name] = stddev(this->delta);
	@i[this->name] = count();
	@b[this->name] = sum(args[0]->b_bcount);
        ts[args[0]->b_edev, args[0]->b_lblkno] = 0;
	}

END
{
        printa(@q);

        normalize(@i, (timestamp - start) / 1000000000);
	normalize(@b, (timestamp - start) / 1000000000 * 1024);

        printf("%-30s %11s %11s %11s %11s\n", "", "avg latency", "stddev", "iops", "throughput");
	printa("%-30s %@9uus %@9uus %@9u/s %@8uk/s\n", @a, @v, @i, @b);
			    }
			    
 


-- 
Michael W. Lucas  -  mwlucas at michaelwlucas.com, Twitter @mwlauthor 
http://www.MichaelWLucas.com/, http://blather.MichaelWLucas.com/


More information about the freebsd-fs mailing list