I have been thinking to move all cpu related calls from system_info.h to cpu.h. Originally the idea was that system_info.h calls would be slow path and cpu.h would be fast path. Anyway, it would be cleaner if all cpu calls are under cpu.h.
So these would be moved and renamed: /** * Current CPU frequency in Hz * * Returns current frequency of this CPU * * @return CPU frequency in Hz */ uint64_t odp_cpu_hz(void); /** * CPU model name * * Return CPU model name of this CPU * * @return Pointer to CPU model name string */ const char *odp_cpu_model_str(void); Then additional calls per CPU ID could be added in cpu.h (instead of e.g. odp_sys_cpu_model_str_amp() in system_info.h) /** * Current CPU frequency of a CPU (in Hz) * * Returns current frequency of the specified CPU * * @param id CPU ID * * @return CPU frequency in Hz */ uint64_t odp_cpu_id_hz(int id); /** * CPU model name of a CPU * * Return CPU model name of the specified CPU. * * @param id CPU ID * * @return Pointer to CPU model name string */ const char *odp_cpu_id_model_str(int id); /** * Maximum CPU frequency in Hz * * Returns maximum frequency of this CPU * * @return CPU frequency in Hz */ uint64_t odp_cpu_hz_max(void); /** * Maximum CPU frequency of a CPU (in Hz) * * Returns maximum frequency of the specified CPU * * @param id CPU ID * * @return CPU frequency in Hz */ uint64_t odp_cpu_id_hz_max(int id); Does this make sense? -Petri > -----Original Message----- > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of ext > hongbo.zh...@freescale.com > Sent: Thursday, July 02, 2015 1:45 PM > To: lng-odp@lists.linaro.org > Subject: [lng-odp] [API-NEXT PATCH v2 0/5] linux-generic: sysinfo: CPU > frequency API clean up > > From: Hongbo Zhang <hongbo.zh...@linaro.org> > > v1 -> v2 changes: > - separate original 1/3 patch to two > - add validation patch to test new APIs > - other minor updates upon review comments > > v1 notes: > The current API of getting CPU frequency is really ambiguous. > CPU has its max frequency, and if enabled, the current frequency may be > scaled from time to time, what's more, on some AMP platforms, cores are > heterogenous, they have different max and current frequencies. > > This patch set cleans up these above issues. > Patch 1/3 makes cpu_hz and model_str to be per-CPU data, then on AMP > system, it is possible to acquire data for each different CPU. > Patch 2/3 makes it clear that the cpu_hz stands for max CPU frequency > Patch 3/3 adds new API to get the current CPU frequency if needed. > > Due to lack of test platform, only x86 platform is implemented right now, > the others should follow up if this patch set is accepted. > > Hongbo Zhang (5): > linux-generic: sysinfo: make the model_str per-CPU data > linux-generic: sysinfo: make the cpu_hz per-CPU data > linux-generic: sysinfo: make cpu_hz stand for max CPU frequency > linux-generic: sysinfo: add API to get current CPU frequency > validation: add test for new per_CPU system APIs > > include/odp/api/system_info.h | 21 +++++ > platform/linux-generic/include/odp_internal.h | 6 +- > platform/linux-generic/odp_system_info.c | 127 +++++++++++++++++++-- > ----- > test/validation/ver_abt_log_dbg/odp_system.c | 28 ++++++ > 4 files changed, 149 insertions(+), 33 deletions(-) > > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp