scx/scripts/vtime_dist.bt
Daniel Hodges f59b73b97c
scripts: Add vtime distribution script
Add bpftrace script to print the distribution of vtime across DSQs.

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
2024-10-12 08:40:16 -04:00

31 lines
617 B
Plaintext
Executable File

#!/usr/bin/env bpftrace
// Copyright (c) Meta Platforms, Inc. and affiliates.
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2.
rawtracepoint:sched_wakeup,
rawtracepoint:sched_wakeup_new,
{
$task = (struct task_struct *)arg0;
if ($1 > 0 && $task->tgid != $1) {
return;
}
if ($task->scx.dsq->id >= 0) {
@dsq_vtime[$task->scx.dsq->id] = hist($task->scx.dsq_vtime);
}
}
interval:s:1 {
if ($1 >0) {
$scx_ops = kaddr("scx_ops");
$ops = (struct sched_ext_ops*)$scx_ops;
printf("scheduler: %s\n", $ops->name);
}
print(@dsq_vtime);
}