Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163752
b: refs/heads/master
c: c6ced61
h: refs/heads/master
v: v3
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Sep 13, 2009
1 parent 1627e39 commit 58d8acc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 175622053069afbd366ba3c6030b5af82f378d40
refs/heads/master: c6ced61112f1e6139914149fab65695801a74f0f
19 changes: 13 additions & 6 deletions trunk/tools/perf/builtin-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,8 @@ static struct trace_sched_handler replay_ops = {
#define TASK_STATE_TO_CHAR_STR "RSDTtZX"

enum thread_state {
THREAD_SLEEPING,
THREAD_WAKED_UP,
THREAD_SLEEPING = 0,
THREAD_WAIT_CPU,
THREAD_SCHED_IN,
THREAD_IGNORE
};
Expand Down Expand Up @@ -962,14 +962,21 @@ static char sched_out_state(struct trace_switch_event *switch_event)

static void
lat_sched_out(struct task_atoms *atoms,
struct trace_switch_event *switch_event __used, u64 delta)
struct trace_switch_event *switch_event __used,
u64 delta,
u64 timestamp)
{
struct work_atom *snapshot;

snapshot = calloc(sizeof(*snapshot), 1);
if (!snapshot)
die("Non memory");

if (sched_out_state(switch_event) == 'R') {
snapshot->state = THREAD_WAIT_CPU;
snapshot->wake_up_time = timestamp;
}

snapshot->runtime = delta;
list_add_tail(&snapshot->list, &atoms->snapshot_list);
}
Expand All @@ -985,7 +992,7 @@ lat_sched_in(struct task_atoms *atoms, u64 timestamp)
snapshot = list_entry(atoms->snapshot_list.prev, struct work_atom,
list);

if (snapshot->state != THREAD_WAKED_UP)
if (snapshot->state != THREAD_WAIT_CPU)
return;

if (timestamp < snapshot->wake_up_time) {
Expand Down Expand Up @@ -1043,7 +1050,7 @@ latency_switch_event(struct trace_switch_event *switch_event,
}

lat_sched_in(in_atoms, timestamp);
lat_sched_out(out_atoms, switch_event, delta);
lat_sched_out(out_atoms, switch_event, delta, timestamp);
}

static void
Expand Down Expand Up @@ -1077,7 +1084,7 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
if (snapshot->state != THREAD_SLEEPING)
return;

snapshot->state = THREAD_WAKED_UP;
snapshot->state = THREAD_WAIT_CPU;
snapshot->wake_up_time = timestamp;
}

Expand Down

0 comments on commit 58d8acc

Please sign in to comment.