[gegl] gegl-stats: add gegl_reset_stats()
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl-stats: add gegl_reset_stats()
- Date: Sat, 30 Dec 2017 18:56:57 +0000 (UTC)
commit 86031b78e3b4b70e7e2b2587f54420a7f23d1c35
Author: Ell <ell_se yahoo com>
Date: Sat Dec 30 13:36:09 2017 -0500
gegl-stats: add gegl_reset_stats()
... which resets the cumulative properties of GeglStats (in
particular, cache-total-max, cache-hits, and cache-misses).
gegl/buffer/gegl-tile-handler-cache.c | 8 ++++++++
gegl/buffer/gegl-tile-handler-cache.h | 2 ++
gegl/gegl-init.c | 5 +++++
gegl/gegl-init.h | 8 ++++++++
gegl/gegl-stats.c | 6 ++++++
gegl/gegl-stats.h | 2 ++
6 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-handler-cache.c b/gegl/buffer/gegl-tile-handler-cache.c
index aee0d83..73cade8 100644
--- a/gegl/buffer/gegl-tile-handler-cache.c
+++ b/gegl/buffer/gegl-tile-handler-cache.c
@@ -679,6 +679,14 @@ gegl_tile_handler_cache_get_misses (void)
return cache_misses;
}
+void
+gegl_tile_handler_cache_reset_stats (void)
+{
+ cache_total_max = cache_total;
+ cache_hits = 0;
+ cache_misses = 0;
+}
+
static guint
gegl_tile_handler_cache_hashfunc (gconstpointer key)
diff --git a/gegl/buffer/gegl-tile-handler-cache.h b/gegl/buffer/gegl-tile-handler-cache.h
index 568dfa0..be271a2 100644
--- a/gegl/buffer/gegl-tile-handler-cache.h
+++ b/gegl/buffer/gegl-tile-handler-cache.h
@@ -67,4 +67,6 @@ gsize gegl_tile_handler_cache_get_total_uncloned (void);
gint gegl_tile_handler_cache_get_hits (void);
gint gegl_tile_handler_cache_get_misses (void);
+void gegl_tile_handler_cache_reset_stats (void);
+
#endif
diff --git a/gegl/gegl-init.c b/gegl/gegl-init.c
index 06bd450..f45d0d0 100644
--- a/gegl/gegl-init.c
+++ b/gegl/gegl-init.c
@@ -426,6 +426,11 @@ GeglStats *gegl_stats (void)
return stats;
}
+void gegl_reset_stats (void)
+{
+ gegl_stats_reset (gegl_stats ());
+}
+
static void swap_clean (void)
{
const gchar *swap_dir = gegl_swap_dir ();
diff --git a/gegl/gegl-init.h b/gegl/gegl-init.h
index 38cb913..4022e60 100644
--- a/gegl/gegl-init.h
+++ b/gegl/gegl-init.h
@@ -104,6 +104,14 @@ GeglConfig *gegl_config (void);
*/
GeglStats *gegl_stats (void);
+/**
+ * gegl_reset_stats:
+ *
+ * Resets the cumulative data gathered by the #GeglStats object returned
+ * by #gegl_stats().
+ */
+void gegl_reset_stats (void);
+
gboolean gegl_is_main_thread (void);
G_END_DECLS
diff --git a/gegl/gegl-stats.c b/gegl/gegl-stats.c
index a986cd6..0afc5d2 100644
--- a/gegl/gegl-stats.c
+++ b/gegl/gegl-stats.c
@@ -184,3 +184,9 @@ gegl_stats_get_property (GObject *object,
break;
}
}
+
+void
+gegl_stats_reset (GeglStats *stats)
+{
+ gegl_tile_handler_cache_reset_stats ();
+}
diff --git a/gegl/gegl-stats.h b/gegl/gegl-stats.h
index c521703..1705ed5 100644
--- a/gegl/gegl-stats.h
+++ b/gegl/gegl-stats.h
@@ -41,6 +41,8 @@ struct _GeglStatsClass
GObjectClass parent_class;
};
+void gegl_stats_reset (GeglStats *stats);
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]