aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2012-03-28 22:38:20 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2012-03-28 22:38:20 -0400
commit51fa96a4580b90d88e226511f5038d3b49a7e33f (patch)
treedc707f023d05358a8d1f0594c451a713672e8d7b
parent384a901c64991dc0b87838ef6f31cf539e5eeb3d (diff)
rt-graph: popup behavior improved
-rw-r--r--rt-graph.c2
-rw-r--r--rt-plot-vcpu.c2
-rw-r--r--rt-plot.c48
3 files changed, 48 insertions, 4 deletions
diff --git a/rt-graph.c b/rt-graph.c
index 239018e..fbf61bd 100644
--- a/rt-graph.c
+++ b/rt-graph.c
@@ -3,7 +3,7 @@
3#include "trace-graph.h" 3#include "trace-graph.h"
4#include "trace-hash.h" 4#include "trace-hash.h"
5 5
6#define DEBUG_LEVEL 4 6#define DEBUG_LEVEL 0
7#if DEBUG_LEVEL > 0 7#if DEBUG_LEVEL > 0
8#define dprintf(l, x...) \ 8#define dprintf(l, x...) \
9 do { \ 9 do { \
diff --git a/rt-plot-vcpu.c b/rt-plot-vcpu.c
index 0ec55da..54dc05f 100644
--- a/rt-plot-vcpu.c
+++ b/rt-plot-vcpu.c
@@ -306,7 +306,7 @@ rt_vcpu_plot_write_header(struct rt_plot_common *rt,
306 &release, &deadline, 306 &release, &deadline,
307 &job, &tid, &record); 307 &job, &tid, &record);
308 308
309 trace_seq_printf(s, "%s-%d:%d", vcpu_info->cont->name, 309 trace_seq_printf(s, "%s-%d\n%d", vcpu_info->cont->name,
310 vcpu_info->sid, job); 310 vcpu_info->sid, job);
311 if (is_running) { 311 if (is_running) {
312 trace_seq_printf(s, " - %d", tid); 312 trace_seq_printf(s, " - %d", tid);
diff --git a/rt-plot.c b/rt-plot.c
index b04caf1..c45ee0e 100644
--- a/rt-plot.c
+++ b/rt-plot.c
@@ -30,7 +30,6 @@ __find_rt_record(struct graph_info *ginfo, struct rt_plot_common *rt_info,
30 return record; 30 return record;
31} 31}
32 32
33
34/** 33/**
35 * rt_plot_display_last_event - write event name at @time onto plot. 34 * rt_plot_display_last_event - write event name at @time onto plot.
36 */ 35 */
@@ -65,6 +64,43 @@ rt_plot_display_last_event(struct graph_info *ginfo, struct graph_plot *plot,
65 return 1; 64 return 1;
66} 65}
67 66
67static struct record*
68find_prev_record(struct graph_info *ginfo, struct rt_plot_common *rt_info,
69 unsigned long long time)
70{
71 int eid, ignored, match, cpu;
72 struct record *prev, *res = NULL;
73 unsigned long long min_ts;
74
75 min_ts = time - max_rt_search(ginfo);
76
77 set_cpus_to_rts(ginfo, time);
78
79 for (cpu = 0; cpu < ginfo->cpus; cpu++) {
80 prev = tracecmd_peek_data(ginfo->handle, cpu);
81 while ((prev = tracecmd_read_prev(ginfo->handle, prev)) &&
82 get_rts(ginfo, prev) > min_ts) {
83 eid = pevent_data_type(ginfo->pevent, prev);
84 ignored = (eid == ginfo->event_sched_switch_id);
85 if (!ignored) {
86 ignored = rt_info->is_drawn(ginfo, eid);
87 }
88 match = !ignored &&
89 rt_info->record_matches(rt_info, ginfo, prev);
90 if (match) {
91 if (!res ||
92 get_rts(ginfo, prev) > get_rts(ginfo, res)) {
93 free_record(res);
94 res = prev;
95 }
96 break;
97 }
98 free_record(prev);
99 }
100 }
101 return res;
102}
103
68/** 104/**
69 * rt_plot_display_info - write information about @time into @s 105 * rt_plot_display_info - write information about @time into @s
70 */ 106 */
@@ -74,11 +110,19 @@ rt_plot_display_info(struct graph_info *ginfo, struct graph_plot *plot,
74{ 110{
75 struct rt_plot_common *rt_info = plot->private; 111 struct rt_plot_common *rt_info = plot->private;
76 struct event_format *event; 112 struct event_format *event;
77 struct record *record; 113 struct record *record, *prev_record;
78 unsigned long long msec, nsec, rts; 114 unsigned long long msec, nsec, rts;
79 int eid; 115 int eid;
80 116
81 record = rt_info->write_header(rt_info, ginfo, s, time); 117 record = rt_info->write_header(rt_info, ginfo, s, time);
118 prev_record = find_prev_record(ginfo, rt_info, time);
119
120 if (!record || (prev_record && prev_record != record &&
121 (time - get_rts(ginfo, prev_record)) <
122 (get_rts(ginfo, record) - time))) {
123 free_record(record);
124 record = prev_record;
125 }
82 126
83 if (record) { 127 if (record) {
84 rts = get_rts(ginfo, record); 128 rts = get_rts(ginfo, record);