diff --git a/ChangeLog b/ChangeLog index ca64cb90d7..b3c6ec6c54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-10-19 Martin Nordholts + + * menus/image-menu.xml.in + * app/actions/debug-actions.c + * app/actions/debug-commands.h + * app/actions/debug-commands.c: Added a 'Dump Projection + Benchmarking' item to the Debug Menu so that we can test how + different GEGL graph setups affect performance. + 2008-10-19 Michael Natterer * configure.in: add -Wmissing-format-attribute to CFLAGS. diff --git a/app/actions/debug-actions.c b/app/actions/debug-actions.c index c0f7b34c31..d086ea676a 100644 --- a/app/actions/debug-actions.c +++ b/app/actions/debug-actions.c @@ -56,6 +56,11 @@ static const GimpActionEntry debug_actions[] = { "debug-dump-attached-data", NULL, "Dump Attached Data", NULL, NULL, G_CALLBACK (debug_dump_attached_data_cmd_callback), + NULL }, + + { "debug-dump-projection-benchmarking", NULL, + "Dump Projection Benchmarking", NULL, NULL, + G_CALLBACK (debug_dump_projection_benchmarking_cmd_callback), NULL } }; diff --git a/app/actions/debug-commands.c b/app/actions/debug-commands.c index e77367a426..a7e6c4a42e 100644 --- a/app/actions/debug-commands.c +++ b/app/actions/debug-commands.c @@ -20,14 +20,20 @@ #include +#include #include #include "libgimpbase/gimpbase.h" #include "actions-types.h" +#include "base/tile-manager.h" +#include "base/tile.h" + #include "core/gimp.h" #include "core/gimpcontext.h" +#include "core/gimpimage.h" +#include "core/gimpprojection.h" #include "widgets/gimpmenufactory.h" #include "widgets/gimpuimanager.h" @@ -146,6 +152,50 @@ debug_dump_attached_data_cmd_callback (GtkAction *action, debug_print_qdata (GIMP_OBJECT (user_context)); } +void +debug_dump_projection_benchmarking_cmd_callback (GtkAction *action, + gpointer data) +{ + GimpImage *image = NULL; + GimpProjection *projection = NULL; + TileManager *tiles = NULL; + GTimer *timer = NULL; + return_if_no_image (image, data); + + projection = gimp_image_get_projection (image); + tiles = gimp_projection_get_tiles (projection); + timer = g_timer_new (); + + if (projection &&tiles && timer) + { + int x = 0; + int y = 0; + + gimp_image_update (image, + 0, 0, + gimp_image_get_width (image), + gimp_image_get_height (image)); + gimp_projection_flush_now (projection); + + g_timer_start (timer); + for (x = 0; x < tile_manager_width (tiles); x += TILE_WIDTH) + { + for (y = 0; y < tile_manager_height (tiles); y += TILE_HEIGHT) + { + Tile *tile = tile_manager_get_tile (tiles, x, y, TRUE, FALSE); + + tile_release (tile, FALSE); + } + } + g_timer_stop (timer); + + g_print ("Validation of entire projection took %.0f ms\n", + 1000 * g_timer_elapsed (timer, NULL)); + + g_timer_destroy (timer); + } +} + /* private functions */ diff --git a/app/actions/debug-commands.h b/app/actions/debug-commands.h index b4e700ac00..d82466a17b 100644 --- a/app/actions/debug-commands.h +++ b/app/actions/debug-commands.h @@ -27,14 +27,16 @@ #ifdef ENABLE_DEBUG_MENU -void debug_mem_profile_cmd_callback (GtkAction *action, - gpointer data); -void debug_dump_menus_cmd_callback (GtkAction *action, - gpointer data); -void debug_dump_managers_cmd_callback (GtkAction *action, - gpointer data); -void debug_dump_attached_data_cmd_callback (GtkAction *action, - gpointer data); +void debug_mem_profile_cmd_callback (GtkAction *action, + gpointer data); +void debug_dump_menus_cmd_callback (GtkAction *action, + gpointer data); +void debug_dump_managers_cmd_callback (GtkAction *action, + gpointer data); +void debug_dump_attached_data_cmd_callback (GtkAction *action, + gpointer data); +void debug_dump_projection_benchmarking_cmd_callback (GtkAction *action, + gpointer data); #endif /* ENABLE_DEBUG_MENU */ diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in index 39d51b67a3..3adb785206 100644 --- a/menus/image-menu.xml.in +++ b/menus/image-menu.xml.in @@ -29,6 +29,7 @@ +