When counter reaches it's counter value, the next clock cycle will cause it to roll over to zero. As result the counter spends 1 additional cycle to switch from UINT64_MAX to 0, it should be taken into account with diff function.
Signed-off-by: Ivan Khoronzhuk <ivan.khoronz...@linaro.org> --- platform/linux-generic/include/odp_cpu_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/include/odp_cpu_internal.h b/platform/linux-generic/include/odp_cpu_internal.h index 28a0a84..5eeabef 100644 --- a/platform/linux-generic/include/odp_cpu_internal.h +++ b/platform/linux-generic/include/odp_cpu_internal.h @@ -19,7 +19,7 @@ uint64_t _odp_cpu_cycles_diff(uint64_t c1, uint64_t c2) if (odp_likely(c2 >= c1)) return c2 - c1; - return c2 + (odp_cpu_cycles_max() - c1); + return c2 + (odp_cpu_cycles_max() - c1) + 1; } #ifdef __cplusplus -- 1.9.1 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp