summaryrefslogtreecommitdiff
path: root/kern/syscnt.h
diff options
context:
space:
mode:
Diffstat (limited to 'kern/syscnt.h')
-rw-r--r--kern/syscnt.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/kern/syscnt.h b/kern/syscnt.h
index 816aa4b..fb00b75 100644
--- a/kern/syscnt.h
+++ b/kern/syscnt.h
@@ -53,6 +53,12 @@ void syscnt_register(struct syscnt *syscnt, const char *name);
#ifdef ATOMIC_HAVE_64B_OPS
static inline void
+syscnt_set(struct syscnt *syscnt, uint64_t value)
+{
+ atomic_store(&syscnt->value, value, ATOMIC_RELAXED);
+}
+
+static inline void
syscnt_add(struct syscnt *syscnt, int64_t delta)
{
atomic_add(&syscnt->value, delta, ATOMIC_RELAXED);
@@ -67,6 +73,16 @@ syscnt_read(const struct syscnt *syscnt)
#else /* ATOMIC_HAVE_64B_OPS */
static inline void
+syscnt_set(struct syscnt *syscnt, uint64_t value)
+{
+ unsigned long flags;
+
+ spinlock_lock_intr_save(&syscnt->lock, &flags);
+ syscnt->value = value;
+ spinlock_unlock_intr_restore(&syscnt->lock, flags);
+}
+
+static inline void
syscnt_add(struct syscnt *syscnt, int64_t delta)
{
unsigned long flags;
@@ -114,6 +130,7 @@ void syscnt_info(const char *prefix);
/*
* This init operation provides :
* - registration of system counters
+ * - module fully initialized
*/
INIT_OP_DECLARE(syscnt_setup);