Date: Sun, 1 Apr 2001 19:49:02 +0200 (CEST) From: Maxime Henrion <mux@qualys.com> To: FreeBSD-gnats-submit@freebsd.org Subject: i386/26272: [PATCH] Adds a sysctl to get the cpu frequency Message-ID: <200104011749.f31Hn2200759@nebula.cybercable.fr>
next in thread | raw e-mail | index | archive | help
>Number: 26272 >Category: i386 >Synopsis: Adds a sysctl to get the cpu frequency >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Apr 01 10:50:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Maxime Henrion >Release: FreeBSD 4.3-RC i386 >Organization: >Environment: System: FreeBSD nebula.cybercable.fr 4.3-RC FreeBSD 4.3-RC #14: Sun Apr 1 19:14:00 CEST 2001 mux@nebula.cybercable.fr:/usr/src/sys/compile/NEBULA i386 >Description: There are severl sysctl's that provide cpu information but none of them gives its frequency. >How-To-Repeat: >Fix: Patch for RELENG_4 : diff -cr /usr/src/sys/i386/i386/identcpu.c ./i386/i386/identcpu.c *** /usr/src/sys/i386/i386/identcpu.c Sat Sep 30 05:32:21 2000 --- ./i386/i386/identcpu.c Sun Apr 1 19:18:00 2001 *************** *** 86,91 **** --- 86,95 ---- SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, cpu_model, 0, "Machine model"); + static char cpu_freq[32] = "unknown"; + SYSCTL_STRING(_hw, HW_FREQUENCY, frequency, CTLFLAG_RD, + cpu_freq, 0, "Machine frequency"); + static struct cpu_nameclass i386_cpus[] = { { "Intel 80286", CPUCLASS_286 }, /* CPU_286 */ { "i386SX", CPUCLASS_386 }, /* CPU_386SX */ *************** *** 509,526 **** #endif #if defined(I586_CPU) case CPUCLASS_586: ! printf("%d.%02d-MHz ", (tsc_freq + 4999) / 1000000, ((tsc_freq + 4999) / 10000) % 100); ! printf("586"); break; #endif #if defined(I686_CPU) case CPUCLASS_686: ! printf("%d.%02d-MHz ", (tsc_freq + 4999) / 1000000, ((tsc_freq + 4999) / 10000) % 100); ! printf("686"); break; #endif default: --- 513,530 ---- #endif #if defined(I586_CPU) case CPUCLASS_586: ! sprintf(cpu_freq, "%d.%02d-MHz ", (tsc_freq + 4999) / 1000000, ((tsc_freq + 4999) / 10000) % 100); ! printf("%s586", cpu_freq); break; #endif #if defined(I686_CPU) case CPUCLASS_686: ! sprintf(cpu_freq, "%d.%02d-MHz ", (tsc_freq + 4999) / 1000000, ((tsc_freq + 4999) / 10000) % 100); ! printf("%s686", cpu_freq); break; #endif default: diff -cr /usr/src/sys/sys/sysctl.h ./sys/sysctl.h *** /usr/src/sys/sys/sysctl.h Thu Feb 22 10:29:42 2001 --- ./sys/sysctl.h Sun Apr 1 19:18:21 2001 *************** *** 416,421 **** --- 416,422 ---- #define HW_FLOATINGPT 10 /* int: has HW floating point? */ #define HW_MACHINE_ARCH 11 /* string: machine architecture */ #define HW_MAXID 12 /* number of valid hw ids */ + #define HW_FREQUENCY 13 /* cpu frequency */ #define CTL_HW_NAMES { \ { 0, 0 }, \ >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104011749.f31Hn2200759>