diff options
author | Kelvin Cheung <keguang.zhang@gmail.com> | 2017-08-23 17:00:58 +0800 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2017-09-15 18:31:12 +0300 |
commit | e1c46f8e296a730ed27141a33189185bb7dfd1b1 (patch) | |
tree | 115ae1de9b1c0ae123b1d00326c88b7e497fcda3 /platform/linux-generic/arch/x86 | |
parent | 054306373ed6aa7a65a160d11ca339b24cf9c662 (diff) |
linux-gen: system: correctly set CPU frequency
When CPU frequency info under /sys is available,
use the real value instead of default value.
Signed-off-by: Kelvin Cheung <keguang.zhang@gmail.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic/arch/x86')
-rw-r--r-- | platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c index f7918d408..55bbda8c4 100644 --- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c @@ -41,42 +41,6 @@ int cpuinfo_parser(FILE *file, system_info_t *sysinfo) return 0; } -uint64_t odp_cpu_hz_current(int id) -{ - char str[1024]; - FILE *file; - int cpu; - char *pos; - double mhz = 0.0; - - file = fopen("/proc/cpuinfo", "rt"); - - /* find the correct processor instance */ - while (fgets(str, sizeof(str), file) != NULL) { - pos = strstr(str, "processor"); - if (pos) { - if (sscanf(pos, "processor : %d", &cpu) == 1) - if (cpu == id) - break; - } - } - - /* extract the cpu current speed */ - while (fgets(str, sizeof(str), file) != NULL) { - pos = strstr(str, "cpu MHz"); - if (pos) { - if (sscanf(pos, "cpu MHz : %lf", &mhz) == 1) - break; - } - } - - fclose(file); - if (mhz) - return (uint64_t)(mhz * 1000000.0); - - return 0; -} - void sys_info_print_arch(void) { cpu_flags_print_all(); |