[gimp] app: bring back Debug -> Benchmark Projection
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: bring back Debug -> Benchmark Projection
- Date: Mon, 2 Jun 2014 19:34:24 +0000 (UTC)
commit 41148e89966094d98013c5f17d3c07293d708a9c
Author: Michael Natterer <mitch gimp org>
Date: Mon Jun 2 21:32:00 2014 +0200
app: bring back Debug -> Benchmark Projection
app/actions/debug-actions.c | 8 ++++++++
app/actions/debug-commands.c | 35 +++++++++++++++++++++++++++++++++++
app/actions/debug-commands.h | 30 ++++++++++++++++--------------
menus/image-menu.xml.in | 1 +
4 files changed, 60 insertions(+), 14 deletions(-)
---
diff --git a/app/actions/debug-actions.c b/app/actions/debug-actions.c
index 18223ab..5debf3b 100644
--- a/app/actions/debug-actions.c
+++ b/app/actions/debug-actions.c
@@ -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",
diff --git a/app/actions/debug-commands.c b/app/actions/debug-commands.c
index 474b543..a7b1f6c 100644
--- a/app/actions/debug-commands.c
+++ b/app/actions/debug-commands.c
@@ -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,
@@ -89,6 +91,16 @@ debug_mem_profile_cmd_callback (GtkAction *action,
}
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)
{
@@ -271,6 +283,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)
{
Gimp *gimp = source_image->gimp;
diff --git a/app/actions/debug-commands.h b/app/actions/debug-commands.h
index a9f6275..42cb218 100644
--- a/app/actions/debug-commands.h
+++ b/app/actions/debug-commands.h
@@ -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 */
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index a03f0d1..693c0d3 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -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" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]