global_timestamp_reader: no blocking. - #6150
Conversation
| base_x = -max_device_time; | ||
| else | ||
| return false; | ||
| LOG_DEBUG("CLinearCoefficients:update_samples_base(" << base_x << ")"); |
There was a problem hiding this comment.
Use _FUNCTION_ macro instead of CLinearCoefficients:update_samples_base
|
|
||
| double CLinearCoefficients::get_last_hw_time() const | ||
| { | ||
| return (_last_values.front()._x); |
| double sample_hw_time = _device->get_device_time_ms(); | ||
| double system_time_finish = duration<double, std::milli>(system_clock::now().time_since_epoch()).count(); | ||
| if (system_time_finish - system_time_start > 2.0) | ||
| throw io_exception("get_device_time_ms() took too long (more then 2 mSecs)"); |
There was a problem hiding this comment.
Can be added to log as error/warning. No need for exception here.
There was a problem hiding this comment.
I seems cleaner to use exception then LOG +"return false" since already inside a try-catch section.
There was a problem hiding this comment.
This is a recoverable case which does not necessary requires user interaction, as the system can recover from it automatically.
Adding it to log is needed in any case.
Also - I noticed in the latest v2.34.0 under linux the message appears much often than 2 sec in Viewer.
ev-mp
left a comment
There was a problem hiding this comment.
Also need to startt TmeKeeper earlier, preferable before probe/commit and launching the query asynchronously
| if (_coefs.update_samples_base(crnt_hw_time)) | ||
| { | ||
| update_diff_time(); | ||
| // A time loop happend: |
e3b7b0a to
3ca4cfa
Compare
…he first 3 seconds. Delay is currently caused by global_time_stamp_reader blocking the first frame while it is still in an unready condition.
3ca4cfa to
bc72a88
Compare
…n runs with GlobalTimeStampReader on and off.
… increase stability testing initial frames.
e098c89 to
2b409fb
Compare
| } | ||
| double system_time(system_time_finish - _min_command_delay); | ||
| if (sample_hw_time < _last_sample_hw_time) | ||
| std::lock_guard<std::recursive_mutex> lock(_read_mtx); |
There was a problem hiding this comment.
I think that mutex shall be applied in all places the internal buffer is being evaluated. For review
| //LOG_DEBUG("time_diff_keeper::call reset()"); | ||
| _coefs.reset(); | ||
| double un_used; | ||
| _coefs.update_samples_base(sample_hw_time, un_used); |
There was a problem hiding this comment.
The second parameter is not used, can it be dropped?
| void time_diff_keeper::polling(dispatcher::cancellable_timer cancellable_timer) | ||
| { | ||
| update_diff_time(); | ||
| unsigned int time_to_sleep = _poll_intervals_ms + _coefs.is_full() * (9 * _poll_intervals_ms); |
There was a problem hiding this comment.
Pls add explanation comment here
| REQUIRE_NOTHROW(subdevice.stop()); | ||
| REQUIRE_NOTHROW(subdevice.close()); | ||
|
|
||
| lock.unlock(); |
| CAPTURE(median_diff_gts_on); | ||
| CAPTURE(median_diff_gts_off); | ||
|
|
||
| REQUIRE(median_diff_gts_on > 0.5*median_diff_gts_off); |
There was a problem hiding this comment.
During 10 second Gyto will generate 4000 frames. Imo the median will not suffice.
…equire timestamps to increase.
2b409fb to
6e06078
Compare
…ame thread. continue system_time-hw_time equation through time loop.
…oner. Reduces number of frame requests receiving Hardware timestamp instead of global timestamp.
6e06078 to
d29667f
Compare
prevent calls for get_device_time_ms from frame thread.
continue system_time-hw_time equation through time loop.