<table><tr><td style="">rjvbb retitled this revision from "KDevelop project file manager: avoid concurrent reloads and represent jobs in the runController" to "KDevelop project file manager: watch directories exclusively, avoid concurrent reloads and represent jobs in the RunController (PoC)".<br />rjvbb edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-oodgox5wehdoydp/">(Show Details)</a><br />rjvbb edited the test plan for this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-ft4i5rgugmqm4bh/">(Show Details)</a><br />rjvbb set the repository for this revision to R32 KDevelop.<br />rjvbb added a project: KDevelop.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D9006">View Revision</a></tr></table><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">This is a bit more proper presentation of the pseudo-patch presented in https://bugs.kde.org/show_bug.cgi?id=387238 "concurrent project directory reloading".<br />
<br />
Probably not very useful in the current code base so I'm not expecting this to be upstreamed or to get much constructive feedback (so don't feel obliged</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">- Watch directories exclusively as this is the only viable cross-platform compatible method unless the user set KDEV_PROJECT_INTREE_DIRWATCHING_MODE.<br />
When watching directories, take into consideration that 1) a notification can come from a new or changed hidden file; 2) many changes can be signalled in rapid succession and 3) notifications are about changes in the given directory (= not in any of its subdirs</span>).<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Which is why I'm lumping 2 related things in the same patch:<br />
<br />
1) prevent the CPU cost and possible other side-effects of frequent project reloads (leading to concurrent FileManagerListJobs); see #387238 for discussion when this can happen.<br />
<br />
2) represent FileManagerListJobs in the runController. This uses a proxy KJob derative so the runController can take control over its management.<br />
<br />
1) is, I think</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Nothing can be done about 1) but the other 2 points are taken into account:<br />
* queue reloads (with a rather arbitrary 1s cool-off delay) instead of starting them at once.<br />
* reloads due to change notifications are marked disposable<br />
* when another notification arrives for a directory that's already reloading (or scheduled for)</span>, <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">*a* proper way to compress reload requests</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">abort the current job(s) where possible (or skip the directory if it's a subdir) before creating the new job</span>. <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">It cancels reloads queued or already running for the target directory or one of its subdirs and adds a cool-off delay before jobs are actually started (so they won't have used any CPU if overridden soon enough after having been scheduled)</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Consider only "disposable" jobs for this</span>.<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">There may be better implementations, this one is least-change and has the advantage that everything continues to work when there are only sporadic reload requests.<br />
<br />
2) was mostly a fun hack of a feature I've been missing and that now shows me why KDevelop is sometimes not as responsive as it might be. Other than that it's probably as useful as showing unnamed and/or unkillable jobs in the r</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">* when the notification is about an already known directory the reload will be non-recursive.<br />
- file manager list jobs are registered with the R</span>unController.</div></div></div><br /><div><strong>CHANGES TO TEST PLAN</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">1) d</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">D</span>oes <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">exactly what I hoped for</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">what it's intended to do,</span> tested while running configure on a bigger in-tree build project <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">like CodeBlocks with KDevelop configured to monitor directories for and reload them in case of changes</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">(e.g</span>. <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Not profiled formally,</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">CodeBlocks).<br />
Dir watching works also on Mac if you don't set watches on all files;</span> the effect <span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">of reload-limiting </span>is clear from following CPU usage in top, from fan noise, and from the <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">r</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">R</span>unController buttons<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"> not</span> turning on in the toolbar<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"> for only short periods of time</span>.<br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">2) tested on Mac and Linux. Works as expected except for the fact that the initial project load puts TWO entries in the "stop individual job" dropdown menu</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Tested on Mac and Linux</span>. <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">There are no duplicate proxies as far as  can tell so this escapes me still.</span></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D9006">https://phabricator.kde.org/D9006</a></div></div><br /><div><strong>To: </strong>rjvbb<br /><strong>Cc: </strong>kdevelop-devel, gennad, glebaccon, antismap, iodelay, alexeymin, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>