summaryrefslogtreecommitdiff
path: root/systemtap/ioblock_delay/device.stp
blob: b9270e534027cae87024194fdc45fa52716ece7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// size of array equals to max. number of pending requests
global calls[30000];

probe begin {
    printf("device,sector,time_ns\n");
}

probe ioblock.request
{
    if (devname == @1) {
        calls[$bio] = gettimeofday_ns();
    }
}

probe ioblock.end
{
   if ([$bio] in calls) {
     time = gettimeofday_ns() - calls[$bio];
     delete calls[$bio];

     printf("%s,%u,%ld\n",
            devname, sector, time);
   }
}

probe end {
  foreach ([bio] in calls) {
    printf("# Lost: %s,%u,%u\n", 
           __bio_devname(bio), @cast(bio, "bio")->bi_sector, calls[bio]);
  }
}