[newlib-cygwin] fhandler_proc.cc(format_proc_cpuinfo): round cpu MHz

Ken Brown kbrown@sourceware.org
Mon Oct 7 19:55:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=70e834ea7c970dd9bf98167e0cf7d4d7c643a225

commit 70e834ea7c970dd9bf98167e0cf7d4d7c643a225
Author: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Date:   Mon Oct 7 10:23:01 2019 -0600

    fhandler_proc.cc(format_proc_cpuinfo): round cpu MHz
    
    Round cpu MHz to correct Windows and match Linux cpuinfo.

Diff:
---
 winsup/cygwin/fhandler_proc.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc
index c94cde9..86c1f62 100644
--- a/winsup/cygwin/fhandler_proc.cc
+++ b/winsup/cygwin/fhandler_proc.cc
@@ -695,6 +695,7 @@ format_proc_cpuinfo (void *, char *&destbuf)
 
       RtlQueryRegistryValues (RTL_REGISTRY_ABSOLUTE, cpu_key, tab,
 			      NULL, NULL);
+      cpu_mhz = ((cpu_mhz - 1) / 10 + 1) * 10;	/* round up to multiple of 10 */
       bufptr += __small_sprintf (bufptr, "processor\t: %d\n", cpu_number);
       uint32_t maxf, vendor_id[4], unused;



More information about the Cygwin-cvs mailing list