diff options
-rw-r--r-- | include/trace/events/sched.h | 33 | ||||
-rw-r--r-- | kernel/sched_fair.c | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index b48f1ad7c946..4069c43f4187 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
@@ -380,6 +380,39 @@ TRACE_EVENT(sched_stat_wait, | |||
380 | ); | 380 | ); |
381 | 381 | ||
382 | /* | 382 | /* |
383 | * Tracepoint for accounting runtime (time the task is executing | ||
384 | * on a CPU). | ||
385 | */ | ||
386 | TRACE_EVENT(sched_stat_runtime, | ||
387 | |||
388 | TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), | ||
389 | |||
390 | TP_ARGS(tsk, runtime, vruntime), | ||
391 | |||
392 | TP_STRUCT__entry( | ||
393 | __array( char, comm, TASK_COMM_LEN ) | ||
394 | __field( pid_t, pid ) | ||
395 | __field( u64, runtime ) | ||
396 | __field( u64, vruntime ) | ||
397 | ), | ||
398 | |||
399 | TP_fast_assign( | ||
400 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); | ||
401 | __entry->pid = tsk->pid; | ||
402 | __entry->runtime = runtime; | ||
403 | __entry->vruntime = vruntime; | ||
404 | ) | ||
405 | TP_perf_assign( | ||
406 | __perf_count(runtime); | ||
407 | ), | ||
408 | |||
409 | TP_printk("task: %s:%d runtime: %Lu [ns], vruntime: %Lu [ns]", | ||
410 | __entry->comm, __entry->pid, | ||
411 | (unsigned long long)__entry->runtime, | ||
412 | (unsigned long long)__entry->vruntime) | ||
413 | ); | ||
414 | |||
415 | /* | ||
383 | * Tracepoint for accounting sleep time (time the task is not runnable, | 416 | * Tracepoint for accounting sleep time (time the task is not runnable, |
384 | * including iowait, see below). | 417 | * including iowait, see below). |
385 | */ | 418 | */ |
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index aa7f84121016..a097e909e80f 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -513,6 +513,7 @@ static void update_curr(struct cfs_rq *cfs_rq) | |||
513 | if (entity_is_task(curr)) { | 513 | if (entity_is_task(curr)) { |
514 | struct task_struct *curtask = task_of(curr); | 514 | struct task_struct *curtask = task_of(curr); |
515 | 515 | ||
516 | trace_sched_stat_runtime(curtask, delta_exec, curr->vruntime); | ||
516 | cpuacct_charge(curtask, delta_exec); | 517 | cpuacct_charge(curtask, delta_exec); |
517 | account_group_exec_runtime(curtask, delta_exec); | 518 | account_group_exec_runtime(curtask, delta_exec); |
518 | } | 519 | } |