gsk: Make profiler counters more useful

Make it possible to have counters that get incremented
by values other than 1.
This commit is contained in:
Matthias Clasen 2017-09-25 17:03:06 -04:00
parent 4970404d33
commit 816b47d70d
2 changed files with 12 additions and 2 deletions

View File

@ -202,6 +202,14 @@ gsk_profiler_add_timer (GskProfiler *profiler,
void void
gsk_profiler_counter_inc (GskProfiler *profiler, gsk_profiler_counter_inc (GskProfiler *profiler,
GQuark counter_id) 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; NamedCounter *counter;
@ -211,8 +219,7 @@ gsk_profiler_counter_inc (GskProfiler *profiler,
if (counter == NULL) if (counter == NULL)
return; return;
counter->value += 1; counter->value += increment;
} }
void void

View File

@ -22,6 +22,9 @@ GQuark gsk_profiler_add_timer (GskProfiler *profiler,
void gsk_profiler_counter_inc (GskProfiler *profiler, void gsk_profiler_counter_inc (GskProfiler *profiler,
GQuark counter_id); GQuark counter_id);
void gsk_profiler_counter_add (GskProfiler *profiler,
GQuark counter_id,
gint64 increment);
void gsk_profiler_timer_begin (GskProfiler *profiler, void gsk_profiler_timer_begin (GskProfiler *profiler,
GQuark timer_id); GQuark timer_id);
gint64 gsk_profiler_timer_end (GskProfiler *profiler, gint64 gsk_profiler_timer_end (GskProfiler *profiler,