# \[PATCH v4 7/8\] sched, dl: support sched\_stat\_runtime tracepoint for deadline sched class

- From: Yafang Shao \<hidden\>
- Date: 2021-09-05 14:36:46 
- List: linux-rt-users
- Page: https://ratatoskr.run/linux-rt-users/2021/09/1497633
- Thread: https://ratatoskr.run/linux-rt-users/2021/09/1497626/t.md

```text
The runtime of a DL task has already been there, so we only need to
add a tracepoint.

One difference between fair task and DL task is that there is no vruntime
in dl task. To reuse the sched_stat_runtime tracepoint, '0' is passed as
vruntime for DL task.

The output of this tracepoint for DL task as follows,
             top-36462   [047] d.h.  6083.452103: sched_stat_runtime: comm=top pid=36462 runtime=409898 [ns] vruntime=0 [ns]

Signed-off-by: Yafang Shao <redacted>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Alison Chaiken <redacted>
---
 kernel/sched/deadline.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 51dd30990042..73fb33e1868f 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1268,6 +1268,8 @@ static void update_curr_dl(struct rq *rq)
 	schedstat_set(curr->stats.exec_max,
 		      max(curr->stats.exec_max, delta_exec));
 
+	trace_sched_stat_runtime(curr, delta_exec, 0);
+
 	curr->se.sum_exec_runtime += delta_exec;
 	account_group_exec_runtime(curr, delta_exec);
 
-- 
2.18.2

```
