Top | ![]() |
![]() |
![]() |
![]() |
guint | dzl_get_current_cpu_rdtscp () |
#define | dzl_get_current_cpu |
#define | DZL_DEFINE_COUNTER() |
#define | DZL_COUNTER_INC() |
#define | DZL_COUNTER_DEC() |
#define | DZL_COUNTER_SUB() |
#define | DZL_COUNTER_ADD() |
void | (*DzlCounterForeachFunc) () |
#define DZL_DEFINE_COUNTER(Identifier, Category, Name, Description)
1 |
DZL_DEFINE_COUNTER (my_counter, "My", "Counter", "My Counter Description"); |
#define DZL_COUNTER_INC(Identifier) DZL_COUNTER_ADD(Identifier, G_GINT64_CONSTANT(1))
Increments the counter Identifier
by 1.
#define DZL_COUNTER_DEC(Identifier) DZL_COUNTER_SUB(Identifier, G_GINT64_CONSTANT(1))
Decrements the counter Identifier
by 1.
#define DZL_COUNTER_SUB(Identifier, Count) DZL_COUNTER_ADD(Identifier, (-(Count)))
Subtracts from the counter identified by Identifier
by Count
.
#define DZL_COUNTER_ADD(Identifier, Count)
Adds Count
to Identifier
.
This operation is not guaranteed to have full correctness. It tries to find
a happy medium between fast, and accurate. When possible, the rdtscp
instruction is used to get a cacheline owned by the executing CPU, to avoid
collisions. However, this is not guaranteed as the thread could be swapped
between the calls to rdtscp
and addq
(on 64-bit Intel).
Other platforms have fallbacks which may give different guarantees, such as using atomic operations (and therefore, memory barriers).
See DzlCounter for more information.
void (*DzlCounterForeachFunc) (DzlCounter *counter
,gpointer user_data
);
Function prototype for callbacks provided to dzl_counter_arena_foreach()
.