Skip to content

Instantly share code, notes, and snippets.

@szaydel
Last active September 5, 2022 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save szaydel/926fd56ba5b89459b26339c9e7dcf15a to your computer and use it in GitHub Desktop.
Save szaydel/926fd56ba5b89459b26339c9e7dcf15a to your computer and use it in GitHub Desktop.
#!/usr/sbin/dtrace -Cs
#pragma D option quiet
#define SD_TO_DEVINFO(un) ((struct dev_info *)((un)->un_sd->sd_dev))
#define DEV_NAME(un) \
stringof(`devnamesp[SD_TO_DEVINFO(un)->devi_major].dn_name) /* ` */
#define DEV_INST(un) (SD_TO_DEVINFO(un)->devi_instance)
#define SD_GET_XBUF(bp) ((struct sd_xbuf *)((bp)->b_private))
#define SD_GET_UN(bp) ((SD_GET_XBUF(bp))->xb_un)
:sd:sdintr:entry {
this->bp = (struct buf *)args[0]->pkt_private;
this->un = SD_GET_UN(this->bp);
this->un_max_xfer_size = this->un->un_max_xfer_size;
this->devname = DEV_NAME(this->un);
this->inst = DEV_INST(this->un);
@[this->devname, this->inst, this->un_max_xfer_size] \
= count();
}
END {
printf("instance\txfer sz \tcount\n");
printa("%s%-8d\t%-8d\t%-8@d\n", @);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment