Hi Damjan,

I was going through the following code which vlib_time_now calls internally. 
This function takes 'c' as an input which is the timing context and 
vlib_time_now passes a reference to global timing context in vlib_main.
If multiple threads call the function at the same time then it can result in a 
race and wrong timestamp values.
Am I missing something. Please help me understand.

always_inline f64
clib_time_now_internal (clib_time_t * c, u64 n)
{
u64 l = c->last_cpu_time;
u64 t = c->total_cpu_time;
t += n - l;
c->total_cpu_time = t;
c->last_cpu_time = n;
if (PREDICT_FALSE
((c->last_cpu_time -
c->last_verify_cpu_time) >> c->log2_clocks_per_frequency_verify))
clib_time_verify_frequency (c);
return t * c->seconds_per_clock;
}

Thanks
Vamsi
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#14021): https://lists.fd.io/g/vpp-dev/message/14021
Mute This Topic: https://lists.fd.io/mt/34196878/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to