diff options
author | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-05 22:53:33 +0000 |
---|---|---|
committer | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-05 22:53:33 +0000 |
commit | ca1c23c3d641b318e3f37f86319a90fe894c33c0 (patch) | |
tree | 5d96ca00a82e35473057e7ef5364495c39104f08 /gcc/sched-vis.c | |
parent | 33f4d5a454125c1c6274d6eb5c980c8dc5c5a708 (diff) | |
download | gcc-ca1c23c3d641b318e3f37f86319a90fe894c33c0.tar.gz |
* sched-vis.c (visual_tbl_line_length): New variable.
(get_visual_tbl_length): Set it.
(visualize_stall_cycles): Don't let stalls overrun
visual_tbl_line_length.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38053 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sched-vis.c')
-rw-r--r-- | gcc/sched-vis.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c index 7e4fdab2d71..99489c9d18d 100644 --- a/gcc/sched-vis.c +++ b/gcc/sched-vis.c @@ -82,6 +82,7 @@ insn_print_units (insn) #define MAX_VISUAL_LINES 100 #define INSN_LEN 30 int n_visual_lines; +static unsigned visual_tbl_line_length; char *visual_tbl; int n_vis_no_unit; rtx vis_no_unit[10]; @@ -133,6 +134,8 @@ get_visual_tbl_length () n += n1; n += strlen ("\n") + 2; + visual_tbl_line_length = n; + /* Compute length of visualization string. */ return (MAX_VISUAL_LINES * n); } @@ -897,6 +900,9 @@ visualize_stall_cycles (stalls) int stalls; { int i; + const char *prefix = ";; "; + const char *suffix = "\n"; + char *p; /* If no more room, split table into two. */ if (n_visual_lines >= MAX_VISUAL_LINES) @@ -907,10 +913,21 @@ visualize_stall_cycles (stalls) n_visual_lines++; - sprintf (visual_tbl + strlen (visual_tbl), ";; "); - for (i = 0; i < stalls; i++) - sprintf (visual_tbl + strlen (visual_tbl), "."); - sprintf (visual_tbl + strlen (visual_tbl), "\n"); + p = visual_tbl + strlen (visual_tbl); + strcpy (p, prefix); + p += strlen (prefix); + + if ((unsigned)stalls > + visual_tbl_line_length - strlen (prefix) - strlen (suffix)) + { + suffix = "[...]\n"; + stalls = visual_tbl_line_length - strlen (prefix) - strlen (suffix); + } + + memset (p, '.', stalls); + p += stalls; + + strcpy (p, suffix); } /* Allocate data used for visualization during scheduling. */ |