[gegl/wip/tile-damage: 1/3] buffer, stats: add zoom-total GeglStats property
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/wip/tile-damage: 1/3] buffer, stats: add zoom-total GeglStats property
- Date: Sat, 31 Mar 2018 16:11:15 +0000 (UTC)
commit 5bebb2839fe611c534aee59263241e361b736a48
Author: Ell <ell_se yahoo com>
Date: Thu Mar 29 17:40:01 2018 -0400
buffer, stats: add zoom-total GeglStats property
... which reports the total size of the data processed by the zoom
tile handler.
gegl/buffer/gegl-tile-handler-zoom.c | 18 ++++++++++++++++++
gegl/buffer/gegl-tile-handler-zoom.h | 3 +++
gegl/gegl-stats.c | 16 +++++++++++++++-
3 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-handler-zoom.c b/gegl/buffer/gegl-tile-handler-zoom.c
index dd1d25c..a8037de 100644
--- a/gegl/buffer/gegl-tile-handler-zoom.c
+++ b/gegl/buffer/gegl-tile-handler-zoom.c
@@ -35,6 +35,8 @@
G_DEFINE_TYPE (GeglTileHandlerZoom, gegl_tile_handler_zoom,
GEGL_TYPE_TILE_HANDLER)
+static guint64 total_size = 0;
+
static inline void set_blank (GeglTile *dst_tile,
gint width,
gint height,
@@ -55,6 +57,8 @@ static inline void set_blank (GeglTile *dst_tile,
memset (dst, 0x0, bytes);
dst += rowstride;
}
+
+ total_size += (height / 2) * bytes;
}
static inline void set_half (GeglTileHandlerZoom *zoom,
@@ -77,6 +81,8 @@ static inline void set_half (GeglTileHandlerZoom *zoom,
zoom->downscale_2x2 = gegl_downscale_2x2_get_fun (format);
zoom->downscale_2x2 (format, width, height, src_data, width * bpp, dst_data, width * bpp);
+
+ total_size += (width / 2) * (height / 2) * bpp;
}
static GeglTile *
@@ -190,3 +196,15 @@ gegl_tile_handler_zoom_new (GeglTileBackend *backend)
return (void*)ret;
}
+
+guint64
+gegl_tile_handler_zoom_get_total (void)
+{
+ return total_size;
+}
+
+void
+gegl_tile_handler_zoom_reset_stats (void)
+{
+ total_size = 0;
+}
diff --git a/gegl/buffer/gegl-tile-handler-zoom.h b/gegl/buffer/gegl-tile-handler-zoom.h
index 13906c4..ca8b191 100644
--- a/gegl/buffer/gegl-tile-handler-zoom.h
+++ b/gegl/buffer/gegl-tile-handler-zoom.h
@@ -64,6 +64,9 @@ GType gegl_tile_handler_zoom_get_type (void) G_GNUC_CONST;
GeglTileHandler * gegl_tile_handler_zoom_new (GeglTileBackend *backend);
+guint64 gegl_tile_handler_zoom_get_total (void);
+void gegl_tile_handler_zoom_reset_stats (void);
+
G_END_DECLS
#endif
diff --git a/gegl/gegl-stats.c b/gegl/gegl-stats.c
index 0afc5d2..f76b571 100644
--- a/gegl/gegl-stats.c
+++ b/gegl/gegl-stats.c
@@ -24,6 +24,7 @@
#include "gegl-types-internal.h"
#include "buffer/gegl-buffer-types.h"
#include "buffer/gegl-tile-handler-cache.h"
+#include "buffer/gegl-tile-handler-zoom.h"
#include "buffer/gegl-tile-backend-swap.h"
#include "gegl-stats.h"
@@ -38,7 +39,8 @@ enum
PROP_TILE_CACHE_MISSES,
PROP_SWAP_TOTAL,
PROP_SWAP_FILE_SIZE,
- PROP_SWAP_BUSY
+ PROP_SWAP_BUSY,
+ PROP_ZOOM_TOTAL
};
@@ -118,6 +120,13 @@ gegl_stats_class_init (GeglStatsClass *klass)
"Whether there is work queued for the swap",
FALSE,
G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, PROP_ZOOM_TOTAL,
+ g_param_spec_uint64 ("zoom-total",
+ "Zoom total",
+ "Total size of data processed by the zoom tile
handler",
+ 0, G_MAXUINT64, 0,
+ G_PARAM_READABLE));
}
static void
@@ -179,6 +188,10 @@ gegl_stats_get_property (GObject *object,
g_value_set_boolean (value, gegl_tile_backend_swap_get_busy ());
break;
+ case PROP_ZOOM_TOTAL:
+ g_value_set_uint64 (value, gegl_tile_handler_zoom_get_total ());
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -189,4 +202,5 @@ void
gegl_stats_reset (GeglStats *stats)
{
gegl_tile_handler_cache_reset_stats ();
+ gegl_tile_handler_zoom_reset_stats ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]