From b05a2d987d60d61235918c08370cb9d2f6144a19 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Sat, 10 Aug 1996 06:35:35 +0000 Subject: [PATCH] Trivial cosmetic tweak to make the i[56]86 CPU MHz reprting round to the nearest .01 Mhz rather than simply truncating it downwards. This hack makes this 89.999928 Mhz clock correctly round to the closer 90.00-MHz rather than 89.99-MHz: > i586 clock: 89999928 Hz, i8254 clock: 1193152 Hz > CPU: Pentium (90.00-MHz 586-class CPU) --- sys/amd64/amd64/identcpu.c | 8 +++++--- sys/i386/i386/identcpu.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c index d5acc8db20d7..5ae7c1fec5ab 100644 --- a/sys/amd64/amd64/identcpu.c +++ b/sys/amd64/amd64/identcpu.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp - * $Id: identcpu.c,v 1.1 1996/07/08 19:44:38 wollman Exp $ + * $Id: identcpu.c,v 1.2 1996/08/02 21:15:47 bde Exp $ */ #include @@ -169,14 +169,16 @@ identifycpu(void) #if defined(I586_CPU) case CPUCLASS_586: printf("%d.%02d-MHz ", - i586_ctr_freq / 1000000, (i586_ctr_freq / 10000) % 100); + (i586_ctr_freq + 4999) / 1000000, + ((i586_ctr_freq + 4999) / 10000) % 100); printf("586"); break; #endif #if defined(I686_CPU) case CPUCLASS_686: printf("%d.%02d-MHz ", - i586_ctr_freq / 1000000, (i586_ctr_freq / 10000) % 100); + (i586_ctr_freq + 4999) / 1000000, + ((i586_ctr_freq + 4999) / 10000) % 100); printf("686"); break; #endif diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c index d5acc8db20d7..5ae7c1fec5ab 100644 --- a/sys/i386/i386/identcpu.c +++ b/sys/i386/i386/identcpu.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp - * $Id: identcpu.c,v 1.1 1996/07/08 19:44:38 wollman Exp $ + * $Id: identcpu.c,v 1.2 1996/08/02 21:15:47 bde Exp $ */ #include @@ -169,14 +169,16 @@ identifycpu(void) #if defined(I586_CPU) case CPUCLASS_586: printf("%d.%02d-MHz ", - i586_ctr_freq / 1000000, (i586_ctr_freq / 10000) % 100); + (i586_ctr_freq + 4999) / 1000000, + ((i586_ctr_freq + 4999) / 10000) % 100); printf("586"); break; #endif #if defined(I686_CPU) case CPUCLASS_686: printf("%d.%02d-MHz ", - i586_ctr_freq / 1000000, (i586_ctr_freq / 10000) % 100); + (i586_ctr_freq + 4999) / 1000000, + ((i586_ctr_freq + 4999) / 10000) % 100); printf("686"); break; #endif