summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-sched.c
diff options
context:
space:
mode:
authorFernand Sieber <sieberf@amazon.com>2024-06-18 11:03:39 +0200
committerNamhyung Kim <namhyung@kernel.org>2024-06-25 11:06:20 -0700
commitd363c2a880c611eea3d754a618b6125bac7f3044 (patch)
tree5127fc023f138a403c3de5a7876a32ece2db2085 /tools/perf/builtin-sched.c
parentfcd094e52b71f490d4bedbda86851be8b2766754 (diff)
downloadlinux-d363c2a880c611eea3d754a618b6125bac7f3044.tar.gz
linux-d363c2a880c611eea3d754a618b6125bac7f3044.tar.bz2
linux-d363c2a880c611eea3d754a618b6125bac7f3044.zip
perf: Timehist account sch delay for scheduled out running
When using perf timehist, sch delay is only computed for a waking task, not for a pre empted task. This patches changes sch delay to account for both. This makes sense as testing scheduling policy need to consider the effect of scheduling delay globally, not only for waking tasks. Example of `perf timehist` report before the patch for `stress` task competing with each other. First column is wait time, second column sch delay, third column runtime. 1.492060 [0000] s stress[81] 1.999 0.000 2.000 R next: stress[83] 1.494060 [0000] s stress[83] 2.000 0.000 2.000 R next: stress[81] 1.496060 [0000] s stress[81] 2.000 0.000 2.000 R next: stress[83] 1.498060 [0000] s stress[83] 2.000 0.000 1.999 R next: stress[81] After the patch, it looks like this (note that all wait time is not zero anymore): 1.492060 [0000] s stress[81] 1.999 1.999 2.000 R next: stress[83] 1.494060 [0000] s stress[83] 2.000 2.000 2.000 R next: stress[81] 1.496060 [0000] s stress[81] 2.000 2.000 2.000 R next: stress[83] 1.498060 [0000] s stress[83] 2.000 2.000 1.999 R next: stress[81] Signed-off-by: Fernand Sieber <sieberf@amazon.com> Reviewed-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20240618090339.87482-1-sieberf@amazon.com
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r--tools/perf/builtin-sched.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 8cdf18139a7e..aa59f763ca46 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -2659,7 +2659,10 @@ out:
tr->last_state = state;
/* sched out event for task so reset ready to run time */
- tr->ready_to_run = 0;
+ if (state == 'R')
+ tr->ready_to_run = t;
+ else
+ tr->ready_to_run = 0;
}
evsel__save_time(evsel, sample->time, sample->cpu);