diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2010-02-19 13:07:50 -0500 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2010-02-19 13:07:50 -0500 |
| commit | 6cbbc27cb3bc55731928713d06b7ae03574444d5 (patch) | |
| tree | 04bda9c1cbc4fea13c16043119cfe2053c1bebac | |
| parent | 463a6c4d9d1ee041ac4c3696f11a977fa58a4c10 (diff) | |
trace-graph: Show running sched out latencies
Add a empty red box when scheduled out, and make wakeup latencies
green.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
| -rw-r--r-- | trace-graph.c | 1 | ||||
| -rw-r--r-- | trace-graph.h | 1 | ||||
| -rw-r--r-- | trace-plot-task.c | 35 |
3 files changed, 31 insertions, 6 deletions
diff --git a/trace-graph.c b/trace-graph.c index cdf84e8..7f982bd 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
| @@ -893,6 +893,7 @@ int trace_graph_check_sched_switch(struct graph_info *ginfo, | |||
| 893 | return 0; | 893 | return 0; |
| 894 | 894 | ||
| 895 | ginfo->event_sched_switch_id = event->id; | 895 | ginfo->event_sched_switch_id = event->id; |
| 896 | ginfo->event_prev_state = pevent_find_field(event, "prev_state"); | ||
| 896 | ginfo->event_pid_field = pevent_find_field(event, "next_pid"); | 897 | ginfo->event_pid_field = pevent_find_field(event, "next_pid"); |
| 897 | ginfo->event_comm_field = pevent_find_field(event, "next_comm"); | 898 | ginfo->event_comm_field = pevent_find_field(event, "next_comm"); |
| 898 | 899 | ||
diff --git a/trace-graph.h b/trace-graph.h index cb8286c..c501353 100644 --- a/trace-graph.h +++ b/trace-graph.h | |||
| @@ -206,6 +206,7 @@ struct graph_info { | |||
| 206 | gint event_sched_switch_id; | 206 | gint event_sched_switch_id; |
| 207 | gint event_wakeup_id; | 207 | gint event_wakeup_id; |
| 208 | gint event_wakeup_new_id; | 208 | gint event_wakeup_new_id; |
| 209 | struct format_field *event_prev_state; | ||
| 209 | struct format_field *event_pid_field; | 210 | struct format_field *event_pid_field; |
| 210 | struct format_field *event_comm_field; | 211 | struct format_field *event_comm_field; |
| 211 | struct format_field *ftrace_pid_field; | 212 | struct format_field *ftrace_pid_field; |
diff --git a/trace-plot-task.c b/trace-plot-task.c index 2aa03d4..0c9f8e0 100644 --- a/trace-plot-task.c +++ b/trace-plot-task.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include "trace-filter.h" | 24 | #include "trace-filter.h" |
| 25 | 25 | ||
| 26 | #define RED 0xff | 26 | #define RED 0xff |
| 27 | #define GREEN (0xff<<16) | ||
| 27 | 28 | ||
| 28 | struct task_plot_info { | 29 | struct task_plot_info { |
| 29 | int pid; | 30 | int pid; |
| @@ -31,6 +32,7 @@ struct task_plot_info { | |||
| 31 | unsigned long long last_time; | 32 | unsigned long long last_time; |
| 32 | unsigned long long wake_time; | 33 | unsigned long long wake_time; |
| 33 | unsigned long long display_wake_time; | 34 | unsigned long long display_wake_time; |
| 35 | int wake_color; | ||
| 34 | int last_cpu; | 36 | int last_cpu; |
| 35 | }; | 37 | }; |
| 36 | 38 | ||
| @@ -55,6 +57,19 @@ static int hash_cpu(int cpu) | |||
| 55 | return trace_hash(cpu + 124); | 57 | return trace_hash(cpu + 124); |
| 56 | } | 58 | } |
| 57 | 59 | ||
| 60 | static gboolean is_running(struct graph_info *ginfo, struct record *record) | ||
| 61 | { | ||
| 62 | unsigned long long val; | ||
| 63 | int id; | ||
| 64 | |||
| 65 | id = pevent_data_type(ginfo->pevent, record); | ||
| 66 | if (id != ginfo->event_sched_switch_id) | ||
| 67 | return FALSE; | ||
| 68 | |||
| 69 | pevent_read_number_field(ginfo->event_prev_state, record->data, &val); | ||
| 70 | return val ? FALSE : TRUE; | ||
| 71 | } | ||
| 72 | |||
| 58 | static gboolean record_matches_pid(struct graph_info *ginfo, | 73 | static gboolean record_matches_pid(struct graph_info *ginfo, |
| 59 | struct record *record, int match_pid, | 74 | struct record *record, int match_pid, |
| 60 | int *pid, int *sched_pid, | 75 | int *pid, int *sched_pid, |
| @@ -357,6 +372,7 @@ static int task_plot_event(struct graph_info *ginfo, | |||
| 357 | } | 372 | } |
| 358 | 373 | ||
| 359 | task_info->wake_time = record->ts; | 374 | task_info->wake_time = record->ts; |
| 375 | task_info->wake_color = GREEN; | ||
| 360 | task_info->display_wake_time = record->ts; | 376 | task_info->display_wake_time = record->ts; |
| 361 | 377 | ||
| 362 | return 1; | 378 | return 1; |
| @@ -384,8 +400,10 @@ static int task_plot_event(struct graph_info *ginfo, | |||
| 384 | info->bfill = FALSE; | 400 | info->bfill = FALSE; |
| 385 | info->bstart = task_info->wake_time; | 401 | info->bstart = task_info->wake_time; |
| 386 | info->bend = record->ts; | 402 | info->bend = record->ts; |
| 387 | info->bcolor = RED; | 403 | info->bcolor = task_info->wake_color; |
| 388 | } | 404 | } else |
| 405 | task_info->wake_time = 0; | ||
| 406 | |||
| 389 | } else if (!info->box) { | 407 | } else if (!info->box) { |
| 390 | /* just got scheduled out */ | 408 | /* just got scheduled out */ |
| 391 | info->box = TRUE; | 409 | info->box = TRUE; |
| @@ -393,10 +411,15 @@ static int task_plot_event(struct graph_info *ginfo, | |||
| 393 | info->bstart = task_info->last_time; | 411 | info->bstart = task_info->last_time; |
| 394 | info->bend = record->ts; | 412 | info->bend = record->ts; |
| 395 | task_info->last_cpu = -1; | 413 | task_info->last_cpu = -1; |
| 396 | } | 414 | if (is_running(ginfo, record)) { |
| 397 | } | 415 | task_info->wake_time = record->ts; |
| 398 | 416 | task_info->wake_color = RED; | |
| 399 | task_info->wake_time = 0; | 417 | } else |
| 418 | task_info->wake_time = 0; | ||
| 419 | } else | ||
| 420 | task_info->wake_time = 0; | ||
| 421 | } else | ||
| 422 | task_info->wake_time = 0; | ||
| 400 | 423 | ||
| 401 | return 1; | 424 | return 1; |
| 402 | } | 425 | } |
