Warning, /graphics/kst-plot/devel-docs/Kst2Specs/Updates is written in an unsupported language. File is not indexed.
0001 Updates are done by explicitly looping through lists of objects and items. 0002 0003 Kst::Objects keep track of and/or provide 0004 0005 serial: the serial number (from doUpdates()) of the last time it was updated. 0006 0007 serialOfLastChange: the serial number of the last time an update actually led to a change. 0008 0009 minInputSerial(): the min serial of any input primitives to the object 0010 This method querries the inputs. 0011 0012 maxInputSerialOfLastChange(): the max serial where on of the input primitives was actually changed. 0013 This method also querries the inputs 0014 0015 objectUpdate(new_serial): 0016 return NoChange if serial == new_serial 0017 return Deferred if minInputSerial < new_serial (an input hasn't be updated yet) 0018 return Changed after calling internalUpdate() if maxInputSerialOfLastChange > serialOfLastChange 0019 return NoChange otherwise 0020 0021 internalUpdate(): actually perform an update. ** should only be called by objectUpdate ** 0022 0023 ObjectManager::doUpdates(): The loop for updating Kst::Objects. Calls objectUpdate(). 0024 doUpdates() is called by: 0025 -datasources, by their timer or watcher 0026 -dialogs, at the end of apply() or equivalent 0027 0028 Algorithm: 0029 loop over all datasources 0030 set serialOfLastChange if there was new data 0031 0032 do 0033 loop over all Objects (except data sources) 0034 retval = objectUpdate() 0035 until no retval's == Deferred 0036 0037 0038 MainWindow::updateViewItems(serial): update plotitems and then views 0039 called by a signal emitted at the end of doUpdates() 0040 0041 loop over all plot items: 0042 plotItem::handleChangedInputs() 0043 0044 if any plotItems changed 0045 _tabwidget->currentView()->update() 0046 0047 -------------- 0048 ToDo/shortcomings 0049 0050 -The object loop in doUpdates is inefficient, in that it may have to go through the loop 0051 up to D times, where D is the heirarchy depth. The loop could instead re-sort the objects as it 0052 goes, so that for future visits, nothing would be deferred. In practive, objectUpdate(new_serial) 0053 where new_serial == _serial is pretty cheap, and probably doesn't produce a noticible slowdown. 0054 In practice the heirarchy depth is 2 (curves of dataVectors) or three 0055 (curves of PSD's of dataVectors) 0056 0057 -The updateViewItems loop only considers plot items to trigger a view update. It does not check 0058 if labels have changed. In practice, it is rare to have only labels from a data source, and no 0059 plots, but if one were to do this, it would not get real time redrawn. The solution is to add 0060 labels to the list it checks. 0061 0062 -The updateViewItems loop will update the current view if any plots have changed: if only plots on 0063 other tabs had been changed, it would be better to not update the current view. Not common, and 0064 the update is pretty fast if the plot didn't change. 0065 0066 -doUpdates() could be threaded 0067 the data source loop should not be threaded. It's to cheap to be worth the threading overhead. 0068 data primitives should be looped over before all other objects 0069 whether data primitives updates should be threaded depends on the nature of the datasource and 0070 on the media it is being read from to avoid disk thrashing - dirfiles will suffer from threading 0071 data primitive reads, but data sources that store their data contiguously will benefit (eg, ascii). 0072 Using flash drives should mean all data primitives would benefit from threading. 0073 0074 other data object updates can be threaded. 0075 0076 suggested algorithm 0077 make a pool of threads 0078 parcel out the data objects to the threads 0079 0080 -updateViewItems() is probably the slowest operation, and could benefit from threading. 0081 the loop over plotItems can easily be threaded as with Objects. 0082 0083 There is no way to thread the view update call with the current architecture. It is possible 0084 that the refresh pixmaps stuff could be threaded, but I don't know how yet. 0085 0086 0087 version: cbn Nov 26'09 0088