This patch set modifies time implementation to use TSC when running on a x86 CPU that has invarint TSC CPU flag set. Otherwise, the same Linux system time is used as before. TSC is much more efficient both in performance and latency/jitter wise than Linux system call. This can be seen also with scheduler latency test which time stamps events with this API. All latency measurements (min, ave, max) improved significantly.
This is sent through api-next as cpu flags are printed through new system info print function for debugging purposes (to verify that invariant TSC flag is read correctly). Patch 3/8 causes two checkpatch errors due to code copied from DPDK. Both the macro and the ifdef cannot be changed, so errors should be ignored. v2: * Use ODP_PRINT instead of printf * Removed couple of time.hw.reserved set to zero. One remains since otherwise GCC suspects usage of unintialized variable (false warning). * Fixed install of new arch/x86/cpu_flag files v3: * patch 1/11: Remove odp_time_to_u64() as unnecessary, nsec time is u64 * patch 10/11: Slightly improved TSC frequency measument accuracy due to fewer but longer sample runs * patch 11/11: Lower odp_time_t memory footprint due to converting timespec to nsec time before storing into odp_time_t Petri Savolainen (11): api: time: remove odp_time_to_u64 from API api: system: added system info print linux-gen: cpu_flags: added x86 cpu flag read functions linux-gen: system: implement system info print test: validation: add odp_sys_info_print test test: sched_latency: use sys_info_print test: validation: rename time test header file test: validation: add time accuracy test linux-gen: time: use hw time counter when available linux-gen: time: improve x86 TSC freq measurement accuracy linux-gen: time: store timespec as nsec configure.ac | 1 + include/odp/api/spec/system_info.h | 9 + include/odp/api/spec/time.h | 13 - platform/Makefile.inc | 4 +- platform/linux-generic/Makefile.am | 5 + platform/linux-generic/arch/arm/odp_cpu_arch.c | 16 + .../linux-generic/arch/arm/odp_sysinfo_parse.c | 4 + platform/linux-generic/arch/default/odp_cpu_arch.c | 16 + .../linux-generic/arch/default/odp_sysinfo_parse.c | 4 + platform/linux-generic/arch/mips64/odp_cpu_arch.c | 16 + .../linux-generic/arch/mips64/odp_sysinfo_parse.c | 4 + platform/linux-generic/arch/powerpc/odp_cpu_arch.c | 16 + .../linux-generic/arch/powerpc/odp_sysinfo_parse.c | 4 + platform/linux-generic/arch/x86/cpu_flags.c | 368 +++++++++++++++++++++ platform/linux-generic/arch/x86/cpu_flags.h | 20 ++ platform/linux-generic/arch/x86/odp_cpu_arch.c | 68 ++++ .../linux-generic/arch/x86/odp_sysinfo_parse.c | 6 + .../include/odp/api/plat/time_types.h | 19 +- platform/linux-generic/include/odp_internal.h | 1 + platform/linux-generic/include/odp_time_internal.h | 24 ++ platform/linux-generic/odp_system_info.c | 30 ++ platform/linux-generic/odp_time.c | 256 +++++++++----- test/common_plat/performance/odp_sched_latency.c | 18 +- test/common_plat/validation/api/system/system.c | 8 + test/common_plat/validation/api/system/system.h | 1 + test/common_plat/validation/api/time/Makefile.am | 2 +- test/common_plat/validation/api/time/time.c | 77 +++-- test/common_plat/validation/api/time/time_main.c | 2 +- .../validation/api/time/{time.h => time_test.h} | 2 - 29 files changed, 863 insertions(+), 151 deletions(-) create mode 100644 platform/linux-generic/arch/x86/cpu_flags.c create mode 100644 platform/linux-generic/arch/x86/cpu_flags.h create mode 100644 platform/linux-generic/include/odp_time_internal.h rename test/common_plat/validation/api/time/{time.h => time_test.h} (92%) -- 2.11.0