diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-12-17 22:13:58 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-12-17 22:56:04 -0500 |
commit | 03585d0c8c6ba47217c40babdf0980dcbc64c77e (patch) | |
tree | 2c16cd9b90bac9019dced88e124630b2f55e2aee | |
parent | f968bf78e41d3ee23fc185c3b12f9990c840641f (diff) |
trace-graph: Added some fixes for the trace labels
The trace labels had some minor bugs, and one major one (would crash
if we zoomed in so far that a CPU line had no events).
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-graph.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/trace-graph.c b/trace-graph.c index 48a41e6..52bf91a 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
@@ -668,8 +668,9 @@ static void draw_event_label(struct graph_info *ginfo, gint cpu, | |||
668 | 668 | ||
669 | 669 | ||
670 | /* No room to print */ | 670 | /* No room to print */ |
671 | if (((p3 - p2) < width_16 / 2 || | 671 | if ((p2 > width_16 && ((p3 - p2) < width_16 / 2 || |
672 | (p2 - p1) < width_16 / 2)) | 672 | (p2 - p1) < width_16 / 2)) || |
673 | (p2 <= width_16 && (p1 || (p3 - p2) < width_16))) | ||
673 | return; | 674 | return; |
674 | 675 | ||
675 | /* Check if we can show some data */ | 676 | /* Check if we can show some data */ |
@@ -686,13 +687,18 @@ static void draw_event_label(struct graph_info *ginfo, gint cpu, | |||
686 | 687 | ||
687 | pango_layout_get_pixel_size(layout, &text_width, &text_height); | 688 | pango_layout_get_pixel_size(layout, &text_width, &text_height); |
688 | 689 | ||
689 | if ((p3 - p2) < text_width / 2 || | 690 | if ((p2 > text_width && ((p3 - p2) < text_width || |
690 | (p2 - p1) < text_width / 2) { | 691 | (p2 - p1) < text_width)) || |
692 | (p2 < text_width && (p1 || (p3 - p2 < (text_width + | ||
693 | text_width / 2))))) { | ||
691 | g_object_unref(layout); | 694 | g_object_unref(layout); |
692 | return; | 695 | return; |
693 | } | 696 | } |
694 | 697 | ||
695 | x = p2 - text_width / 2; | 698 | x = p2 - text_width / 2; |
699 | if (x < 0) | ||
700 | x = 1; | ||
701 | |||
696 | y = (CPU_TOP(cpu) - text_height + 5); | 702 | y = (CPU_TOP(cpu) - text_height + 5); |
697 | gdk_draw_layout(ginfo->curr_pixmap, ginfo->draw->style->black_gc, | 703 | gdk_draw_layout(ginfo->curr_pixmap, ginfo->draw->style->black_gc, |
698 | x, y, layout); | 704 | x, y, layout); |
@@ -750,6 +756,10 @@ static void draw_cpu(struct graph_info *ginfo, gint cpu, | |||
750 | 756 | ||
751 | while ((record = tracecmd_read_data(ginfo->handle, cpu))) { | 757 | while ((record = tracecmd_read_data(ginfo->handle, cpu))) { |
752 | 758 | ||
759 | if (record->ts < ginfo->view_start_time) { | ||
760 | free_record(record); | ||
761 | continue; | ||
762 | } | ||
753 | if (record->ts > ginfo->view_end_time) | 763 | if (record->ts > ginfo->view_end_time) |
754 | break; | 764 | break; |
755 | 765 | ||
@@ -815,8 +825,9 @@ static void draw_cpu(struct graph_info *ginfo, gint cpu, | |||
815 | free(record); | 825 | free(record); |
816 | } | 826 | } |
817 | 827 | ||
818 | draw_event_label(ginfo, cpu, last_event_id, last_pid, | 828 | if (p2) |
819 | p1, p2, ginfo->draw_width, width_16, font); | 829 | draw_event_label(ginfo, cpu, last_event_id, last_pid, |
830 | p1, p2, ginfo->draw_width, width_16, font); | ||
820 | 831 | ||
821 | 832 | ||
822 | if (last_pid > 0) { | 833 | if (last_pid > 0) { |