szaydel
10/10/2018 - 7:38 PM

Given a pid of a running process report IOCTL latency

#!/usr/sbin/dtrace -qCs
/* stolen from /usr/include/sys/scsi/impl/uscsi.h */
#define USCSIIOC        (0x04 << 8)
#define USCSICMD        (USCSIIOC|201)  /* user scsi command */

pid$target::ioctl:entry {
  self->p = 0;
  self->t = timestamp;
  self->i = arg1;
}
pid$target::ioctl:return /self->t/ {
  @[probefunc,
    self->i == USCSICMD ? "USCSICMD" : "other"] =
      quantize(timestamp - self->t);
  self->fd = 0 ; self->t = 0 ;
}