zfs/contrib/bpftrace/taskqlatency.bt

55 lines
1.2 KiB
Plaintext

#include <sys/taskq.h>
kprobe:trace_zfs_taskq_ent__birth
{
$tqent = (struct taskq_ent *)arg0;
$tqent_id = $tqent->tqent_id;
$tq_name = str($tqent->tqent_taskq->tq_name);
@birth[$tq_name, $tqent_id] = nsecs;
}
kprobe:trace_zfs_taskq_ent__start
{
$tqent = (struct taskq_ent *)arg0;
@tqent_id[tid] = $tqent->tqent_id;
@tq_name[tid] = str($tqent->tqent_taskq->tq_name);
@start[@tq_name[tid], @tqent_id[tid]] = nsecs;
}
kprobe:trace_zfs_taskq_ent__start
/ @birth[@tq_name[tid], @tqent_id[tid]] /
{
@queue_lat_us[@tq_name[tid]] =
hist((nsecs - @birth[@tq_name[tid], @tqent_id[tid]])/1000);
delete(@birth[@tq_name[tid], @tqent_id[tid]]);
}
kprobe:trace_zfs_taskq_ent__finish
/ @start[@tq_name[tid], @tqent_id[tid]] /
{
$tqent = (struct taskq_ent *)arg0;
@exec_lat_us[@tq_name[tid], ksym($tqent->tqent_func)] =
hist((nsecs - @start[@tq_name[tid], @tqent_id[tid]])/1000);
delete(@start[@tq_name[tid], @tqent_id[tid]]);
}
kprobe:trace_zfs_taskq_ent__finish
{
delete(@tq_name[tid]);
delete(@tqent_id[tid]);
}
END
{
clear(@birth);
clear(@start);
clear(@tq_name);
clear(@tqent_id);
}