Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/include Add functions to read the TSC and Perf...



details:   https://anonhg.NetBSD.org/src/rev/a2f711acc043
branches:  trunk
changeset: 484218:a2f711acc043
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Mar 28 01:38:22 2000 +0000

description:
Add functions to read the TSC and Performance Counters.

diffstat:

 sys/arch/i386/include/cpufunc.h |  20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diffs (34 lines):

diff -r 3138a8cebd27 -r a2f711acc043 sys/arch/i386/include/cpufunc.h
--- a/sys/arch/i386/include/cpufunc.h   Tue Mar 28 01:25:00 2000 +0000
+++ b/sys/arch/i386/include/cpufunc.h   Tue Mar 28 01:38:22 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpufunc.h,v 1.17 2000/03/24 19:07:12 thorpej Exp $     */
+/*     $NetBSD: cpufunc.h,v 1.18 2000/03/28 01:38:22 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -185,6 +185,24 @@
        __asm __volatile("wbinvd");
 }
 
+static __inline u_int64_t
+rdtsc(void)
+{
+       u_int64_t rv;
+
+       __asm __volatile(".byte 0x0f, 0x31" : "=A" (rv));
+       return (rv);
+}
+
+static __inline u_int64_t
+rdpmc(u_int pmc)
+{
+       u_int64_t rv;
+
+       __asm __volatile(".byte 0x0f, 0x33" : "=A" (rv) : "c" (pmc));
+       return (rv);
+}
+
 /* Break into DDB/KGDB. */
 static __inline void
 breakpoint(void)



Home | Main Index | Thread Index | Old Index