diff mbox

[API-NEXT] api: cpu: change order of arguments for diff function

Message ID 1446739236-15149-1-git-send-email-ivan.khoronzhuk@linaro.org
State Accepted
Commit e56a592c7e074872aa1d818c3f12782f6f22047a
Headers show

Commit Message

Ivan Khoronzhuk Nov. 5, 2015, 4 p.m. UTC
It's more convenient to pass parameters in order, like t2 - t1,
when t2 is supposed to be more. Also it's needed to keep in sync
with time API which uses same order.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---

Based on series:
"[lng-odp] [API-NEXT PATCH v7 0/6] api: time: unbind CPU cycles from time API"
https://lists.linaro.org/pipermail/lng-odp/2015-November/016962.html

 include/odp/api/cpu.h                             |  4 ++--
 platform/linux-generic/include/odp_cpu_internal.h |  2 +-
 platform/linux-generic/odp_cpu.c                  |  4 ++--
 platform/linux-generic/odp_time.c                 |  2 +-
 test/performance/odp_scheduling.c                 | 14 +++++++-------
 5 files changed, 13 insertions(+), 13 deletions(-)

Comments

Maxim Uvarov Nov. 9, 2015, 11:52 a.m. UTC | #1
Merged with small rebase, please check.

Maxim.

