From e35ae2d86ee49ebb90cbccb1d0a02178360065ae Mon Sep 17 00:00:00 2001 From: wes Date: Thu, 10 Apr 2003 07:05:24 +0000 Subject: 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 --- sys/i386/i386/identcpu.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sys/i386') 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); -- cgit v1.1