From 92be31d0b583b42dee21f006ea62f231ad132326 Mon Sep 17 00:00:00 2001 From: markm Date: Tue, 21 Nov 2000 19:55:21 +0000 Subject: Add a consistent API to a feature that most modern CPUs have; a fast counter register in-CPU. This is to be used as a fast "timer", where linearity is more important than time, and multiple lines in the linearity caused by multiple CPUs in an SMP machine is not a problem. This adds no code whatsoever to the FreeBSD kernel until it is actually used, and then as a single-instruction inline routine (except for the 80386 and 80486 where it is some more inline code around nanotime(9). Reviewed by: bde, kris, jhb --- sys/alpha/include/cpu.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sys/alpha/include') diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h index a45b4d1..a0be38f 100644 --- a/sys/alpha/include/cpu.h +++ b/sys/alpha/include/cpu.h @@ -173,6 +173,16 @@ void syscall __P((u_int64_t, struct trapframe *)); void trap __P((unsigned long, unsigned long, unsigned long, unsigned long, struct trapframe *)); +/* + * Return contents of in-cpu fast counter as a sort of "bogo-time" + * for non-critical timing. + */ +static __inline u_int64_t +get_cyclecount(void) +{ + return (alpha_rpcc()); +} + #endif /* _KERNEL */ #endif /* _ALPHA_CPU_H_ */ -- cgit v1.1