aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-02-18 10:11:02 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-02-18 10:11:02 -0500
commitc748e01c073f47d7696f6eba59cb18454648ae8a (patch)
tree7b879f12d689249b39e5daee5835fce1e9fbe400
parentdf49e6a44d60740e6730e2b5255b53c900adc9a7 (diff)
trace-graph: Move reading sched switch comms into trace-graph.c
Move the reading of missed comms from sched_switch events from trace-plot-cpu.c into trace-graph.c into the sched_switch check itself. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-graph.c17
-rw-r--r--trace-plot-cpu.c10
2 files changed, 15 insertions, 12 deletions
diff --git a/trace-graph.c b/trace-graph.c
index 3c3f98d..00493b2 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -793,6 +793,7 @@ int trace_graph_check_sched_switch(struct graph_info *ginfo,
793 unsigned long long val; 793 unsigned long long val;
794 struct event_format *event; 794 struct event_format *event;
795 gint id; 795 gint id;
796 int ret = 1;
796 797
797 if (ginfo->event_sched_switch_id < 0) { 798 if (ginfo->event_sched_switch_id < 0) {
798 event = pevent_find_event_by_name(ginfo->pevent, 799 event = pevent_find_event_by_name(ginfo->pevent,
@@ -820,7 +821,7 @@ int trace_graph_check_sched_switch(struct graph_info *ginfo,
820 *comm = record->data + ginfo->event_comm_field->offset; 821 *comm = record->data + ginfo->event_comm_field->offset;
821 if (pid) 822 if (pid)
822 *pid = val; 823 *pid = val;
823 return 1; 824 goto out;
824 } 825 }
825 826
826 if (id == ginfo->ftrace_sched_switch_id) { 827 if (id == ginfo->ftrace_sched_switch_id) {
@@ -829,7 +830,19 @@ int trace_graph_check_sched_switch(struct graph_info *ginfo,
829 *comm = record->data + ginfo->ftrace_comm_field->offset; 830 *comm = record->data + ginfo->ftrace_comm_field->offset;
830 if (pid) 831 if (pid)
831 *pid = val; 832 *pid = val;
832 return 1; 833 goto out;
834 }
835
836 ret = 0;
837 out:
838 if (ret && comm && ginfo->read_comms) {
839 /*
840 * First time through, register any missing
841 * comm / pid mappings.
842 */
843 if (!pevent_pid_is_registered(ginfo->pevent, *pid))
844 pevent_register_comm(ginfo->pevent,
845 strdup(*comm), *pid);
833 } 846 }
834 847
835 return 0; 848 return 0;
diff --git a/trace-plot-cpu.c b/trace-plot-cpu.c
index e99fec8..50d720b 100644
--- a/trace-plot-cpu.c
+++ b/trace-plot-cpu.c
@@ -98,16 +98,6 @@ static int filter_record(struct graph_info *ginfo,
98 /* Also show the task switching out */ 98 /* Also show the task switching out */
99 if (filter) 99 if (filter)
100 filter = trace_graph_filter_on_task(ginfo, *sched_pid); 100 filter = trace_graph_filter_on_task(ginfo, *sched_pid);
101
102 if (ginfo->read_comms) {
103 /*
104 * First time through, register any missing
105 * comm / pid mappings.
106 */
107 if (!pevent_pid_is_registered(ginfo->pevent, *sched_pid))
108 pevent_register_comm(ginfo->pevent,
109 strdup(comm), *sched_pid);
110 }
111 } else 101 } else
112 *sched_pid = *orig_pid; 102 *sched_pid = *orig_pid;
113 103