Skip to content

Instantly share code, notes, and snippets.

@isilence
Created May 17, 2023 15:16
Show Gist options
  • Save isilence/bc25109615e9d4e4949aa9d29ebbecb3 to your computer and use it in GitHub Desktop.
Save isilence/bc25109615e9d4e4949aa9d29ebbecb3 to your computer and use it in GitHub Desktop.
#!/usr/bin/bpftrace
BEGIN {
@rw_compl_addr = kaddr("io_req_rw_complete");
@compl_addr = kaddr("io_req_task_complete");
}
kprobe:io_req_task_complete {
$req = (struct io_kiocb *)arg0;
// if ($req->cqe.user_data != 0 ||
// $req->cqe.res != 0) {
// return;
// }
@tc_stack[kstack] = count();
@tc_opcodes = lhist($req->opcode, 0, 30, 1);
}
kprobe:__io_req_task_work_add {
$req = (struct io_kiocb *)arg0;
if ((uint64)$req->io_task_work.func != @compl_addr) {
return;
}
// if ($req->cqe.user_data != 0 ||
// $req->cqe.res != 0) {
// return;
// }
@tw_add_stack[kstack] = count();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment