D7995: KDevelop: address dirwatching inefficiency (WIP/PoC)

René J.V. Bertin noreply at phabricator.kde.org
Fri Nov 17 16:14:55 UTC 2017


rjvbb added a comment.


  I misremembered the exact reason I use an explicit queued connection. Some results on Linux, connecting FMLJ::watchDir without explicitly queued connection:
  
    KDirWatch backend: Inotify
    Starting import of project kdevelop-git
            creating dirwatcher took 0 seconds
    Starting import of project /opt/local/site-ports
            creating dirwatcher took 0 seconds
    Starting import of project /opt/local/linux-ports
            creating dirwatcher took 0 seconds
    importing 3894 items into project #2 with 617 call(s) to KDirWatch::addDir() took 0.827 seconds
    importing 5987 items into project #1 with 1189 call(s) to KDirWatch::addDir() took 1.321 seconds
    importing 13361 items into project #0 with 2675 call(s) to KDirWatch::addDir() took 2.258 seconds
    kdevplatform.filemanager: Deleting dir watcher took 0.026 seconds for project "Test Project"
    kdevplatform.filemanager: Deleting dir watcher took 0.01 seconds for project "Test Project"
    kdevplatform.filemanager: Deleting dir watcher took 0.005 seconds for project "Test Project"
    Done in 2.259 seconds total
    org.kde.kwindowsystem: Loaded plugin "/opt/local/share/qt5/plugins/kf5/org.kde.kwindowsystem.platforms/KF5WindowSystemX11Plugin.so" for platform "xcb"
    cannot find .rc file "abstractfilemanagerpluginimportbenchmarkui.rc" for component "abstractfilemanagerpluginimportbenchmark"
    KDirWatch backend: Inotify
    Starting import of project kdevelop-git
            creating dirwatcher took 0 seconds
    Starting import of project /opt/local/site-ports
            creating dirwatcher took 0 seconds
    Starting import of project /opt/local/linux-ports
            creating dirwatcher took 0 seconds
    importing 3894 items into project #2 with 617 call(s) to KDirWatch::addDir() took 0.972 seconds
    importing 5987 items into project #1 with 1189 call(s) to KDirWatch::addDir() took 1.322 seconds
    importing 13361 items into project #0 with 2675 call(s) to KDirWatch::addDir() took 2.315 seconds
    kdevplatform.filemanager: Deleting dir watcher took 0.026 seconds for project "Test Project"
    kdevplatform.filemanager: Deleting dir watcher took 0.009 seconds for project "Test Project"
    kdevplatform.filemanager: Deleting dir watcher took 0.005 seconds for project "Test Project"
    Done in 2.316 seconds total
    org.kde.kwindowsystem: Loaded plugin "/opt/local/share/qt5/plugins/kf5/org.kde.kwindowsystem.platforms/KF5WindowSystemX11Plugin.so" for platform "xcb"
    cannot find .rc file "abstractfilemanagerpluginimportbenchmarkui.rc" for component "abstractfilemanagerpluginimportbenchmark"
    KDirWatch backend: Inotify
    Starting import of project kdevelop-git
            creating dirwatcher took 0 seconds
    Starting import of project /opt/local/site-ports
            creating dirwatcher took 0 seconds
    Starting import of project /opt/local/linux-ports
            creating dirwatcher took 0 seconds
    importing 3894 items into project #2 with 617 call(s) to KDirWatch::addDir() took 0.818 seconds
    importing 5987 items into project #1 with 1189 call(s) to KDirWatch::addDir() took 1.341 seconds
    importing 13361 items into project #0 with 2675 call(s) to KDirWatch::addDir() took 2.354 seconds
    kdevplatform.filemanager: Deleting dir watcher took 0.019 seconds for project "Test Project"
    kdevplatform.filemanager: Deleting dir watcher took 0.011 seconds for project "Test Project"
    kdevplatform.filemanager: Deleting dir watcher took 0.005 seconds for project "Test Project"
    Done in 2.355 seconds total
    org.kde.kwindowsystem: Loaded plugin "/opt/local/share/qt5/plugins/kf5/org.kde.kwindowsystem.platforms/KF5WindowSystemX11Plugin.so" for platform "xcb"
    cannot find .rc file "abstractfilemanagerpluginimportbenchmarkui.rc" for component "abstractfilemanagerpluginimportbenchmark"
    KDirWatch backend: Inotify
    Starting import of project kdevelop-git
            creating dirwatcher took 0 seconds
    Starting import of project /opt/local/site-ports
            creating dirwatcher took 0 seconds
    Starting import of project /opt/local/linux-ports
            creating dirwatcher took 0 seconds
    importing 3894 items into project #2 with 617 call(s) to KDirWatch::addDir() took 2.486 seconds
    importing 5987 items into project #1 with 1189 call(s) to KDirWatch::addDir() took 6.355 seconds
    importing 13361 items into project #0 with 2675 call(s) to KDirWatch::addDir() took 12.064 seconds
    kdevplatform.filemanager: Deleting dir watcher took 0.02 seconds for project "Test Project"
    kdevplatform.filemanager: Deleting dir watcher took 0.009 seconds for project "Test Project"
    kdevplatform.filemanager: Deleting dir watcher took 0.006 seconds for project "Test Project"
    Done in 12.065 seconds total
    
     Performance counter stats for 'kdevld-lnx-work/build/kdevplatform/project/tests/abstractfilemanagerpluginimportbenchmark kk-git/ /opt/local/site-ports/ /opt/local/linux-ports/' (5 runs):
    
           5300.862525      task-clock:u (msec)       #    0.766 CPUs utilized            ( +-  7.38% )
                     0      context-switches:u        #    0.000 K/sec                  
                     0      cpu-migrations:u          #    0.000 K/sec                  
                17,837      page-faults:u             #    0.003 M/sec                    ( +-  0.04% )
         5,006,341,532      cycles:u                  #    0.944 GHz                      ( +-  0.86% )
         2,406,178,384      instructions:u            #    0.48  insn per cycle           ( +-  0.11% )
           554,704,041      branches:u                #  104.644 M/sec                    ( +-  0.10% )
            28,264,799      branch-misses:u           #    5.10% of all branches          ( +-  1.00% )
    
           6.920373566 seconds time elapsed                                          ( +- 28.17% )
  
  Notice the last run which all of a sudden took much longer. This sort of even happened to me twice in a row, without any apparent reason like another application hogging the CPU or preempting the disk (as far as I can tell). It's not something I can reproduce at will (and it used to be easier to observer in earlier versions of this patch) but I've never seen it when using an explicitly queued connection.
  
  How would Qt detect here that a queued connection is required? How can it know that the FileManagerListJob allocated in the same thread as the call to connect() will send the watchDir signal from another thread?

REPOSITORY
  R32 KDevelop

REVISION DETAIL
  https://phabricator.kde.org/D7995

To: rjvbb, #kdevelop, mwolff
Cc: aaronpuchert, arrowdodger, kfunk, dfaure, mwolff, brauch, kdevelop-devel, njensen, geetamc, Pilzschaf, akshaydeo, surgenight
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20171117/16eabf96/attachment.html>


More information about the KDevelop-devel mailing list