Commit 8a27702a authored by Michael Natterer's avatar Michael Natterer 😴

app: add simple macros GIMP_TIMER_START() and GIMP_TIMER_END()

which measure the time taken between them and print out a message.
Use it for projection benchmarking and add timing to scaling.
parent 17961941
......@@ -31,6 +31,7 @@
#include "base/tile.h"
#include "core/gimp.h"
#include "core/gimp-utils.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
......@@ -291,7 +292,6 @@ debug_benchmark_projection (GimpImage *image)
{
GimpProjection *projection = gimp_image_get_projection (image);
TileManager *tiles;
GTimer *timer;
gint x, y;
gimp_image_invalidate (image,
......@@ -302,7 +302,7 @@ debug_benchmark_projection (GimpImage *image)
tiles = gimp_pickable_get_tiles (GIMP_PICKABLE (projection));
timer = g_timer_new ();
GIMP_TIMER_START ();
for (x = 0; x < tile_manager_width (tiles); x += TILE_WIDTH)
{
......@@ -314,10 +314,7 @@ debug_benchmark_projection (GimpImage *image)
}
}
g_print ("Validation of the entire projection took %.0f ms\n",
1000 * g_timer_elapsed (timer, NULL));
g_timer_destroy (timer);
GIMP_TIMER_END ("Validation of the entire projection");
g_object_unref (image);
......
......@@ -19,6 +19,15 @@
#define __APP_GIMP_UTILS_H__
#define GIMP_TIMER_START() \
{ GTimer *_timer = g_timer_new ();
#define GIMP_TIMER_END(message) \
g_printerr ("%s: " message " took %0.2f seconds\n", \
G_STRFUNC, g_timer_elapsed (_timer, NULL)); \
g_timer_destroy (_timer); }
gint64 gimp_g_type_instance_get_memsize (GTypeInstance *instance);
gint64 gimp_g_object_get_memsize (GObject *object);
gint64 gimp_g_hash_table_get_memsize (GHashTable *hash,
......
......@@ -36,6 +36,7 @@
#include "gegl/gimp-gegl-utils.h"
#include "gimp.h" /* temp for gimp_use_gegl() */
#include "gimp-utils.h" /* temp for GIMP_TIMER */
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpdrawable-combine.h"
......@@ -460,6 +461,8 @@ gimp_drawable_scale (GimpItem *item,
new_tiles = tile_manager_new (new_width, new_height, drawable->bytes);
GIMP_TIMER_START ();
if (gimp_use_gegl (gimp_item_get_image (item)->gimp) &&
! gimp_drawable_is_indexed (drawable) &&
interpolation_type != GIMP_INTERPOLATION_LANCZOS)
......@@ -511,6 +514,8 @@ gimp_drawable_scale (GimpItem *item,
progress);
}
GIMP_TIMER_END ("scaling");
gimp_drawable_set_tiles_full (drawable, gimp_item_is_attached (item), NULL,
new_tiles, gimp_drawable_type (drawable),
new_offset_x, new_offset_y);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment