[gnome-photos/wip/rishi/misc-fixes: 6/14] application, debug: Log the counters before exiting under a flag



commit 6b451cfdc90b3e2e631d5f290eba00ae5944e98f
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Dec 15 14:36:05 2015 +0100

    application, debug: Log the counters before exiting under a flag

 src/photos-application.c |   16 ++++++++++++++++
 src/photos-debug.c       |    1 +
 src/photos-debug.h       |    5 +++--
 3 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 77db09d..1a07294 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -34,9 +34,11 @@
 #include <grilo.h>
 #include <libgnome-desktop/gnome-bg.h>
 
+#include "egg-counter.h"
 #include "photos-application.h"
 #include "photos-base-item.h"
 #include "photos-camera-cache.h"
+#include "photos-debug.h"
 #include "photos-dlna-renderers-dialog.h"
 #include "photos-filterable.h"
 #include "photos-gom-miner.h"
@@ -294,6 +296,16 @@ photos_application_actions_update (PhotosApplication *self)
 
 
 static void
+photos_application_counter_arena_foreach (EggCounter *counter)
+{
+  gint64 count;
+
+  count = egg_counter_get (counter);
+  photos_debug (PHOTOS_DEBUG_MEMORY, "%-32s: %-15s: %15" G_GINT64_FORMAT, counter->category, counter->name, 
count);
+}
+
+
+static void
 photos_application_tracker_clear_rdf_types (GObject *source_object, GAsyncResult *res, gpointer user_data)
 {
   PhotosApplication *self = PHOTOS_APPLICATION (user_data);
@@ -1514,6 +1526,7 @@ static void
 photos_application_finalize (GObject *object)
 {
   PhotosApplication *self = PHOTOS_APPLICATION (object);
+  EggCounterArena *arena;
 
   g_assert (self->priv->create_miners_count == 0);
 
@@ -1521,6 +1534,9 @@ photos_application_finalize (GObject *object)
     gegl_exit ();
 
   G_OBJECT_CLASS (photos_application_parent_class)->finalize (object);
+
+  arena = egg_counter_arena_get_default ();
+  egg_counter_arena_foreach (arena, (EggCounterForeachFunc) photos_application_counter_arena_foreach, NULL);
 }
 
 
diff --git a/src/photos-debug.c b/src/photos-debug.c
index fc361d2..bf192b2 100644
--- a/src/photos-debug.c
+++ b/src/photos-debug.c
@@ -38,6 +38,7 @@ photos_debug_init (void)
     {
       { "dlna", PHOTOS_DEBUG_DLNA },
       { "gegl", PHOTOS_DEBUG_GEGL },
+      { "memory", PHOTOS_DEBUG_MEMORY },
       { "network", PHOTOS_DEBUG_NETWORK },
       { "tracker", PHOTOS_DEBUG_TRACKER }
     };
diff --git a/src/photos-debug.h b/src/photos-debug.h
index fe72875..6d9aa7d 100644
--- a/src/photos-debug.h
+++ b/src/photos-debug.h
@@ -29,8 +29,9 @@ typedef enum
 {
   PHOTOS_DEBUG_DLNA       = 1 << 0,
   PHOTOS_DEBUG_GEGL       = 1 << 1,
-  PHOTOS_DEBUG_NETWORK    = 1 << 2,
-  PHOTOS_DEBUG_TRACKER    = 1 << 3
+  PHOTOS_DEBUG_MEMORY     = 1 << 2,
+  PHOTOS_DEBUG_NETWORK    = 1 << 3,
+  PHOTOS_DEBUG_TRACKER    = 1 << 4
 } PhotosDebugFlags;
 
 void        photos_debug_init          (void);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]