diff options
author | Hongbo Zhang <hongbo.zhang@linaro.org> | 2015-10-13 19:13:11 +0800 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2016-02-08 20:45:22 +0300 |
commit | edcadca528154e21b25199c0df6f156471ead7a9 (patch) | |
tree | fb30ebae3c065609b9dbb7b628065dc5bc8ed0f6 | |
parent | 391696e5b06238d0b1058290c0707679825db1e9 (diff) |
api: cpu: add new API to get per-CPU max frequency
This patch adds new API odp_cpu_hz_max_id() to get the
corresponding max frequency for each CPU indexed by CPU ID.
Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r-- | include/odp/api/cpu.h | 11 | ||||
-rw-r--r-- | platform/linux-generic/odp_system_info.c | 10 |
2 files changed, 20 insertions, 1 deletions
diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h index ff63daa02..22b61e8bc 100644 --- a/include/odp/api/cpu.h +++ b/include/odp/api/cpu.h @@ -84,6 +84,17 @@ uint64_t odp_cpu_hz(void); uint64_t odp_cpu_hz_max(void); /** + * Maximum CPU frequency of a CPU (in Hz) + * + * Returns maximum frequency of specified CPU + * + * @param id CPU ID + * + * @return CPU frequency in Hz + */ +uint64_t odp_cpu_hz_max_id(int id); + +/** * Current CPU cycle count * * Return current CPU cycle count. Cycle count may not be reset at ODP init diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index e105cab5e..e9c5898c7 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -379,7 +379,15 @@ uint64_t odp_cpu_hz(void) uint64_t odp_cpu_hz_max(void) { - return odp_global_data.system_info.cpu_hz[0]; + return odp_cpu_hz_max_id(0); +} + +uint64_t odp_cpu_hz_max_id(int id) +{ + if (id >= 0 && id < MAX_CPU_NUMBER) + return odp_global_data.system_info.cpu_hz[id]; + else + return -1; } uint64_t odp_sys_huge_page_size(void) |