Posts

Showing posts from January, 2011

Measuring Read/Write durations with DTrace

I had the situation, where I wanted to see if read/write operations take too much time. It was something that I thought could be done easily with DTrace. Unfortunately, my DTrace skills are a bit rusty, so I contacted my personal DTrace guru Javier, who gave me a script. Here is the script for read operations: slow_read.d: #!/usr/sbin/dtrace -s #pragma D option quiet #pragma D option switchrate=10hz syscall::*read:entry {         this->filistp = curthread->t_procp->p_user.u_finfo.fi_list;         this->ufentryp = (uf_entry_t *)((uint64_t)this->filistp + (uint64_t)arg0 * (uint64_t)sizeof (uf_entry_t));         this->filep = this->ufentryp->uf_file;         self->offset = this->filep->f_offset;         this->vnodep = this->filep != 0 ? this->filep->f_vnode : 0; ...