From 816b47d70d715f2041e2cfa4a7289937fac30b71 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 25 Sep 2017 17:03:06 -0400 Subject: [PATCH] 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 f3b2bd53f6..bc7301046b 100644 --- a/gsk/gskprofiler.c +++ b/gsk/gskprofiler.c @@ -202,6 +202,14 @@ gsk_profiler_add_timer (GskProfiler *profiler, 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; @@ -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 382ecc895b..e30a810432 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,