diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2009-12-29 18:04:44 -0500 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2009-12-29 18:04:44 -0500 |
| commit | c2fe7bb90488951ec0cce2d60d3ea03acf70ff06 (patch) | |
| tree | 49cfecebc7b7866fce7beef010a31bb3ad0610a2 | |
| parent | be7e127e0810e824e4380c32b527fd657c48d9d3 (diff) | |
trace-graph: Fix the graph to be a bit more eye pleasing
Removed the "boxing" of tasks, and made them a solid bar. Moved
the CPU line to the bottom as well. Moved the CPU labels below
the bar.
Reported-by: Darren Hart <dvhltc@us.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
| -rw-r--r-- | trace-graph.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/trace-graph.c b/trace-graph.c index 99b7140..1f0fedd 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
| @@ -32,10 +32,16 @@ | |||
| 32 | 32 | ||
| 33 | #define MAX_WIDTH 10000 | 33 | #define MAX_WIDTH 10000 |
| 34 | 34 | ||
| 35 | #define CPU_MIDDLE(cpu) (80 * (cpu) + 80) | 35 | #define CPU_SIZE 10 |
| 36 | #define CPU_TOP(cpu) (CPU_MIDDLE(cpu) - 10) | 36 | #define CPU_BOX_SIZE CPU_SIZE |
| 37 | #define CPU_BOTTOM(cpu) (CPU_MIDDLE(cpu) + 10) | 37 | #define CPU_GIVE 2 |
| 38 | #define CPU_LINE(cpu) (80 * (cpu) + 80 + CPU_SIZE) | ||
| 39 | #define CPU_TOP(cpu) (CPU_LINE(cpu) - CPU_SIZE * 2) | ||
| 40 | #define CPU_BOX_TOP(cpu) (CPU_LINE(cpu) - CPU_SIZE) | ||
| 41 | #define CPU_BOTTOM(cpu) (CPU_LINE(cpu)-1) | ||
| 42 | #define CPU_BOX_BOTTOM(cpu) (CPU_LINE(cpu)) | ||
| 38 | #define CPU_SPACE(cpus) (80 * (cpus) + 80) | 43 | #define CPU_SPACE(cpus) (80 * (cpus) + 80) |
| 44 | #define CPU_LABEL(cpu) (CPU_BOTTOM(cpu)) | ||
| 39 | 45 | ||
| 40 | static gint ftrace_sched_switch_id = -1; | 46 | static gint ftrace_sched_switch_id = -1; |
| 41 | static gint event_sched_switch_id = -1; | 47 | static gint event_sched_switch_id = -1; |
| @@ -73,7 +79,7 @@ static void __update_with_backend(struct graph_info *ginfo, | |||
| 73 | static void clear_old_cpu_label(struct graph_info *ginfo, gint cpu) | 79 | static void clear_old_cpu_label(struct graph_info *ginfo, gint cpu) |
| 74 | { | 80 | { |
| 75 | __update_with_backend(ginfo, | 81 | __update_with_backend(ginfo, |
| 76 | ginfo->cpu_x, CPU_TOP(cpu), | 82 | ginfo->cpu_x, CPU_LABEL(cpu), |
| 77 | largest_cpu_label+1, 20); | 83 | largest_cpu_label+1, 20); |
| 78 | } | 84 | } |
| 79 | 85 | ||
| @@ -102,11 +108,11 @@ static void __draw_cpu_label(struct graph_info *ginfo, gint cpu) | |||
| 102 | gdk_draw_rectangle(ginfo->draw->window, | 108 | gdk_draw_rectangle(ginfo->draw->window, |
| 103 | ginfo->draw->style->white_gc, | 109 | ginfo->draw->style->white_gc, |
| 104 | TRUE, | 110 | TRUE, |
| 105 | ginfo->cpu_x, CPU_TOP(cpu)+4, | 111 | ginfo->cpu_x, CPU_LABEL(cpu)+4, |
| 106 | width, height); | 112 | width, height); |
| 107 | gdk_draw_layout(ginfo->draw->window, | 113 | gdk_draw_layout(ginfo->draw->window, |
| 108 | ginfo->draw->style->black_gc, | 114 | ginfo->draw->style->black_gc, |
| 109 | ginfo->cpu_x + 2, CPU_TOP(cpu) + 4, | 115 | ginfo->cpu_x + 2, CPU_LABEL(cpu) + 4, |
| 110 | layout); | 116 | layout); |
| 111 | g_object_unref(layout); | 117 | g_object_unref(layout); |
| 112 | } | 118 | } |
| @@ -500,9 +506,9 @@ motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) | |||
| 500 | } | 506 | } |
| 501 | 507 | ||
| 502 | for (cpu = 0; cpu < ginfo->cpus; cpu++) { | 508 | for (cpu = 0; cpu < ginfo->cpus; cpu++) { |
| 503 | if (y >= CPU_TOP(cpu) && y <= CPU_BOTTOM(cpu)) { | 509 | if (y >= (CPU_TOP(cpu) - CPU_GIVE) && |
| 510 | y <= (CPU_BOTTOM(cpu) + CPU_GIVE)) | ||
| 504 | draw_cpu_info(ginfo, cpu, x, y); | 511 | draw_cpu_info(ginfo, cpu, x, y); |
| 505 | } | ||
| 506 | } | 512 | } |
| 507 | 513 | ||
| 508 | return TRUE; | 514 | return TRUE; |
| @@ -862,7 +868,7 @@ static void draw_cpu(struct graph_info *ginfo, gint cpu, | |||
| 862 | { | 868 | { |
| 863 | static PangoFontDescription *font; | 869 | static PangoFontDescription *font; |
| 864 | PangoLayout *layout; | 870 | PangoLayout *layout; |
| 865 | gint height = CPU_MIDDLE(cpu); | 871 | gint height = CPU_LINE(cpu); |
| 866 | struct record *record; | 872 | struct record *record; |
| 867 | static GdkGC *gc; | 873 | static GdkGC *gc; |
| 868 | static gint width_16; | 874 | static gint width_16; |
| @@ -935,14 +941,11 @@ static void draw_cpu(struct graph_info *ginfo, gint cpu, | |||
| 935 | if (last_pid < 0) | 941 | if (last_pid < 0) |
| 936 | last_pid = pid; | 942 | last_pid = pid; |
| 937 | 943 | ||
| 938 | if (last_pid) { | 944 | if (last_pid) |
| 939 | gdk_draw_line(ginfo->curr_pixmap, gc, | 945 | gdk_draw_rectangle(ginfo->curr_pixmap, gc, |
| 940 | last_x, CPU_TOP(cpu), | 946 | TRUE, |
| 941 | x, CPU_TOP(cpu)); | 947 | last_x, CPU_BOX_TOP(cpu), |
| 942 | gdk_draw_line(ginfo->curr_pixmap, gc, | 948 | x - last_x, CPU_BOX_SIZE); |
| 943 | last_x, CPU_BOTTOM(cpu), | ||
| 944 | x, CPU_BOTTOM(cpu)); | ||
| 945 | } | ||
| 946 | 949 | ||
| 947 | last_x = x; | 950 | last_x = x; |
| 948 | last_pid = pid; | 951 | last_pid = pid; |
| @@ -980,12 +983,10 @@ static void draw_cpu(struct graph_info *ginfo, gint cpu, | |||
| 980 | if (last_pid > 0) { | 983 | if (last_pid > 0) { |
| 981 | x = ginfo->draw_width; | 984 | x = ginfo->draw_width; |
| 982 | 985 | ||
| 983 | gdk_draw_line(ginfo->curr_pixmap, gc, | 986 | gdk_draw_rectangle(ginfo->curr_pixmap, gc, |
| 984 | last_x, CPU_TOP(cpu), | 987 | TRUE, |
| 985 | x, CPU_TOP(cpu)); | 988 | last_x, CPU_BOX_TOP(cpu), |
| 986 | gdk_draw_line(ginfo->curr_pixmap, gc, | 989 | x - last_x, CPU_BOX_SIZE); |
| 987 | last_x, CPU_BOTTOM(cpu), | ||
| 988 | x, CPU_BOTTOM(cpu)); | ||
| 989 | } | 990 | } |
| 990 | 991 | ||
| 991 | free_record(record); | 992 | free_record(record); |
