aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/counter.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/sys/counter.h')
-rw-r--r--sys/sys/counter.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/sys/counter.h b/sys/sys/counter.h
index ee500b5b078a..ec5cbfe9d36b 100644
--- a/sys/sys/counter.h
+++ b/sys/sys/counter.h
@@ -39,4 +39,23 @@ void counter_u64_free(counter_u64_t);
void counter_u64_zero(counter_u64_t);
uint64_t counter_u64_fetch(counter_u64_t);
+#define COUNTER_ARRAY_ALLOC(a, n, wait) do { \
+ for (int i = 0; i < (n); i++) \
+ (a)[i] = counter_u64_alloc(wait); \
+} while (0)
+
+#define COUNTER_ARRAY_FREE(a, n) do { \
+ for (int i = 0; i < (n); i++) \
+ counter_u64_free((a)[i]); \
+} while (0)
+
+#define COUNTER_ARRAY_COPY(a, dstp, n) do { \
+ for (int i = 0; i < (n); i++) \
+ ((uint64_t *)(dstp))[i] = counter_u64_fetch((a)[i]);\
+} while (0)
+
+#define COUNTER_ARRAY_ZERO(a, n) do { \
+ for (int i = 0; i < (n); i++) \
+ counter_u64_zero((a)[i]); \
+} while (0)
#endif /* ! __SYS_COUNTER_H__ */