[gtk+] gsk: Make profiler counters more useful



commit 816b47d70d715f2041e2cfa4a7289937fac30b71
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 25 17:03:06 2017 -0400

    gsk: Make profiler counters more useful
    
    Make it possible to have counters that get incremented
    by values other than 1.

 gsk/gskprofiler.c        |   11 +++++++++--
 gsk/gskprofilerprivate.h |    3 +++
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gskprofiler.c b/gsk/gskprofiler.c
index f3b2bd5..bc73010 100644
--- a/gsk/gskprofiler.c
+++ b/gsk/gskprofiler.c
@@ -203,6 +203,14 @@ void
 gsk_profiler_counter_inc (GskProfiler *profiler,
                           GQuark       counter_id)
 {
+  gsk_profiler_counter_add (profiler, counter_id, 1);
+}
+
+void
+gsk_profiler_counter_add (GskProfiler *profiler,
+                          GQuark       counter_id,
+                          gint64       increment)
+{
   NamedCounter *counter;
 
   g_return_if_fail (GSK_IS_PROFILER (profiler));
@@ -211,8 +219,7 @@ gsk_profiler_counter_inc (GskProfiler *profiler,
   if (counter == NULL)
     return;
 
-  counter->value += 1;
-
+  counter->value += increment;
 }
 
 void
diff --git a/gsk/gskprofilerprivate.h b/gsk/gskprofilerprivate.h
index 382ecc8..e30a810 100644
--- a/gsk/gskprofilerprivate.h
+++ b/gsk/gskprofilerprivate.h
@@ -22,6 +22,9 @@ GQuark          gsk_profiler_add_timer          (GskProfiler *profiler,
 
 void            gsk_profiler_counter_inc        (GskProfiler *profiler,
                                                  GQuark       counter_id);
+void            gsk_profiler_counter_add        (GskProfiler *profiler,
+                                                 GQuark       counter_id,
+                                                 gint64       increment);
 void            gsk_profiler_timer_begin        (GskProfiler *profiler,
                                                  GQuark       timer_id);
 gint64          gsk_profiler_timer_end          (GskProfiler *profiler,


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