Index: pango-layout.c =================================================================== RCS file: /cvs/gnome/pango/pango/pango-layout.c,v retrieving revision 1.142 diff -u -r1.142 pango-layout.c --- pango-layout.c 5 Sep 2005 07:56:50 -0000 1.142 +++ pango-layout.c 4 Oct 2005 15:36:55 -0000 @@ -24,6 +24,7 @@ #include #include #include +#include #include "pango-layout-private.h" @@ -2007,11 +2008,28 @@ int y_offset = 0; int width; gboolean need_width = FALSE; + static GTimer *timer = NULL; + static double total_elapsed = 0.0; + static int num_calls; + double elapsed; + gboolean is_first; g_return_if_fail (layout != NULL); pango_layout_check_lines (layout); + if (!timer) + { + timer = g_timer_new (); + is_first = TRUE; + } + else + { + g_timer_reset (timer); + is_first = FALSE; + num_calls++; + } + /* When we are not wrapping, we need the overall width of the layout to * figure out the x_offsets of each line. However, we only need the * x_offsets if we are computing the ink_rect or individual line extents. @@ -2153,6 +2171,18 @@ if (line_extents) *line_extents = g_slist_reverse (*line_extents); + + if (!is_first) + { + elapsed = g_timer_elapsed (timer, NULL); + total_elapsed += elapsed; + fprintf (stdout, " %d: pango_layout_get_extents_internal (%p, \"%s\"), this=%8.6f, total=%8.6f\n", + num_calls, + layout, + layout->text, + elapsed, + total_elapsed); + } } /** @@ -3182,10 +3212,27 @@ PangoAttrList *no_shape_attrs; PangoAttrIterator *iter; PangoDirection prev_base_dir = PANGO_DIRECTION_NEUTRAL, base_dir = PANGO_DIRECTION_NEUTRAL; + static GTimer *timer = NULL; + static double total_elapsed = 0.0; + static int num_checks; + double elapsed; + gboolean is_first; if (layout->lines) return; + if (!timer) + { + timer = g_timer_new (); + is_first = TRUE; + } + else + { + g_timer_reset (timer); + is_first = FALSE; + num_checks++; + } + g_assert (!layout->log_attrs); /* For simplicity, we make sure at this point that layout->text @@ -3314,6 +3361,18 @@ } layout->lines = g_slist_reverse (layout->lines); + + if (!is_first) + { + elapsed = g_timer_elapsed (timer, NULL); + total_elapsed += elapsed; + fprintf (stdout, " %d: pango_layout_check_lines (%p, \"%s\"), this=%8.6f, total=%8.6f\n", + num_checks, + layout, + layout->text, + elapsed, + total_elapsed); + } } /**