-
Notifications
You must be signed in to change notification settings - Fork 7
/
sched-category-full.bt
executable file
·49 lines (40 loc) · 1.1 KB
/
sched-category-full.bt
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* SPDX-License-Identifer: GPL-2.0-only
* Copyright (C) 2022 Advanced Micro Devices, Inc.
*
* Authors: Wyes Karny <[email protected]>,
* Gautham R Shenoy <[email protected]>,
* K Prateek Nayak <[email protected]>
*
* Usage: sudo bpftrace sched-category-full.bt -o [outputfile]
*
*/
tracepoint:sched:sched_waking
{
/* We now need to compute the incoming tasks on-rq waittime or post-wake waittime. But only for the interesting tasks */
if (args->pid == 0) {
return;
}
/* There are multiple concurrent waking events. Only consider the very first one */
if (@waking_track[args->pid] == 1) {
return;
}
@waking_graph[comm, tid, args->comm, args->pid] = count();
@waking_track[args->pid] = 1;
}
tracepoint:sched:sched_migrate_task
{
$dest_cpu = (uint32)args->dest_cpu;
$orig_cpu = (uint32)args->orig_cpu;
$is_waking = @waking_track[args->pid];
@waking_track[args->pid] = 0;
if ($dest_cpu == $orig_cpu) {
return;
}
@migrations[args->pid, $orig_cpu, $dest_cpu, $is_waking] = count();
}
END
{
/* We don't care about these dictionaries */
clear(@waking_track);
}