systemtap script linux scsi timeout
1 #!/usr/bin/stap
2
3 probe begin{
4 print(“Starting probe, watching for SG_IO with threshold greater than “);
5 print($1 / 1000);
6 print(” seconds.\nType control-c to stop.\n”);
7 }
8
9 probe kernel.function(“sg_io”)
10 {
11 if ($hdr->timeout > $1) {
12 printf(“%s(%d) called sg_io with timeout = %d, greater than threshold\n”,
13 execname(), pid(), $hdr->timeout);
14 }
15 if ($q->sg_timeout > $1){
16 printf(“%s(%d) called sg_io with sg_timeout = %d, greater than threshold\n”,
17 execname(), pid(), $q->sg_timeout);
18 }
19 }
20
21 probe end {
22 print(“End probe\n”);
23 }
281static int sg_io(struct request_queue *q, struct gendisk *bd_disk, 282 struct sg_io_hdr *hdr, fmode_t mode) 283{ 284 unsigned long start_time;