On 11/09/2015 12:16, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
>
>
>> -----Original Message-----
>> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of
>> EXT Ivan Khoronzhuk
>> Sent: Thursday, November 05, 2015 6:01 PM
>> To: lng-odp@lists.linaro.org
>> Subject: [lng-odp] [API-NEXT PATCH] api: cpu: change order of arguments
>> for diff function
>>
>> It's more convenient to pass parameters in order, like t2 - t1,
>> when t2 is supposed to be more. Also it's needed to keep in sync
>> with time API which uses same order.
>>
>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
>> ---
>>
>> Based on series:
>> "[lng-odp] [API-NEXT PATCH v7 0/6] api: time: unbind CPU cycles from
>> time API"
>> https://lists.linaro.org/pipermail/lng-odp/2015-November/016962.html
>>
>>   include/odp/api/cpu.h                             |  4 ++--
>>   platform/linux-generic/include/odp_cpu_internal.h |  2 +-
>>   platform/linux-generic/odp_cpu.c                  |  4 ++--
>>   platform/linux-generic/odp_time.c                 |  2 +-
>>   test/performance/odp_scheduling.c                 | 14 +++++++-------
>>   5 files changed, 13 insertions(+), 13 deletions(-)
>>
>> diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
>> index 80d2638..8a804d4 100644
>> --- a/include/odp/api/cpu.h
>> +++ b/include/odp/api/cpu.h
>> @@ -129,12 +129,12 @@ uint64_t odp_cpu_cycles(void);
>>    * first cycle count sample and c2 the second. The function handles
>> correctly
>>    * single cycle count wrap between c1 and c2.
>>    *
>> - * @param c1    First cycle count
>>    * @param c2    Second cycle count
>> + * @param c1    First cycle count
>>    *
>>    * @return CPU cycles from c1 to c2
>>    */
>> -uint64_t odp_cpu_cycles_diff(uint64_t c1, uint64_t c2);
>> +uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1);
>>
>>   /**
>>    * Maximum CPU cycle count
>> diff --git a/platform/linux-generic/include/odp_cpu_internal.h
>> b/platform/linux-generic/include/odp_cpu_internal.h
>> index 5eeabef..664e2df 100644
>> --- a/platform/linux-generic/include/odp_cpu_internal.h
>> +++ b/platform/linux-generic/include/odp_cpu_internal.h
>> @@ -14,7 +14,7 @@ extern "C" {
>>   #include <odp/cpu.h>
>>
>>   static inline
>> -uint64_t _odp_cpu_cycles_diff(uint64_t c1, uint64_t c2)
>> +uint64_t _odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
>>   {
>>   	if (odp_likely(c2 >= c1))
>>   		return c2 - c1;
>> diff --git a/platform/linux-generic/odp_cpu.c b/platform/linux-
>> generic/odp_cpu.c
>> index e5ec4f0..636f811 100644
>> --- a/platform/linux-generic/odp_cpu.c
>> +++ b/platform/linux-generic/odp_cpu.c
>> @@ -8,7 +8,7 @@
>>   #include <odp/hints.h>
>>   #include <odp_cpu_internal.h>
>>
>> -uint64_t odp_cpu_cycles_diff(uint64_t c1, uint64_t c2)
>> +uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
>>   {
>> -	return _odp_cpu_cycles_diff(c1, c2);
>> +	return _odp_cpu_cycles_diff(c2, c1);
>>   }
>> diff --git a/platform/linux-generic/odp_time.c b/platform/linux-
>> generic/odp_time.c
>> index 3c439c7..a2e4046 100644
>> --- a/platform/linux-generic/odp_time.c
>> +++ b/platform/linux-generic/odp_time.c
>> @@ -33,7 +33,7 @@ odp_time_t odp_time_local(void)
>>
>>   odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
>>   {
>> -	return tick_to_time(_odp_cpu_cycles_diff(t1, t2));
>> +	return tick_to_time(_odp_cpu_cycles_diff(t2, t1));
>>   }
>>
>>   uint64_t odp_time_to_ns(odp_time_t time)
>> diff --git a/test/performance/odp_scheduling.c
>> b/test/performance/odp_scheduling.c
>> index d08f253..5d17c47 100644
>> --- a/test/performance/odp_scheduling.c
>> +++ b/test/performance/odp_scheduling.c
>> @@ -199,7 +199,7 @@ static int test_alloc_single(int thr, odp_pool_t
>> pool)
>>   	}
>>
>>   	c2     = odp_cpu_cycles();
>> -	cycles = odp_cpu_cycles_diff(c1, c2);
>> +	cycles = odp_cpu_cycles_diff(c2, c1);
>>   	cycles = cycles / ALLOC_ROUNDS;
>>
>>   	printf("  [%i] alloc_sng alloc+free   %6" PRIu64 " CPU cycles\n",
>> @@ -239,7 +239,7 @@ static int test_alloc_multi(int thr, odp_pool_t
>> pool)
>>   	}
>>
>>   	c2     = odp_cpu_cycles();
>> -	cycles = odp_cpu_cycles_diff(c1, c2);
>> +	cycles = odp_cpu_cycles_diff(c2, c1);
>>   	cycles = cycles / (ALLOC_ROUNDS * MAX_ALLOCS);
>>
>>   	printf("  [%i] alloc_multi alloc+free %6" PRIu64 " CPU cycles\n",
>> @@ -310,7 +310,7 @@ static int test_poll_queue(int thr, odp_pool_t
>> msg_pool)
>>   	}
>>
>>   	c2     = odp_cpu_cycles();
>> -	cycles = odp_cpu_cycles_diff(c1, c2);
>> +	cycles = odp_cpu_cycles_diff(c2, c1);
>>   	cycles = cycles / QUEUE_ROUNDS;
>>
>>   	printf("  [%i] poll_queue enq+deq     %6" PRIu64 " CPU cycles\n",
>> @@ -382,7 +382,7 @@ static int test_schedule_single(const char *str,
>> int thr,
>>   	odp_schedule_resume();
>>
>>   	c2     = odp_cpu_cycles();
>> -	cycles = odp_cpu_cycles_diff(c1, c2);
>> +	cycles = odp_cpu_cycles_diff(c2, c1);
>>
>>   	odp_barrier_wait(barrier);
>>   	clear_sched_queues();
>> @@ -458,7 +458,7 @@ static int test_schedule_many(const char *str, int
>> thr,
>>   	odp_schedule_resume();
>>
>>   	c2     = odp_cpu_cycles();
>> -	cycles = odp_cpu_cycles_diff(c1, c2);
>> +	cycles = odp_cpu_cycles_diff(c2, c1);
>>
>>   	odp_barrier_wait(barrier);
>>   	clear_sched_queues();
>> @@ -574,7 +574,7 @@ static int test_schedule_multi(const char *str, int
>> thr,
>>
>>
>>   	c2     = odp_cpu_cycles();
>> -	cycles = odp_cpu_cycles_diff(c1, c2);
>> +	cycles = odp_cpu_cycles_diff(c2, c1);
>>
>>   	odp_barrier_wait(barrier);
>>   	clear_sched_queues();
>> @@ -745,7 +745,7 @@ static void test_cpu_freq(void)
>>   	else
>>   		nsec -= tp1.tv_nsec - tp2.tv_nsec;
>>
>> -	cycles     = odp_cpu_cycles_diff(c1, c2);
>> +	cycles     = odp_cpu_cycles_diff(c2, c1);
>>   	max_cycles = (nsec * odp_cpu_hz_max()) / 1000000000.0;
>>
>>   	/* Compare measured CPU cycles to maximum theoretical CPU cycle
>> count */
>> --
>> 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
Ivan Khoronzhuk Nov. 9, 2015, noon UTC | #2
Maxim, this is based on
"[lng-odp] [API-NEXT PATCH v7 0/6] api: time: unbind CPU cycles from time API"
as described below. It's applied w/o conflicts.

On 09.11.15 13:52, Maxim Uvarov wrote:
> Merged with small rebase, please check.
>
> Maxim.
>
> On 11/09/2015 12:16, Savolainen, Petri (Nokia - FI/Espoo) wrote:
>> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
>>
>>
>>> -----Original Message-----
>>> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of
>>> EXT Ivan Khoronzhuk
>>> Sent: Thursday, November 05, 2015 6:01 PM
>>> To: lng-odp@lists.linaro.org
>>> Subject: [lng-odp] [API-NEXT PATCH] api: cpu: change order of arguments
>>> for diff function
>>>
>>> It's more convenient to pass parameters in order, like t2 - t1,
>>> when t2 is supposed to be more. Also it's needed to keep in sync
>>> with time API which uses same order.
>>>
>>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
>>> ---
>>>
>>> Based on series:
>>> "[lng-odp] [API-NEXT PATCH v7 0/6] api: time: unbind CPU cycles from
>>> time API"
>>> https://lists.linaro.org/pipermail/lng-odp/2015-November/016962.html
>>>
>>>   include/odp/api/cpu.h                             |  4 ++--
>>>   platform/linux-generic/include/odp_cpu_internal.h |  2 +-
>>>   platform/linux-generic/odp_cpu.c                  |  4 ++--
>>>   platform/linux-generic/odp_time.c                 |  2 +-
>>>   test/performance/odp_scheduling.c                 | 14 +++++++-------
>>>   5 files changed, 13 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
>>> index 80d2638..8a804d4 100644
>>> --- a/include/odp/api/cpu.h
>>> +++ b/include/odp/api/cpu.h
>>> @@ -129,12 +129,12 @@ uint64_t odp_cpu_cycles(void);
>>>    * first cycle count sample and c2 the second. The function handles
>>> correctly
>>>    * single cycle count wrap between c1 and c2.
>>>    *
>>> - * @param c1    First cycle count
>>>    * @param c2    Second cycle count
>>> + * @param c1    First cycle count
>>>    *
>>>    * @return CPU cycles from c1 to c2
>>>    */
>>> -uint64_t odp_cpu_cycles_diff(uint64_t c1, uint64_t c2);
>>> +uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1);
>>>
>>>   /**
>>>    * Maximum CPU cycle count
>>> diff --git a/platform/linux-generic/include/odp_cpu_internal.h
>>> b/platform/linux-generic/include/odp_cpu_internal.h
>>> index 5eeabef..664e2df 100644
>>> --- a/platform/linux-generic/include/odp_cpu_internal.h
>>> +++ b/platform/linux-generic/include/odp_cpu_internal.h
>>> @@ -14,7 +14,7 @@ extern "C" {
>>>   #include <odp/cpu.h>
>>>
>>>   static inline
>>> -uint64_t _odp_cpu_cycles_diff(uint64_t c1, uint64_t c2)
>>> +uint64_t _odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
>>>   {
>>>       if (odp_likely(c2 >= c1))
>>>           return c2 - c1;
>>> diff --git a/platform/linux-generic/odp_cpu.c b/platform/linux-
>>> generic/odp_cpu.c
>>> index e5ec4f0..636f811 100644
>>> --- a/platform/linux-generic/odp_cpu.c
>>> +++ b/platform/linux-generic/odp_cpu.c
>>> @@ -8,7 +8,7 @@
>>>   #include <odp/hints.h>
>>>   #include <odp_cpu_internal.h>
>>>
>>> -uint64_t odp_cpu_cycles_diff(uint64_t c1, uint64_t c2)
>>> +uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
>>>   {
>>> -    return _odp_cpu_cycles_diff(c1, c2);
>>> +    return _odp_cpu_cycles_diff(c2, c1);
>>>   }
>>> diff --git a/platform/linux-generic/odp_time.c b/platform/linux-
>>> generic/odp_time.c
>>> index 3c439c7..a2e4046 100644
>>> --- a/platform/linux-generic/odp_time.c
>>> +++ b/platform/linux-generic/odp_time.c
>>> @@ -33,7 +33,7 @@ odp_time_t odp_time_local(void)
>>>
>>>   odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
>>>   {
>>> -    return tick_to_time(_odp_cpu_cycles_diff(t1, t2));
>>> +    return tick_to_time(_odp_cpu_cycles_diff(t2, t1));
>>>   }
>>>
>>>   uint64_t odp_time_to_ns(odp_time_t time)
>>> diff --git a/test/performance/odp_scheduling.c
>>> b/test/performance/odp_scheduling.c
>>> index d08f253..5d17c47 100644
>>> --- a/test/performance/odp_scheduling.c
>>> +++ b/test/performance/odp_scheduling.c
>>> @@ -199,7 +199,7 @@ static int test_alloc_single(int thr, odp_pool_t
>>> pool)
>>>       }
>>>
>>>       c2     = odp_cpu_cycles();
>>> -    cycles = odp_cpu_cycles_diff(c1, c2);
>>> +    cycles = odp_cpu_cycles_diff(c2, c1);
>>>       cycles = cycles / ALLOC_ROUNDS;
>>>
>>>       printf("  [%i] alloc_sng alloc+free   %6" PRIu64 " CPU cycles\n",
>>> @@ -239,7 +239,7 @@ static int test_alloc_multi(int thr, odp_pool_t
>>> pool)
>>>       }
>>>
>>>       c2     = odp_cpu_cycles();
>>> -    cycles = odp_cpu_cycles_diff(c1, c2);
>>> +    cycles = odp_cpu_cycles_diff(c2, c1);
>>>       cycles = cycles / (ALLOC_ROUNDS * MAX_ALLOCS);
>>>
>>>       printf("  [%i] alloc_multi alloc+free %6" PRIu64 " CPU cycles\n",
>>> @@ -310,7 +310,7 @@ static int test_poll_queue(int thr, odp_pool_t
>>> msg_pool)
>>>       }
>>>
>>>       c2     = odp_cpu_cycles();
>>> -    cycles = odp_cpu_cycles_diff(c1, c2);
>>> +    cycles = odp_cpu_cycles_diff(c2, c1);
>>>       cycles = cycles / QUEUE_ROUNDS;
>>>
>>>       printf("  [%i] poll_queue enq+deq     %6" PRIu64 " CPU cycles\n",
>>> @@ -382,7 +382,7 @@ static int test_schedule_single(const char *str,
>>> int thr,
>>>       odp_schedule_resume();
>>>
>>>       c2     = odp_cpu_cycles();
>>> -    cycles = odp_cpu_cycles_diff(c1, c2);
>>> +    cycles = odp_cpu_cycles_diff(c2, c1);
>>>
>>>       odp_barrier_wait(barrier);
>>>       clear_sched_queues();
>>> @@ -458,7 +458,7 @@ static int test_schedule_many(const char *str, int
>>> thr,
>>>       odp_schedule_resume();
>>>
>>>       c2     = odp_cpu_cycles();
>>> -    cycles = odp_cpu_cycles_diff(c1, c2);
>>> +    cycles = odp_cpu_cycles_diff(c2, c1);
>>>
>>>       odp_barrier_wait(barrier);
>>>       clear_sched_queues();
>>> @@ -574,7 +574,7 @@ static int test_schedule_multi(const char *str, int
>>> thr,
>>>
>>>
>>>       c2     = odp_cpu_cycles();
>>> -    cycles = odp_cpu_cycles_diff(c1, c2);
>>> +    cycles = odp_cpu_cycles_diff(c2, c1);
>>>
>>>       odp_barrier_wait(barrier);
>>>       clear_sched_queues();
>>> @@ -745,7 +745,7 @@ static void test_cpu_freq(void)
>>>       else
>>>           nsec -= tp1.tv_nsec - tp2.tv_nsec;
>>>
>>> -    cycles     = odp_cpu_cycles_diff(c1, c2);
>>> +    cycles     = odp_cpu_cycles_diff(c2, c1);
>>>       max_cycles = (nsec * odp_cpu_hz_max()) / 1000000000.0;
>>>
>>>       /* Compare measured CPU cycles to maximum theoretical CPU cycle
>>> count */
>>> --
>>> 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
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
index 80d2638..8a804d4 100644
--- a/include/odp/api/cpu.h
+++ b/include/odp/api/cpu.h
@@ -129,12 +129,12 @@  uint64_t odp_cpu_cycles(void);
  * first cycle count sample and c2 the second. The function handles correctly
  * single cycle count wrap between c1 and c2.
  *
