-
- Downloads
librhosydd: Add the current time to each RsdVehicle getter
Each vehicle has its own clock domain, which all timestamps for attributes from that vehicle are relative to. This means that the timestamps for two attributes from a given vehicle can be compared to see which was updated more recently (and how much more recently, in microseconds). However, there was previously no way to compare timestamps between vehicles, or to compare the timestamp for a given attribute to the current time. Given that the clock domain for a vehicle could differ arbitrarily from the system clock domain (g_get_monotonic_time()), this meant that clients could never work out how long ago (in system clock terms) an attribute was modified. Fix that by exposing the current time in the vehicle’s clock domain with the return value from each RsdVehicle getter which returns a property or property metadata. This allows each attribute in those results to be compared to the clock at the time of returning the results, to find out how old that attribute value is, in microseconds. This patch deliberately does not expose the current value of each vehicle’s clock domain as a value by itself (for example, as a get_current_time() method) as that would both tempt clients to poll it, and would introduce unavoidable race conditions between getting the current time and getting a set of attributes. This breaks a lot of API. The implementation in VddAggregateVehicle is worth paying attention to when reviewing, as it needs to aggregate attributes from multiple vehicles into a single aggregate vehicle. That means adjusting their last-updated times to be in a single aggregate clock domain. This is done by defining the aggregate clock domain to be g_get_monotonic_time() and tracking the difference between that and each of the source vehicles’ clocks with each value returned from those source vehicles. Reviewed-by:Simon McVittie <simon.mcvittie@collabora.co.uk> Signed-off-by:
Philip Withnall <philip.withnall@collabora.co.uk> Differential Revision: https://phabricator.apertis.org/D3407
Showing
- backends/speedo/vehicle.c 44 additions, 27 deletionsbackends/speedo/vehicle.c
- clients/rhosydd-client.c 51 additions, 28 deletionsclients/rhosydd-client.c
- daemon/aggregate-vehicle.c 131 additions, 49 deletionsdaemon/aggregate-vehicle.c
- daemon/aggregate-zone.c 22 additions, 2 deletionsdaemon/aggregate-zone.c
- daemon/aggregate-zone.h 2 additions, 1 deletiondaemon/aggregate-zone.h
- libcroesor/static-vehicle.c 41 additions, 9 deletionslibcroesor/static-vehicle.c
- libcroesor/tests/static-vehicle.c 15 additions, 3 deletionslibcroesor/tests/static-vehicle.c
- libcroesor/vehicle-service.c 42 additions, 24 deletionslibcroesor/vehicle-service.c
- librhosydd/proxy-vehicle.c 165 additions, 59 deletionslibrhosydd/proxy-vehicle.c
- librhosydd/tests/proxy-vehicle.c 102 additions, 63 deletionslibrhosydd/tests/proxy-vehicle.c
- librhosydd/tests/utilities.c 61 additions, 43 deletionslibrhosydd/tests/utilities.c
- librhosydd/utilities.c 63 additions, 26 deletionslibrhosydd/utilities.c
- librhosydd/utilities.h 20 additions, 17 deletionslibrhosydd/utilities.h
- librhosydd/vehicle-interface.h 14 additions, 0 deletionslibrhosydd/vehicle-interface.h
- librhosydd/vehicle.c 58 additions, 24 deletionslibrhosydd/vehicle.c
- librhosydd/vehicle.h 8 additions, 0 deletionslibrhosydd/vehicle.h
- tests/integration.py 9 additions, 4 deletionstests/integration.py
Loading
Please register or sign in to comment