app: bring back Debug -> Benchmark Projection

This commit is contained in:
Michael Natterer 2014-06-02 21:32:00 +02:00
parent 2068c61a85
commit 41148e8996
4 changed files with 60 additions and 14 deletions

View File

@ -43,6 +43,14 @@ static const GimpActionEntry debug_actions[] =
G_CALLBACK (debug_mem_profile_cmd_callback),
NULL },
{ "debug-benchmark-projection", NULL,
"Benchmark _Projection", NULL,
"Invalidates the entire projection, measures the time it takes to "
"validate (render) the part that is visible in the active diaplay, "
"and print the result to stdout.",
G_CALLBACK (debug_benchmark_projection_cmd_callback),
NULL },
{ "debug-show-image-graph", NULL,
"Show Image _Graph", NULL,
"Creates a new image showing the GEGL graph of this image",

View File

@ -34,6 +34,7 @@
#include "core/gimplayer.h"
#include "core/gimppickable.h"
#include "core/gimpprojectable.h"
#include "core/gimpprojection.h"
#include "gegl/gimp-gegl-utils.h"
@ -55,6 +56,7 @@
/* local function prototypes */
static gboolean debug_benchmark_projection (GimpDisplay *display);
static gboolean debug_show_image_graph (GimpImage *source_image);
static void debug_dump_menus_recurse_menu (GtkWidget *menu,
@ -88,6 +90,16 @@ debug_mem_profile_cmd_callback (GtkAction *action,
gimp_debug_memsize = FALSE;
}
void
debug_benchmark_projection_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
return_if_no_display (display, data);
g_idle_add ((GSourceFunc) debug_benchmark_projection, g_object_ref (display));
}
void
debug_show_image_graph_cmd_callback (GtkAction *action,
gpointer data)
@ -270,6 +282,29 @@ debug_dump_attached_data_cmd_callback (GtkAction *action,
/* private functions */
static gboolean
debug_benchmark_projection (GimpDisplay *display)
{
GimpImage *image = gimp_display_get_image (display);
GimpProjection *projection = gimp_image_get_projection (image);
GIMP_TIMER_START ();
gimp_image_invalidate (image,
0, 0,
gimp_image_get_width (image),
gimp_image_get_height (image));
gimp_projection_flush_now (projection);
gimp_display_flush_now (display);
GIMP_TIMER_END ("Validation of the entire projection");
g_object_unref (display);
return FALSE;
}
static gboolean
debug_show_image_graph (GimpImage *source_image)
{

View File

@ -26,20 +26,22 @@
#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_keyboard_shortcuts_cmd_callback (GtkAction *action,
gpointer data);
void debug_dump_attached_data_cmd_callback (GtkAction *action,
gpointer data);
void debug_benchmark_projection_cmd_callback (GtkAction *action,
gpointer data);
void debug_show_image_graph_cmd_callback (GtkAction *action,
gpointer data);
void debug_mem_profile_cmd_callback (GtkAction *action,
gpointer data);
void debug_benchmark_projection_cmd_callback (GtkAction *action,
gpointer data);
void debug_show_image_graph_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_keyboard_shortcuts_cmd_callback (GtkAction *action,
gpointer data);
void debug_dump_attached_data_cmd_callback (GtkAction *action,
gpointer data);
void debug_benchmark_projection_cmd_callback (GtkAction *action,
gpointer data);
#endif /* ENABLE_DEBUG_MENU */

View File

@ -26,6 +26,7 @@
<!-- The debug-menu is automatically excluded for stable releases -->
<menu action="debug-menu" name="Debug">
<menuitem action="debug-mem-profile" />
<menuitem action="debug-benchmark-projection" />
<menuitem action="debug-show-image-graph" />
<separator />
<menuitem action="debug-dump-items" />