[API,NEXT,v5,09/17] api: sysinfo: add new API to get per-CPU current frequency

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

Commit Message

hongbo.zhang@freescale.com Sept. 15, 2015, 1:55 p.m.
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(+)

Patch

diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
index 4ec59b4..89d7e42 100644
--- a/include/odp/api/cpu.h
+++ b/include/odp/api/cpu.h
@@ -73,6 +73,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 ed61d36..aa32801 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -425,6 +425,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);