diff options
-rw-r--r-- | trace-view-store.c | 89 | ||||
-rw-r--r-- | trace-view-store.h | 4 |
2 files changed, 78 insertions, 15 deletions
diff --git a/trace-view-store.c b/trace-view-store.c index 14d8b17..ff964cf 100644 --- a/trace-view-store.c +++ b/trace-view-store.c | |||
@@ -1249,7 +1249,27 @@ gint get_next_pid(TraceViewStore *store, struct pevent *pevent, struct record *r | |||
1249 | return val; | 1249 | return val; |
1250 | } | 1250 | } |
1251 | 1251 | ||
1252 | static gboolean show_task(TraceViewStore *store, gint pid) | 1252 | gint get_wakeup_pid(TraceViewStore *store, struct pevent *pevent, struct record *record) |
1253 | { | ||
1254 | unsigned long long val; | ||
1255 | int ret; | ||
1256 | |||
1257 | ret = pevent_read_number_field(store->sched_wakeup_pid_field, record->data, &val); | ||
1258 | |||
1259 | return val; | ||
1260 | } | ||
1261 | |||
1262 | gint get_wakeup_new_pid(TraceViewStore *store, struct pevent *pevent, struct record *record) | ||
1263 | { | ||
1264 | unsigned long long val; | ||
1265 | int ret; | ||
1266 | |||
1267 | ret = pevent_read_number_field(store->sched_wakeup_new_pid_field, record->data, &val); | ||
1268 | |||
1269 | return val; | ||
1270 | } | ||
1271 | |||
1272 | static gboolean view_task(TraceViewStore *store, gint pid) | ||
1253 | { | 1273 | { |
1254 | return (!store->task_filter || | 1274 | return (!store->task_filter || |
1255 | !filter_task_count(store->task_filter) || | 1275 | !filter_task_count(store->task_filter) || |
@@ -1259,6 +1279,43 @@ static gboolean show_task(TraceViewStore *store, gint pid) | |||
1259 | !filter_task_find_pid(store->hide_tasks, pid)); | 1279 | !filter_task_find_pid(store->hide_tasks, pid)); |
1260 | } | 1280 | } |
1261 | 1281 | ||
1282 | static gboolean show_task(TraceViewStore *store, struct pevent *pevent, | ||
1283 | struct record *record, gint pid) | ||
1284 | { | ||
1285 | gint event_id; | ||
1286 | |||
1287 | if (view_task(store, pid)) | ||
1288 | return TRUE; | ||
1289 | |||
1290 | event_id = pevent_data_type(pevent, record); | ||
1291 | |||
1292 | if (store->sched_switch_next_field && | ||
1293 | event_id == store->sched_switch_event->id) { | ||
1294 | /* show sched switch to task */ | ||
1295 | pid = get_next_pid(store, pevent, record); | ||
1296 | if (view_task(store, pid)) | ||
1297 | return TRUE; | ||
1298 | } | ||
1299 | |||
1300 | if (store->sched_wakeup_pid_field && | ||
1301 | event_id == store->sched_wakeup_event->id) { | ||
1302 | /* show sched switch to task */ | ||
1303 | pid = get_wakeup_pid(store, pevent, record); | ||
1304 | if (view_task(store, pid)) | ||
1305 | return TRUE; | ||
1306 | } | ||
1307 | |||
1308 | if (store->sched_wakeup_new_pid_field && | ||
1309 | event_id == store->sched_wakeup_new_event->id) { | ||
1310 | /* show sched switch to task */ | ||
1311 | pid = get_wakeup_new_pid(store, pevent, record); | ||
1312 | if (view_task(store, pid)) | ||
1313 | return TRUE; | ||
1314 | } | ||
1315 | |||
1316 | return FALSE; | ||
1317 | } | ||
1318 | |||
1262 | static void update_filter_tasks(TraceViewStore *store) | 1319 | static void update_filter_tasks(TraceViewStore *store) |
1263 | { | 1320 | { |
1264 | struct tracecmd_input *handle; | 1321 | struct tracecmd_input *handle; |
@@ -1281,6 +1338,19 @@ static void update_filter_tasks(TraceViewStore *store) | |||
1281 | store->sched_switch_next_field = | 1338 | store->sched_switch_next_field = |
1282 | pevent_find_any_field(store->sched_switch_event, | 1339 | pevent_find_any_field(store->sched_switch_event, |
1283 | "next_pid"); | 1340 | "next_pid"); |
1341 | store->sched_wakeup_event = | ||
1342 | pevent_find_event_by_name(pevent, "sched", "sched_wakeup"); | ||
1343 | if (store->sched_wakeup_event) | ||
1344 | store->sched_wakeup_pid_field = | ||
1345 | pevent_find_any_field(store->sched_wakeup_event, | ||
1346 | "pid"); | ||
1347 | |||
1348 | store->sched_wakeup_new_event = | ||
1349 | pevent_find_event_by_name(pevent, "sched", "sched_wakeup"); | ||
1350 | if (store->sched_wakeup_new_event) | ||
1351 | store->sched_wakeup_new_pid_field = | ||
1352 | pevent_find_any_field(store->sched_wakeup_new_event, | ||
1353 | "pid"); | ||
1284 | } | 1354 | } |
1285 | 1355 | ||
1286 | for (cpu = 0; cpu < store->cpus; cpu++) { | 1356 | for (cpu = 0; cpu < store->cpus; cpu++) { |
@@ -1307,21 +1377,10 @@ static void update_filter_tasks(TraceViewStore *store) | |||
1307 | } | 1377 | } |
1308 | 1378 | ||
1309 | pid = pevent_data_pid(pevent, record); | 1379 | pid = pevent_data_pid(pevent, record); |
1310 | if (show_task(store, pid)) | 1380 | if (show_task(store, pevent, record, pid)) |
1311 | store->cpu_list[cpu][i].visible = 1; | 1381 | store->cpu_list[cpu][i].visible = 1; |
1312 | else { | 1382 | else |
1313 | if (store->sched_switch_next_field && | 1383 | store->cpu_list[cpu][i].visible = 0; |
1314 | pevent_data_type(pevent, record) == | ||
1315 | store->sched_switch_event->id) { | ||
1316 | /* show sched switch to task */ | ||
1317 | pid = get_next_pid(store, pevent, record); | ||
1318 | if (show_task(store, pid)) | ||
1319 | store->cpu_list[cpu][i].visible = 1; | ||
1320 | else | ||
1321 | store->cpu_list[cpu][i].visible = 0; | ||
1322 | } else | ||
1323 | store->cpu_list[cpu][i].visible = 0; | ||
1324 | } | ||
1325 | 1384 | ||
1326 | skip: | 1385 | skip: |
1327 | free_record(record); | 1386 | free_record(record); |
diff --git a/trace-view-store.h b/trace-view-store.h index bceb2de..5a9a7a7 100644 --- a/trace-view-store.h +++ b/trace-view-store.h | |||
@@ -80,6 +80,10 @@ struct trace_view_store | |||
80 | struct tracecmd_input *handle; | 80 | struct tracecmd_input *handle; |
81 | struct event_format *sched_switch_event; | 81 | struct event_format *sched_switch_event; |
82 | struct format_field *sched_switch_next_field; | 82 | struct format_field *sched_switch_next_field; |
83 | struct event_format *sched_wakeup_event; | ||
84 | struct format_field *sched_wakeup_pid_field; | ||
85 | struct event_format *sched_wakeup_new_event; | ||
86 | struct format_field *sched_wakeup_new_pid_field; | ||
83 | int cpus; | 87 | int cpus; |
84 | 88 | ||
85 | TraceViewRecord **cpu_list; | 89 | TraceViewRecord **cpu_list; |