Yep, naming is not ideal, but it follows Posix timer API.
The rate is checked before converting it to "res".
But the "res" is better to round up after, as it's done in "[lng-odp] [PATCH 0/3]
correct limits validation"
I want to believe that this test is not hard for implementors and it can be
tuned if smth was missed.
On 06.01.16 17:09, Nicolas Morey-Chaisemartin wrote:
Just realized that resolution is a frequency, not a period. My bad !
Nicolas
On 01/06/2016 04:03 PM, Nicolas Morey-Chaisemartin wrote:
On 12/17/2015 04:29 PM, Ivan Khoronzhuk wrote:
This function is used to get resolution, test uses it to
check other APIs.
Signed-off-by: Ivan Khoronzhuk <[email protected]>
---
test/validation/time/time.c | 46 ++++++++++++++++++++++++++++++---------------
test/validation/time/time.h | 1 +
2 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/test/validation/time/time.c b/test/validation/time/time.c
index ce6666f..0fe8c5a 100644
--- a/test/validation/time/time.c
+++ b/test/validation/time/time.c
@@ -8,9 +8,12 @@
#include "odp_cunit_common.h"
#include "time.h"
-#define TOLERANCE 1
#define BUSY_LOOP_CNT 30000000 /* used for t > min resolution */
#define BUSY_LOOP_CNT_LONG 12000000000 /* used for t > 4 sec */
+#define MIN_TIME_RATE 32000
+#define MAX_TIME_RATE 15000000000
+
+static uint64_t res;
void time_test_odp_constants(void)
{
@@ -22,6 +25,18 @@ void time_test_odp_constants(void)
CU_ASSERT(ns == ODP_TIME_USEC_IN_NS);
}
+void time_test_res(void)
+{
+ uint64_t rate;
+
+ rate = odp_time_local_res();
+ CU_ASSERT(rate > MIN_TIME_RATE);
+ CU_ASSERT(rate < MAX_TIME_RATE);
+
+ res = ODP_TIME_SEC_IN_NS / rate;
+ res = res ? res : 1;
+}
+
Sorry. I'm a bit late on that.
Why can't the clock resolution be lower than 32000 ns ?
As long as resolution is > 0, and not "huge", shouldn't it be OK ?
Nicolas
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp
--
Regards,
Ivan Khoronzhuk
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp