Disk IO

From DTraceBook

Jump to: navigation, search

This chapter uses DTrace for analyzing the disk subsystem, including block device I/O, SCSI, SATA, IDE and SAS.

Contents

Sample One-Liners

See the DTrace book for more one-liners.

io Provider

Show disk I/O size as distribution plots, by process name
dtrace -n 'io:::start { @size[execname] = quantize(args[0]->b_bcount); }'

Identify kernel stacks calling disk I/O
dtrace -n 'io:::start { @[stack()] = count(); }'

Trace errors along with disk and error number
dtrace -n 'io:::done /args[0]->b_flags & B_ERROR/ { printf("%s err: %d", args[1]->dev_statname, args[0]->b_error); }'

fbt Provider

Identify kernel stacks calling disk I/O (FreeBSD)
dtrace -n 'fbt::bufstrategy:entry { @[stack()] = count(); }'

Scripts

Errata

1st printing:

  • p231, 2nd para: "scripts is this book": "is" -> "in"

Links

Personal tools