- While we are spreading the counter(9) across network stack, more userland

tools would need to know about the counter_u64_t type. Allow to include
sys/counter.h from userspace.
- Utilize now defined type in kvm_counter_u64_fetch().

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
This commit is contained in:
Gleb Smirnoff 2013-10-15 10:05:37 +00:00
parent 84c1edcbad
commit 511b5fa590
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=256514
2 changed files with 5 additions and 1 deletions

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/pcpu.h>
#include <sys/sysctl.h>
#include <sys/counter.h>
#include <kvm.h>
#include <limits.h>
#include <stdlib.h>
@ -319,7 +320,8 @@ kvm_read_zpcpu(kvm_t *kd, void *buf, u_long base, size_t size, int cpu)
uint64_t
kvm_counter_u64_fetch(kvm_t *kd, u_long base)
{
uint64_t r, c;
counter_u64_t c;
uint64_t r;
if (mp_ncpus == 0)
if (_kvm_pcpu_init(kd) < 0)

View File

@ -31,6 +31,7 @@
typedef uint64_t *counter_u64_t;
#ifdef _KERNEL
#include <machine/counter.h>
counter_u64_t counter_u64_alloc(int);
@ -58,4 +59,5 @@ uint64_t counter_u64_fetch(counter_u64_t);
for (int i = 0; i < (n); i++) \
counter_u64_zero((a)[i]); \
} while (0)
#endif /* _KERNEL */
#endif /* ! __SYS_COUNTER_H__ */