diff options
author | Richard Braun <rbraun@sceen.net> | 2014-05-13 20:54:14 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2014-05-13 20:54:14 +0200 |
commit | e097916b966ae4eee8f650f56bf070e9859e1cec (patch) | |
tree | d76f7f85864b46f18e0321a561998ea0320d000f | |
parent | 6a47a76608d41b6250547b4b33d883efb8a9e42c (diff) |
kern/evcnt: new evcnt_read function
-rw-r--r-- | kern/evcnt.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/kern/evcnt.h b/kern/evcnt.h index aa49ca2b..33e6b398 100644 --- a/kern/evcnt.h +++ b/kern/evcnt.h @@ -56,10 +56,7 @@ void evcnt_register(struct evcnt *evcnt, const char *name); * Increment the given counter. * * It is the responsibility of the caller to synchronize access to the - * counter. In addition, since counters are 64-bits wide, retrieving them - * on 32-bits systems might return invalid values, although this should be - * very rare. As long as users don't rely on them for critical operations, - * this is completely harmless. + * counter. */ static inline void evcnt_inc(struct evcnt *evcnt) @@ -68,6 +65,19 @@ evcnt_inc(struct evcnt *evcnt) } /* + * Obtain the current value of the given counter. + * + * Since counters are 64-bits wide, retrieving them on 32-bits systems might + * return invalid values, although this should be very rare. As long as users + * don't rely on them for critical operations, this is completely harmless. + */ +static inline unsigned long long +evcnt_read(const struct evcnt *evcnt) +{ + return evcnt->count; +} + +/* * Display the registered event counters. */ void evcnt_info(void); |