globalTimeStamp - going to idle - #4073
Conversation
|
|
||
| virtual bool contradicts(const stream_profile_interface* a, const std::vector<stream_profile>& others) const override; | ||
| virtual double get_device_time(); // Returns time in miliseconds. | ||
| virtual void start_time_keeper() {}; |
There was a problem hiding this comment.
I would suggest to refactor start/stop_time_keeper into enable_time_keeper(bool).
The start/stop_time_keeper operations are internal to the device's flow (i.e. bound to the start/stop device operations implicitly) and shall be not exposed in the class public API.
On the other hand - enable_time_keeper will be connected to the user's dev.set_option(...) operation
|
|
||
| void time_diff_keeper::start() | ||
| { | ||
| _users_count++; |
There was a problem hiding this comment.
Start/Stop shall be muted-protected as the invocation can be done from multiple threads.
| void tag_profiles(stream_profiles profiles) const override { m_device->tag_profiles(profiles); } | ||
| bool compress_while_record() const override { return true; } | ||
| bool contradicts(const stream_profile_interface* a, const std::vector<stream_profile>& others) const override { return m_device->contradicts(a, others); } | ||
| double get_device_time() { return 0; }; // Returns time in miliseconds. |
There was a problem hiding this comment.
It makes sense to incorporate units into the signature get_device_time_ms() to avoid ambiguity
dorodnic
left a comment
There was a problem hiding this comment.
In general, I don't like how time_keeper APIs are starting to pollute device interface. Perhaps it can be better to extract it to an independent interface (and possibly base implementation) that relevant devices can inherit from?
|
|
||
| void time_diff_keeper::stop() | ||
| { | ||
| if (_users_count <= 0) |
There was a problem hiding this comment.
Couple of options -
a. Use regular uint instead of an atomic and wrap read/writes with a mutex
b. Use atomic compare-exchange pattern
disable global_timestamp_reader calls to device if it is not started.
In order to allow device to fall back to idle mode this PR only enables periodic calls to device if there is an open sensor.
Tracked on: DSO-12794