diff mbox

[v2,1/5] example: timer: print timer ticks/ns table instead of cycles/ns

Message ID 1441965889-15727-2-git-send-email-ivan.khoronzhuk@linaro.org
State Superseded
Headers show

Commit Message

Ivan Khoronzhuk Sept. 11, 2015, 10:04 a.m. UTC
The timer API can have nothing common with CPU cycles or time API.
Thus timer test shouldn't print here conversion cycles/ns table.
More correct to print here conversion table for timer ticks/ns.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 example/timer/odp_timer_test.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

Comments

Ivan Khoronzhuk Sept. 15, 2015, 8:40 a.m. UTC | #1
Ola,

Could you please review this patch.

On 11.09.15 13:04, Ivan Khoronzhuk wrote:
> The timer API can have nothing common with CPU cycles or time API.
> Thus timer test shouldn't print here conversion cycles/ns table.
> More correct to print here conversion table for timer ticks/ns.
>
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> ---
>   example/timer/odp_timer_test.c | 22 +++++++++++-----------
>   1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
> index 49630b0..3aa0f51 100644
> --- a/example/timer/odp_timer_test.c
> +++ b/example/timer/odp_timer_test.c
> @@ -322,7 +322,7 @@ int main(int argc, char *argv[])
>   	odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>   	int num_workers;
>   	odp_queue_t queue;
> -	uint64_t cycles, ns;
> +	uint64_t tick, ns;
>   	odp_queue_param_t param;
>   	odp_pool_param_t params;
>   	odp_timer_pool_param_t tparams;
> @@ -447,21 +447,21 @@ int main(int argc, char *argv[])
>   	}
>
>   	printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz());
> -	printf("Cycles vs nanoseconds:\n");
> +	printf("Timer ticks vs nanoseconds:\n");
>   	ns = 0;
> -	cycles = odp_time_ns_to_cycles(ns);
> +	tick = odp_timer_ns_to_tick(gbls->tp, ns);
>
> -	printf("  %12"PRIu64" ns      ->  %12"PRIu64" cycles\n", ns, cycles);
> -	printf("  %12"PRIu64" cycles  ->  %12"PRIu64" ns\n", cycles,
> -	       odp_time_cycles_to_ns(cycles));
> +	printf("  %12" PRIu64 " ns      ->  %12" PRIu64 " ticks\n", ns, tick);
> +	printf("  %12" PRIu64 " ticks   ->  %12" PRIu64 " ns\n", tick,
> +	       odp_timer_tick_to_ns(gbls->tp, tick));
>
>   	for (ns = 1; ns <= 100*ODP_TIME_SEC; ns *= 10) {
> -		cycles = odp_time_ns_to_cycles(ns);
> +		tick = odp_timer_ns_to_tick(gbls->tp, ns);
>
> -		printf("  %12"PRIu64" ns      ->  %12"PRIu64" cycles\n", ns,
> -		       cycles);
> -		printf("  %12"PRIu64" cycles  ->  %12"PRIu64" ns\n", cycles,
> -		       odp_time_cycles_to_ns(cycles));
> +		printf("  %12" PRIu64 " ns      ->  %12" PRIu64 " ticks\n", ns,
> +		       tick);
> +		printf("  %12" PRIu64 " ticks   ->  %12" PRIu64 " ns\n", tick,
> +		       odp_timer_tick_to_ns(gbls->tp, tick));
>   	}
>
>   	printf("\n");
>
diff mbox

Patch

diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 49630b0..3aa0f51 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -322,7 +322,7 @@  int main(int argc, char *argv[])
 	odph_linux_pthread_t thread_tbl[MAX_WORKERS];
 	int num_workers;
 	odp_queue_t queue;
-	uint64_t cycles, ns;
+	uint64_t tick, ns;
 	odp_queue_param_t param;
 	odp_pool_param_t params;
 	odp_timer_pool_param_t tparams;
@@ -447,21 +447,21 @@  int main(int argc, char *argv[])
 	}
 
 	printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz());
-	printf("Cycles vs nanoseconds:\n");
+	printf("Timer ticks vs nanoseconds:\n");
 	ns = 0;
-	cycles = odp_time_ns_to_cycles(ns);
+	tick = odp_timer_ns_to_tick(gbls->tp, ns);
 
-	printf("  %12"PRIu64" ns      ->  %12"PRIu64" cycles\n", ns, cycles);
-	printf("  %12"PRIu64" cycles  ->  %12"PRIu64" ns\n", cycles,
-	       odp_time_cycles_to_ns(cycles));
+	printf("  %12" PRIu64 " ns      ->  %12" PRIu64 " ticks\n", ns, tick);
+	printf("  %12" PRIu64 " ticks   ->  %12" PRIu64 " ns\n", tick,
+	       odp_timer_tick_to_ns(gbls->tp, tick));
 
 	for (ns = 1; ns <= 100*ODP_TIME_SEC; ns *= 10) {
-		cycles = odp_time_ns_to_cycles(ns);
+		tick = odp_timer_ns_to_tick(gbls->tp, ns);
 
-		printf("  %12"PRIu64" ns      ->  %12"PRIu64" cycles\n", ns,
-		       cycles);
-		printf("  %12"PRIu64" cycles  ->  %12"PRIu64" ns\n", cycles,
-		       odp_time_cycles_to_ns(cycles));
+		printf("  %12" PRIu64 " ns      ->  %12" PRIu64 " ticks\n", ns,
+		       tick);
+		printf("  %12" PRIu64 " ticks   ->  %12" PRIu64 " ns\n", tick,
+		       odp_timer_tick_to_ns(gbls->tp, tick));
 	}
 
 	printf("\n");