From owner-freebsd-bugs Sun Apr 1 10:50: 6 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 42D9037B71B for ; Sun, 1 Apr 2001 10:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f31Ho1904218; Sun, 1 Apr 2001 10:50:01 -0700 (PDT) (envelope-from gnats) Received: from nebula.cybercable.fr (d217.dhcp212-198-126.noos.fr [212.198.126.217]) by hub.freebsd.org (Postfix) with ESMTP id 089BE37B719 for ; Sun, 1 Apr 2001 10:49:45 -0700 (PDT) (envelope-from mux@qualys.com) Received: (from mux@localhost) by nebula.cybercable.fr (8.11.3/8.11.3) id f31Hn2200759; Sun, 1 Apr 2001 19:49:02 +0200 (CEST) (envelope-from mux) Message-Id: <200104011749.f31Hn2200759@nebula.cybercable.fr> Date: Sun, 1 Apr 2001 19:49:02 +0200 (CEST) From: Maxime Henrion Reply-To: mux@qualys.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: i386/26272: [PATCH] Adds a sysctl to get the cpu frequency Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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