diff mbox

[API,NEXT,v7,09/14] api: cpu: add new API to get per-CPU current frequency

Message ID 1444734798-29063-10-git-send-email-hongbo.zhang@freescale.com
State New
Headers show

Commit Message

hongbo.zhang@freescale.com Oct. 13, 2015, 11:13 a.m. UTC
From: Hongbo Zhang <hongbo.zhang@linaro.org>

Previous odp_cpu_hz() is adapted to return the current frequency,
this patch adds sibling version odp_cpu_hz_id() to return current
frequency of CPU specified by parameter CPU ID.

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
---
 include/odp/api/cpu.h                    | 11 +++++++++++
 platform/linux-generic/odp_system_info.c |  5 +++++
 2 files changed, 16 insertions(+)
diff mbox

Patch

diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
index 7eb326d..80d2638 100644
--- a/include/odp/api/cpu.h
+++ b/include/odp/api/cpu.h
@@ -75,6 +75,17 @@  const char *odp_cpu_model_str_id(int id);
 uint64_t odp_cpu_hz(void);
 
 /**
+ * Current CPU frequency of a CPU (in Hz)
+ *
+ * Returns current frequency of specified CPU
+ *
+ * @param id    CPU ID
+ *
+ * @return CPU frequency in Hz
+ */
+uint64_t odp_cpu_hz_id(int id);
+
+/**
  * Maximum CPU frequency in Hz
  *
  * Returns maximum frequency of this CPU
diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
index 385a7d0..8bd1584 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -422,6 +422,11 @@  uint64_t odp_cpu_hz(void)
 	return arch_cpu_hz_current(id);
 }
 
+uint64_t odp_cpu_hz_id(int id)
+{
+	return arch_cpu_hz_current(id);
+}
+
 uint64_t odp_cpu_hz_max(void)
 {
 	return odp_cpu_hz_max_id(0);