diff options
author | wes <wes@FreeBSD.org> | 2003-04-10 07:05:24 +0000 |
---|---|---|
committer | wes <wes@FreeBSD.org> | 2003-04-10 07:05:24 +0000 |
commit | e35ae2d86ee49ebb90cbccb1d0a02178360065ae (patch) | |
tree | 5a30713f8af549b6e249eff09f9246613eeefed1 /sys/i386 | |
parent | a5a1d8dd1856f1d959ecc033a4663d7fc66a6a26 (diff) | |
download | FreeBSD-src-e35ae2d86ee49ebb90cbccb1d0a02178360065ae.zip FreeBSD-src-e35ae2d86ee49ebb90cbccb1d0a02178360065ae.tar.gz |
Add a sysctl that records and reports the CPU clock rate calculated
at boot. Funny how often this trivial piece of information crops up
in embedded boxen.
Sponsored by: St. Bernard Software
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/identcpu.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c index fed5ec0..45e65ee 100644 --- a/sys/i386/i386/identcpu.c +++ b/sys/i386/i386/identcpu.c @@ -95,6 +95,10 @@ static char cpu_model[128]; SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, cpu_model, 0, "Machine model"); +static int hw_clockrate; +SYSCTL_INT(_hw, OID_AUTO, clockrate, CTLFLAG_RD, + &hw_clockrate, 0, "CPU instruction clock rate"); + #if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU) static char cpu_brand[48]; @@ -568,6 +572,7 @@ printcpuinfo(void) #endif #if defined(I586_CPU) case CPUCLASS_586: + hw_clockrate = (tsc_freq + 5000) / 1000000; printf("%jd.%02d-MHz ", (intmax_t)(tsc_freq + 4999) / 1000000, (u_int)((tsc_freq + 4999) / 10000) % 100); @@ -576,6 +581,7 @@ printcpuinfo(void) #endif #if defined(I686_CPU) case CPUCLASS_686: + hw_clockrate = (tsc_freq + 5000) / 1000000; printf("%jd.%02d-MHz ", (intmax_t)(tsc_freq + 4999) / 1000000, (u_int)((tsc_freq + 4999) / 10000) % 100); |