diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-01-04 21:47:04 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-01-04 21:47:04 -0500 |
commit | d69087e1e5474124dd7182a989cbc12a5d9c02a7 (patch) | |
tree | ad53615bea16f84ceb001b3a4edf82c04f8cb422 | |
parent | 445e2e6cfde4f01fd84e5ae9cc4a590418886bb7 (diff) |
trace-view: Include sched switch in task filtering
Include when a task is scheduled in as an event in the filtered
list.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-view-store.c | 32 | ||||
-rw-r--r-- | trace-view-store.h | 2 |
2 files changed, 33 insertions, 1 deletions
diff --git a/trace-view-store.c b/trace-view-store.c index 31c702b..253c61a 100644 --- a/trace-view-store.c +++ b/trace-view-store.c | |||
@@ -1081,6 +1081,16 @@ guint64 trace_view_store_get_offset_from_row(TraceViewStore *store, gint row) | |||
1081 | return store->rows[row]->offset; | 1081 | return store->rows[row]->offset; |
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | gint get_next_pid(TraceViewStore *store, struct pevent *pevent, struct record *record) | ||
1085 | { | ||
1086 | unsigned long long val; | ||
1087 | int ret; | ||
1088 | |||
1089 | ret = pevent_read_number_field(store->sched_switch_next_field, record, &val); | ||
1090 | |||
1091 | return val; | ||
1092 | } | ||
1093 | |||
1084 | void trace_view_store_filter_tasks(TraceViewStore *store, struct filter_task *filter) | 1094 | void trace_view_store_filter_tasks(TraceViewStore *store, struct filter_task *filter) |
1085 | { | 1095 | { |
1086 | struct tracecmd_input *handle; | 1096 | struct tracecmd_input *handle; |
@@ -1095,6 +1105,15 @@ void trace_view_store_filter_tasks(TraceViewStore *store, struct filter_task *fi | |||
1095 | handle = store->handle; | 1105 | handle = store->handle; |
1096 | pevent = tracecmd_get_pevent(store->handle); | 1106 | pevent = tracecmd_get_pevent(store->handle); |
1097 | 1107 | ||
1108 | if (!store->sched_switch_event) { | ||
1109 | store->sched_switch_event = | ||
1110 | pevent_find_event_by_name(pevent, "sched", "sched_switch"); | ||
1111 | if (store->sched_switch_event) | ||
1112 | store->sched_switch_next_field = | ||
1113 | pevent_find_any_field(store->sched_switch_event, | ||
1114 | "next_pid"); | ||
1115 | } | ||
1116 | |||
1098 | for (cpu = 0; cpu < store->cpus; cpu++) { | 1117 | for (cpu = 0; cpu < store->cpus; cpu++) { |
1099 | record = tracecmd_read_cpu_first(handle, cpu); | 1118 | record = tracecmd_read_cpu_first(handle, cpu); |
1100 | 1119 | ||
@@ -1106,8 +1125,19 @@ void trace_view_store_filter_tasks(TraceViewStore *store, struct filter_task *fi | |||
1106 | pid = pevent_data_pid(pevent, record); | 1125 | pid = pevent_data_pid(pevent, record); |
1107 | if (!filter || filter_task_find_pid(filter, pid)) | 1126 | if (!filter || filter_task_find_pid(filter, pid)) |
1108 | store->cpu_list[cpu][i].visible = 1; | 1127 | store->cpu_list[cpu][i].visible = 1; |
1109 | else | 1128 | else { |
1129 | if (store->sched_switch_next_field && | ||
1130 | pevent_data_type(pevent, record) == | ||
1131 | store->sched_switch_event->id) { | ||
1132 | /* show sched switch to task */ | ||
1133 | pid = get_next_pid(store, pevent, record); | ||
1134 | if (filter_task_find_pid(filter, pid)) | ||
1135 | store->cpu_list[cpu][i].visible = 1; | ||
1136 | else | ||
1137 | store->cpu_list[cpu][i].visible = 0; | ||
1138 | } | ||
1110 | store->cpu_list[cpu][i].visible = 0; | 1139 | store->cpu_list[cpu][i].visible = 0; |
1140 | } | ||
1111 | 1141 | ||
1112 | free_record(record); | 1142 | free_record(record); |
1113 | record = tracecmd_read_data(handle, cpu); | 1143 | record = tracecmd_read_data(handle, cpu); |
diff --git a/trace-view-store.h b/trace-view-store.h index c7738da..974223b 100644 --- a/trace-view-store.h +++ b/trace-view-store.h | |||
@@ -78,6 +78,8 @@ struct _TraceViewStore | |||
78 | 78 | ||
79 | /* Tracecmd specific info */ | 79 | /* Tracecmd specific info */ |
80 | struct tracecmd_input *handle; | 80 | struct tracecmd_input *handle; |
81 | struct event_format *sched_switch_event; | ||
82 | struct format_field *sched_switch_next_field; | ||
81 | int cpus; | 83 | int cpus; |
82 | 84 | ||
83 | TraceViewRecord **cpu_list; | 85 | TraceViewRecord **cpu_list; |