On Tue, Jun 30, 2009 at 11:12 AM, Jaap Struyk<[email protected]> wrote: > On 29-06-09 18:59, Paul Alfille wrote: > >> What are you trying to do? Purge the cache? > > Yes, since reading every uncached sensor costs some time (reading from > uncached or with --timeout_volatile=0) so in my case the total polling > time to poll all sensors is over a second but I want to poll every second.
There are 2 issues here: 1. There is no automatic reread of data once a cached item times out. A timeout_volatile of 1 second would make the maximum lifespan of a data element be 1 second (but since the resolution of that timestamp is 1 second, it's more likely to be 1/2 second on average. 2. Purging the cache is a rather rough approach. We probably would only want to purge volatile data which would require a minor change.(maybe a volatile generation counter). The possible scenarios are: 1. Read only uncached data. (slow but certain). 2. Read uncached data every 1 second, and uncached the rest of the time. (Works well if there is one thread that really needs the new data -- like the data collection thread) and every other thread can read the cached data. Or a loop where there are several reads of the same data, and only the first will be the uncached -- easier than storing the data in a variable). 3. Use the cache purge -- best if the update frequency should be enforced and synchronized, and the data collection is mixed in the program logic. 4. Set a short volatile timeout. No one data element will be more than that number of seconds old. Not currently set up for resolutions under a second or 2. > So either I have to use threading or read cached data (which seems to be > as fast reading a file). The cache is in-memory in a binary tree -- very fast. > So I like to purge the complete cache every second and which it could > refresh every 1/2 of 1/4 of a second. > I tried timeout_volatile with values of 0.5 but that didn't worked... Unlikely to work since the cache timestamp is in time_t (seconds) resolution. It could easily be changed, but I doubt 1-wire really has the speed to warrant higher resolution. Paul Alfille ------------------------------------------------------------------------------ _______________________________________________ Owfs-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/owfs-developers
