On 09/16/16 09:41, Savolainen, Petri (Nokia - FI/Espoo) wrote:

-----Original Message-----
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Maxim
Sent: Thursday, September 15, 2016 7:07 PM
To: lng-odp-forward <lng-odp@lists.linaro.org>
Subject: Re: [lng-odp] [API-NEXT PATCHv2] api: odp_time_sub

On 09/15/16 15:18, Maxim Uvarov wrote:
there is odp_time_diff(), forget about this patch.

Sorry, odp_time_diff() is for difference. odp_time_sub() still needed
for thing like calculate interval for execution.

Please review api patch.


Could you give an example. E.g. this kind of interval calculation does not need 

t1 = time();
t2 = t1 + wait_time;

while (time() < t2)

// now it's time to continue

Looks like I lost again. "diff" word is confusing for me:
 * Time difference
 * @param t2    Second time stamp
 * @param t1    First time stamp
 * @return Difference of time stamps
odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1);

In fact this function (at least in linux-generic) subtracts t1 from t2.
Assuming that t2 > t1.

I'm going to send proposal api patch to implement function:
int odp_schedule_stats(odp_schedule_stats_t *stats);
which will return times spend in and out scheduler. Later extend it
with more counters like context switches and etc.

t1 = odp_time_local();
ev = sched_api->schedule(from, wait);
t2 = odp_time_local();

Then time in schedule will be:
odp_time_t sched_time =  odp_time_diff(t2, t1)

So I think everything ok but I would refine doxygen to be more clear what is odp_time_diff() for and probably rename it to odp_time_sub() to be more symmetrical to odp_time_sum().


Reply via email to