menus/image-menu.xml.in app/actions/debug-actions.c

* 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.

svn path=/trunk/; revision=27317
This commit is contained in:
Martin Nordholts
2008-10-19 07:59:08 +00:00
parent 099bc23234
commit 9d91e6b343
5 changed files with 75 additions and 8 deletions

View File

@ -20,14 +20,20 @@
#include <string.h>
#include <gegl.h>
#include <gtk/gtk.h>
#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 */