diff options
author | 2004-02-28 18:12:21 +0000 | |
---|---|---|
committer | 2004-02-28 18:12:21 +0000 | |
commit | 5922251fb90ad83391a30e286b64761310ed6392 (patch) | |
tree | 938ca1e2708acccb5602e7f8583d71712414b5ac | |
parent | Fix macro definition if pf.conf example. Ok beck@ (diff) | |
download | wireguard-openbsd-5922251fb90ad83391a30e286b64761310ed6392.tar.xz wireguard-openbsd-5922251fb90ad83391a30e286b64761310ed6392.zip |
sysctl hw.cpuspeed output
-rw-r--r-- | sys/arch/amd64/amd64/identcpu.c | 18 | ||||
-rw-r--r-- | sys/arch/amd64/include/cpu.h | 3 |
2 files changed, 18 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/identcpu.c b/sys/arch/amd64/amd64/identcpu.c index f843aedf085..2f8fda8d2f8 100644 --- a/sys/arch/amd64/amd64/identcpu.c +++ b/sys/arch/amd64/amd64/identcpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: identcpu.c,v 1.3 2004/02/27 21:21:44 grange Exp $ */ +/* $OpenBSD: identcpu.c,v 1.4 2004/02/28 18:12:21 deraadt Exp $ */ /* $NetBSD: identcpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */ /* @@ -36,13 +36,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/types.h> +#include <sys/param.h> #include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/proc.h> +#include <sys/user.h> +#include <sys/sysctl.h> #include <machine/cpu.h> #include <machine/cpufunc.h> /* sysctl wants this. */ char cpu_model[48]; +int cpuspeed; const struct { u_int32_t bit; @@ -88,6 +93,13 @@ const struct { { CPUID_3DNOW, "3DNOW" } }; +int +cpu_amd64speed(int *freq) +{ + *freq = cpuspeed; + return (0); +} + void identifycpu(struct cpu_info *ci) { @@ -135,6 +147,8 @@ identifycpu(struct cpu_info *ci) if (ci->ci_tsc_freq != 0) printf(", %lu.%02lu MHz", (ci->ci_tsc_freq + 4999) / 1000000, ((ci->ci_tsc_freq + 4999) / 10000) % 100); + cpuspeed = (ci->ci_tsc_freq + 4999) / 1000000; + cpu_cpuspeed = cpu_amd64speed; printf("\n%s: ", ci->ci_dev->dv_xname); diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h index 219689caa93..953f2da6998 100644 --- a/sys/arch/amd64/include/cpu.h +++ b/sys/arch/amd64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.4 2004/02/25 00:16:41 deraadt Exp $ */ +/* $OpenBSD: cpu.h,v 1.5 2004/02/28 18:12:21 deraadt Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -277,6 +277,7 @@ void cc_microset(struct cpu_info *); /* identcpu.c */ void identifycpu(struct cpu_info *); +int cpu_amd64speed(int *); void cpu_probe_features(struct cpu_info *); /* machdep.c */ |