-
-
Save kassandry/219596d7f17e5b128e68 to your computer and use it in GitHub Desktop.
rw.d dtrace FreeBSD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/dtrace -s | |
#pragma D option quiet | |
BEGIN | |
{ | |
bio_cmd[1] = "Read"; | |
bio_cmd[2] = "Write"; | |
bio_cmd[4] = "Delete"; | |
bio_cmd[8] = "Getattr"; | |
bio_cmd[16] = "Flush"; | |
start = timestamp; | |
} | |
io:::start | |
/args[0] != NULL/ | |
{ | |
ts[args[0]->bio_disk->d_geom->name, args[0]->bio_pblkno] = timestamp; | |
} | |
io:::done | |
/args[0] != NULL && ts[args[0]->bio_disk->d_geom->name, args[0]->bio_pblkno]/ | |
{ | |
this->delta = (timestamp - ts[args[0]->bio_disk->d_geom->name, args[0]->bio_pblkno]) / 1000; | |
this->name = bio_cmd[args[0]->bio_cmd]; | |
@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]->bio_bcount); | |
ts[args[0]->bio_disk->d_geom->name, args[0]->bio_pblkno] = 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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment