Skip to content

Commit 0fde19f

Browse files
committed
WIP: stats-counters G_UNLIKELY
1 parent 4a4374f commit 0fde19f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/filterx/filterx-expr.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ struct _FilterXExpr
7777
static inline FilterXObject *
7878
filterx_expr_eval(FilterXExpr *self)
7979
{
80+
#if 0
8081
stats_counter_inc(self->eval_count);
81-
82+
#endif
8283
return self->eval(self);
8384
}
8485

lib/stats/stats-counter.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ stats_counter_read_only(StatsCounterItem *counter)
5151
static inline void
5252
stats_counter_add(StatsCounterItem *counter, gssize add)
5353
{
54-
if (counter)
54+
if (G_UNLIKELY(counter))
5555
{
5656
g_assert(!stats_counter_read_only(counter));
5757
atomic_gssize_add(&counter->value, add);
@@ -61,7 +61,7 @@ stats_counter_add(StatsCounterItem *counter, gssize add)
6161
static inline void
6262
stats_counter_sub(StatsCounterItem *counter, gssize sub)
6363
{
64-
if (counter)
64+
if (G_UNLIKELY(counter))
6565
{
6666
g_assert(!stats_counter_read_only(counter));
6767
atomic_gssize_sub(&counter->value, sub);
@@ -71,7 +71,7 @@ stats_counter_sub(StatsCounterItem *counter, gssize sub)
7171
static inline void
7272
stats_counter_inc(StatsCounterItem *counter)
7373
{
74-
if (counter)
74+
if (G_UNLIKELY(counter))
7575
{
7676
g_assert(!stats_counter_read_only(counter));
7777
atomic_gssize_inc(&counter->value);
@@ -81,7 +81,7 @@ stats_counter_inc(StatsCounterItem *counter)
8181
static inline void
8282
stats_counter_dec(StatsCounterItem *counter)
8383
{
84-
if (counter)
84+
if (G_UNLIKELY(counter))
8585
{
8686
g_assert(!stats_counter_read_only(counter));
8787
atomic_gssize_dec(&counter->value);

0 commit comments

Comments
 (0)