Tag 2.2.0-rc4
[zfs.git] / contrib / bpftrace / taskqlatency.bt
blob598f9882b30d249b43afdb92287e5dd815ddccc0
1 #include <sys/taskq.h>
3 kprobe:trace_zfs_taskq_ent__birth
5         $tqent = (struct taskq_ent *)arg0;
7         $tqent_id = $tqent->tqent_id;
8         $tq_name = str($tqent->tqent_taskq->tq_name);
10         @birth[$tq_name, $tqent_id] = nsecs;
13 kprobe:trace_zfs_taskq_ent__start
15         $tqent = (struct taskq_ent *)arg0;
17         @tqent_id[tid] = $tqent->tqent_id;
18         @tq_name[tid] = str($tqent->tqent_taskq->tq_name);
20         @start[@tq_name[tid], @tqent_id[tid]] = nsecs;
23 kprobe:trace_zfs_taskq_ent__start
24 / @birth[@tq_name[tid], @tqent_id[tid]] /
26         @queue_lat_us[@tq_name[tid]] =
27                 hist((nsecs - @birth[@tq_name[tid], @tqent_id[tid]])/1000);
28         delete(@birth[@tq_name[tid], @tqent_id[tid]]);
31 kprobe:trace_zfs_taskq_ent__finish
32 / @start[@tq_name[tid], @tqent_id[tid]] /
34         $tqent = (struct taskq_ent *)arg0;
36         @exec_lat_us[@tq_name[tid], ksym($tqent->tqent_func)] =
37                 hist((nsecs - @start[@tq_name[tid], @tqent_id[tid]])/1000);
38         delete(@start[@tq_name[tid], @tqent_id[tid]]);
41 kprobe:trace_zfs_taskq_ent__finish
43         delete(@tq_name[tid]);
44         delete(@tqent_id[tid]);
47 END
49         clear(@birth);
50         clear(@start);
52         clear(@tq_name);
53         clear(@tqent_id);