diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2007-12-03 22:11:06 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2007-12-03 22:11:06 +0000 |
commit | 96586ead658a3e1c67377487faf5cb0cdc0189c8 (patch) | |
tree | 4040cb5f9ae3ecd6ae04cc51d6629447edd13a58 | |
parent | b370727bf3af0bc868ac117324a2193ae6b679ea (diff) |
Use same notation for all y axis time labels, so we don't end up having one
in seconds, one in milliseconds and one in microseconds.
svn path=/trunk/; revision=23722
-rw-r--r-- | gtk/io_stat.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gtk/io_stat.c b/gtk/io_stat.c index e05eb19f25..c0be4afc18 100644 --- a/gtk/io_stat.c +++ b/gtk/io_stat.c @@ -486,15 +486,15 @@ get_it_value(io_stat_t *io, int graph_id, int idx) static void -print_time_scale_string(char *buf, int buf_len, guint32 t) +print_time_scale_string(char *buf, int buf_len, guint32 t, guint32 t_max) { - if(t>=10000000){ + if(t_max>=10000000){ g_snprintf(buf, buf_len, "%ds",t/1000000); - } else if(t>=1000000){ + } else if(t_max>=1000000){ g_snprintf(buf, buf_len, "%d.%03ds",t/1000000,(t%1000000)/1000); - } else if(t>=10000){ + } else if(t_max>=10000){ g_snprintf(buf, buf_len, "%dms",t/1000); - } else if(t>=1000){ + } else if(t_max>=1000){ g_snprintf(buf, buf_len, "%d.%03dms",t/1000,t%1000); } else { g_snprintf(buf, buf_len, "%dus",t); @@ -645,7 +645,7 @@ io_stat_draw(io_stat_t *io) * top y scale label will be the widest one */ if(draw_y_as_time){ - print_time_scale_string(label_string, 15, max_y); + print_time_scale_string(label_string, 15, max_y, max_y); } else { g_snprintf(label_string, 15, "%d", max_y); } @@ -695,7 +695,7 @@ io_stat_draw(io_stat_t *io) /* draw the labels */ if(i==0){ if(draw_y_as_time){ - print_time_scale_string(label_string, 15, (max_y*i/10)); + print_time_scale_string(label_string, 15, (max_y*i/10), max_y); } else { g_snprintf(label_string, 15, "%d", max_y*i/10); } @@ -719,7 +719,7 @@ io_stat_draw(io_stat_t *io) } if(i==5){ if(draw_y_as_time){ - print_time_scale_string(label_string, 15, (max_y*i/10)); + print_time_scale_string(label_string, 15, (max_y*i/10), max_y); } else { g_snprintf(label_string, 15, "%d", max_y*i/10); } @@ -743,7 +743,7 @@ io_stat_draw(io_stat_t *io) } if(i==10){ if(draw_y_as_time){ - print_time_scale_string(label_string, 15, (max_y*i/10)); + print_time_scale_string(label_string, 15, (max_y*i/10), max_y); } else { g_snprintf(label_string, 15, "%d", max_y*i/10); } |