-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add probes for NVMe read/write operations and example dtrace script.
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/*/target | ||
**/Cargo.lock | ||
debug.out | ||
core |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/sbin/dtrace -s | ||
|
||
/* | ||
* nvme-trace.d Print propolis emulated NVMe read/write latency. | ||
* | ||
* USAGE: ./nvme-trace.d -p propolis-pid | ||
*/ | ||
|
||
#pragma D option quiet | ||
|
||
dtrace:::BEGIN | ||
{ | ||
printf("Tracing propolis PID %d... Hit Ctrl-C to end.\n", $target); | ||
} | ||
|
||
struct io_info { | ||
string op; | ||
uint64_t ts; | ||
uint64_t slba; | ||
uint16_t nlb; | ||
}; | ||
|
||
struct io_info io[uint64_t]; | ||
|
||
propolis$target:::nvme_read_enqueue, | ||
propolis$target:::nvme_write_enqueue | ||
{ | ||
this->cid = args[0]; | ||
this->op = (probename == "nvme_read_enqueue") ? "read" : "write"; | ||
io[this->cid].op = this->op; | ||
io[this->cid].ts = timestamp; | ||
io[this->cid].slba = args[1]; | ||
io[this->cid].nlb = args[2]; | ||
} | ||
|
||
propolis$target:::nvme_read_complete, | ||
propolis$target:::nvme_write_complete | ||
/io[args[0]].ts != 0/ | ||
{ | ||
this->cid = args[0]; | ||
this->elapsed = timestamp - io[this->cid].ts; | ||
this->elapsed_us = this->elapsed / 1000; | ||
@time[io[this->cid].op] = quantize(this->elapsed_us); | ||
printf("%s(cid=%u) %d blocks from LBA 0x%x in %uus\n", | ||
io[this->cid].op, this->cid, io[this->cid].nlb, io[this->cid].slba, this->elapsed_us); | ||
} | ||
|
||
dtrace:::END | ||
{ | ||
} |