aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-01-08 12:47:57 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-01-08 12:47:57 -0500
commit69624fcc599f5f92960d0f2132df26542b92878e (patch)
tree9342ba8f9c0aa19286650a84a33c3fd5e04b998f
parentc2b163e35a469c0c48aeb445ffc52bafacb6ea12 (diff)
trace-graph: Fix fly over window to show actual tasks
The event info box was getting confused by sched_switches, and showing the wrong task at the given time line. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-graph.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/trace-graph.c b/trace-graph.c
index 458f5bf..8204fc9 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -65,6 +65,9 @@ static gint event_wakeup_new_id = -1;
65static gint largest_cpu_label = 0; 65static gint largest_cpu_label = 0;
66 66
67static void redraw_pixmap_backend(struct graph_info *ginfo); 67static void redraw_pixmap_backend(struct graph_info *ginfo);
68static int check_sched_switch(struct graph_info *ginfo,
69 struct record *record,
70 gint *pid, const char **comm);
68 71
69static void convert_nano(unsigned long long time, unsigned long *sec, 72static void convert_nano(unsigned long long time, unsigned long *sec,
70 unsigned long *usec) 73 unsigned long *usec)
@@ -499,8 +502,11 @@ do_pop_up(GtkWidget *widget, GdkEventButton *event, gpointer data)
499 } 502 }
500 503
501 if (record) { 504 if (record) {
502 pid = pevent_data_pid(ginfo->pevent, record); 505
503 comm = pevent_data_comm_from_pid(ginfo->pevent, pid); 506 if (!check_sched_switch(ginfo, record, &pid, &comm)) {
507 pid = pevent_data_pid(ginfo->pevent, record);
508 comm = pevent_data_comm_from_pid(ginfo->pevent, pid);
509 }
504 510
505 len = strlen(comm) + 50; 511 len = strlen(comm) + 50;
506 512
@@ -863,11 +869,6 @@ static void draw_cpu_info(struct graph_info *ginfo, gint cpu, gint x, gint y)
863 869
864 if (record) { 870 if (record) {
865 871
866 if (!check_sched_switch(ginfo, record, &pid, &comm)) {
867 pid = pevent_data_pid(ginfo->pevent, record);
868 comm = pevent_data_comm_from_pid(ginfo->pevent, pid);
869 }
870
871 dprintf(3, "record->ts=%llu time=%zu-%zu\n", 872 dprintf(3, "record->ts=%llu time=%zu-%zu\n",
872 record->ts, time, time-(gint)(1/ginfo->resolution)); 873 record->ts, time, time-(gint)(1/ginfo->resolution));
873 print_rec_info(record, pevent, cpu); 874 print_rec_info(record, pevent, cpu);
@@ -881,8 +882,12 @@ static void draw_cpu_info(struct graph_info *ginfo, gint cpu, gint x, gint y)
881 free_record(record); 882 free_record(record);
882 record = tracecmd_read_at(ginfo->handle, offset, NULL); 883 record = tracecmd_read_at(ginfo->handle, offset, NULL);
883 884
885 pid = pevent_data_pid(ginfo->pevent, record);
886 comm = pevent_data_comm_from_pid(ginfo->pevent, pid);
887
884 if (record->ts > time - 2/ginfo->resolution && 888 if (record->ts > time - 2/ginfo->resolution &&
885 record->ts < time + 2/ginfo->resolution) { 889 record->ts < time + 2/ginfo->resolution) {
890
886 convert_nano(record->ts, &sec, &usec); 891 convert_nano(record->ts, &sec, &usec);
887 892
888 type = pevent_data_type(pevent, record); 893 type = pevent_data_type(pevent, record);
@@ -896,7 +901,8 @@ static void draw_cpu_info(struct graph_info *ginfo, gint cpu, gint x, gint y)
896 trace_seq_putc(&s, '\n'); 901 trace_seq_putc(&s, '\n');
897 } else 902 } else
898 trace_seq_printf(&s, "UNKNOW EVENT %d\n", type); 903 trace_seq_printf(&s, "UNKNOW EVENT %d\n", type);
899 } 904 } else
905 check_sched_switch(ginfo, record, &pid, &comm);
900 906
901 trace_seq_printf(&s, "%lu.%06lu", sec, usec); 907 trace_seq_printf(&s, "%lu.%06lu", sec, usec);
902 if (pid) 908 if (pid)