- * @param c1    First cycle count
  * @param c2    Second cycle count
+ * @param c1    First cycle count
  *
  * @return CPU cycles from c1 to c2
  */
-uint64_t odp_cpu_cycles_diff(uint64_t c1, uint64_t c2);
+uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1);
 
 /**
  * Maximum CPU cycle count
diff --git a/platform/linux-generic/include/odp_cpu_internal.h b/platform/linux-generic/include/odp_cpu_internal.h
index 5eeabef..664e2df 100644
--- a/platform/linux-generic/include/odp_cpu_internal.h
+++ b/platform/linux-generic/include/odp_cpu_internal.h
@@ -14,7 +14,7 @@  extern "C" {
 #include <odp/cpu.h>
 
 static inline
-uint64_t _odp_cpu_cycles_diff(uint64_t c1, uint64_t c2)
+uint64_t _odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
 {
 	if (odp_likely(c2 >= c1))
 		return c2 - c1;
diff --git a/platform/linux-generic/odp_cpu.c b/platform/linux-generic/odp_cpu.c
index e5ec4f0..636f811 100644
--- a/platform/linux-generic/odp_cpu.c
+++ b/platform/linux-generic/odp_cpu.c
@@ -8,7 +8,7 @@ 
 #include <odp/hints.h>
 #include <odp_cpu_internal.h>
 
-uint64_t odp_cpu_cycles_diff(uint64_t c1, uint64_t c2)
+uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
 {
-	return _odp_cpu_cycles_diff(c1, c2);
+	return _odp_cpu_cycles_diff(c2, c1);
 }
diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c
index 3c439c7..a2e4046 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -33,7 +33,7 @@  odp_time_t odp_time_local(void)
 
 odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
 {
-	return tick_to_time(_odp_cpu_cycles_diff(t1, t2));
+	return tick_to_time(_odp_cpu_cycles_diff(t2, t1));
 }
 
 uint64_t odp_time_to_ns(odp_time_t time)
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index d08f253..5d17c47 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -199,7 +199,7 @@  static int test_alloc_single(int thr, odp_pool_t pool)
 	}
 
 	c2     = odp_cpu_cycles();
-	cycles = odp_cpu_cycles_diff(c1, c2);
+	cycles = odp_cpu_cycles_diff(c2, c1);
 	cycles = cycles / ALLOC_ROUNDS;
 
 	printf("  [%i] alloc_sng alloc+free   %6" PRIu64 " CPU cycles\n",
@@ -239,7 +239,7 @@  static int test_alloc_multi(int thr, odp_pool_t pool)
 	}
 
 	c2     = odp_cpu_cycles();
-	cycles = odp_cpu_cycles_diff(c1, c2);
+	cycles = odp_cpu_cycles_diff(c2, c1);
 	cycles = cycles / (ALLOC_ROUNDS * MAX_ALLOCS);
 
 	printf("  [%i] alloc_multi alloc+free %6" PRIu64 " CPU cycles\n",
@@ -310,7 +310,7 @@  static int test_poll_queue(int thr, odp_pool_t msg_pool)
 	}
 
 	c2     = odp_cpu_cycles();
-	cycles = odp_cpu_cycles_diff(c1, c2);
+	cycles = odp_cpu_cycles_diff(c2, c1);
 	cycles = cycles / QUEUE_ROUNDS;
 
 	printf("  [%i] poll_queue enq+deq     %6" PRIu64 " CPU cycles\n",
@@ -382,7 +382,7 @@  static int test_schedule_single(const char *str, int thr,
 	odp_schedule_resume();
 
 	c2     = odp_cpu_cycles();
-	cycles = odp_cpu_cycles_diff(c1, c2);
+	cycles = odp_cpu_cycles_diff(c2, c1);
 
 	odp_barrier_wait(barrier);
 	clear_sched_queues();
@@ -458,7 +458,7 @@  static int test_schedule_many(const char *str, int thr,
 	odp_schedule_resume();
 
 	c2     = odp_cpu_cycles();
-	cycles = odp_cpu_cycles_diff(c1, c2);
+	cycles = odp_cpu_cycles_diff(c2, c1);
 
 	odp_barrier_wait(barrier);
 	clear_sched_queues();
@@ -574,7 +574,7 @@  static int test_schedule_multi(const char *str, int thr,
 
 
 	c2     = odp_cpu_cycles();
-	cycles = odp_cpu_cycles_diff(c1, c2);
+	cycles = odp_cpu_cycles_diff(c2, c1);
 
 	odp_barrier_wait(barrier);
 	clear_sched_queues();
@@ -745,7 +745,7 @@  static void test_cpu_freq(void)
 	else
 		nsec -= tp1.tv_nsec - tp2.tv_nsec;
 
-	cycles     = odp_cpu_cycles_diff(c1, c2);
+	cycles     = odp_cpu_cycles_diff(c2, c1);
 	max_cycles = (nsec * odp_cpu_hz_max()) / 1000000000.0;
 
 	/* Compare measured CPU cycles to maximum theoretical CPU cycle count */