summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/builtin-sched.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 686af633b35b..3e003237c42f 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -129,6 +129,7 @@ enum thread_state {
struct work_atom {
struct list_head list;
enum thread_state state;
+ u64 sched_out_time;
u64 wake_up_time;
u64 sched_in_time;
u64 runtime;
@@ -988,9 +989,11 @@ lat_sched_out(struct task_atoms *atoms,
if (!atom)
die("Non memory");
+ atom->sched_out_time = timestamp;
+
if (sched_out_state(switch_event) == 'R') {
atom->state = THREAD_WAIT_CPU;
- atom->wake_up_time = timestamp;
+ atom->wake_up_time = atom->sched_out_time;
}
atom->runtime = delta;
@@ -1106,6 +1109,9 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
if (atom->state != THREAD_SLEEPING)
return;
+ if (atom->sched_out_time > timestamp)
+ return;
+
atom->state = THREAD_WAIT_CPU;
atom->wake_up_time = timestamp;
}