diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-02-28 18:12:22 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-02-28 18:12:22 +0000 |
commit | 421ecee5da527eef4104e83402290921ff6f7a86 (patch) | |
tree | d463db3189cdc8df5487deb4799fa7b8a257f951 /sys/arch | |
parent | 4eabce021a42e2be2ad36fcee2648c37cb7c584f (diff) |
sysctl hw.cpuspeed output
Diffstat (limited to 'sys/arch')
-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 */ |