[gnome-builder] diagnostics: add instance counter



commit 243e281917a4574fec0ea1f48a11bf704865e7aa
Author: Christian Hergert <christian hergert me>
Date:   Thu May 14 04:24:41 2015 -0700

    diagnostics: add instance counter

 libide/ide-diagnostics.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-diagnostics.c b/libide/ide-diagnostics.c
index e643635..b91468f 100644
--- a/libide/ide-diagnostics.c
+++ b/libide/ide-diagnostics.c
@@ -16,11 +16,17 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#define G_LOG_DOMAIN "ide-diagnostics"
+
+#include "egg-counter.h"
+
 #include "ide-diagnostic.h"
 #include "ide-diagnostics.h"
 
 G_DEFINE_BOXED_TYPE (IdeDiagnostics, ide_diagnostics, ide_diagnostics_ref, ide_diagnostics_unref)
 
+EGG_DEFINE_COUNTER (instances, "IdeDiagnostics", "Instances", "Number of IdeDiagnostics")
+
 struct _IdeDiagnostics
 {
   volatile gint  ref_count;
@@ -45,6 +51,8 @@ _ide_diagnostics_new (GPtrArray *ar)
   ret->ref_count = 1;
   ret->diagnostics = ar;
 
+  EGG_COUNTER_INC (instances);
+
   return ret;
 }
 
@@ -69,6 +77,8 @@ ide_diagnostics_unref (IdeDiagnostics *self)
     {
       g_clear_pointer (&self->diagnostics, g_ptr_array_unref);
       g_slice_free (IdeDiagnostics, self);
+
+      EGG_COUNTER_DEC (instances);
     }
 }
 


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