Add benchmarks for KDirWatch
ClosedPublic

Authored by mwolff on Jan 11 2018, 3:11 PM.

Details

Summary

All benchmarks create a relatively large directory tree and then
watch that recursively. On my system, the timings are:

RESULT : KDirWatch_UnitTest::benchCreateTree():
     34.2 msecs per iteration (total: 342, iterations: 10)
PASS   : KDirWatch_UnitTest::benchCreateWatcher()
RESULT : KDirWatch_UnitTest::benchCreateWatcher():
     13.6 msecs per iteration (total: 137, iterations: 10)
PASS   : KDirWatch_UnitTest::benchNotifyWatcher()
RESULT : KDirWatch_UnitTest::benchNotifyWatcher():
     113.7 msecs per iteration (total: 1,138, iterations: 10)

Note that this time includes wait/sleep time and the latency
induced by the kernel for the inotify events to arrive. Measuring
on-CPU time can be done by passing -perf to the benchmarks:

PASS   : KDirWatch_UnitTest::benchCreateTree():
RESULT : KDirWatch_UnitTest::benchCreateTree():
     165,910,830.4 CPU cycles per iteration (total: 1,659,108,304, iterations: 10)
PASS   : KDirWatch_UnitTest::benchCreateWatcher()
RESULT : KDirWatch_UnitTest::benchCreateWatcher():
     64,014,469.8 CPU cycles per iteration (total: 640,144,699, iterations: 10)
PASS   : KDirWatch_UnitTest::benchNotifyWatcher()
RESULT : KDirWatch_UnitTest::benchNotifyWatcher():
     316,077,005.5 CPU cycles per iteration (total: 3,160,770,055, iterations: 10)

The first benchmark measures the time it takes to create the large
directory. See below for why this is useful information.

The second measures how long it takes to add the root dir
and its contents recursively.

The third one touches all files in the tree and measure how long it
takes until all dirty signals arrive. If you subtract the results
from the first benchmark from those of the third benchmark, you
arrive you arrive at the overhead imposed by KDirWatch.
At this point, it's quite high!

Diff Detail

Repository
R244 KCoreAddons
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mwolff created this revision.Jan 11 2018, 3:11 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJan 11 2018, 3:11 PM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
mwolff requested review of this revision.Jan 11 2018, 3:11 PM

"The third one touches all files in the tree and measure how long it
takes until all dirty signals arrive. If you subtract that measurement
from the third benchmark"

Did you mean, if you subtract the first benchmark from the third benchmark?
"That measurement" is ambiguous at this point, I first thought it referred to "the third one", but surely this isn't about subtracting third from third ;-)

mwolff updated this revision to Diff 25367.Jan 15 2018, 9:07 AM
mwolff edited the summary of this revision. (Show Details)

fixup commit message

mwolff updated this revision to Diff 25368.Jan 15 2018, 9:08 AM
mwolff edited the summary of this revision. (Show Details)

format results on phab

dfaure accepted this revision.Jan 17 2018, 2:49 PM
This revision is now accepted and ready to land.Jan 17 2018, 2:49 PM
This revision was automatically updated to reflect the committed changes.

Hi Milian,

The benchNotifyWatcher() test seems to fail on CI. Can you take a look?

https://build.kde.org/job/Frameworks/view/Everything/job/kcoreaddons/job/kf5-qt5%20SUSEQt5.10/6/testReport/projectroot/autotests/kdirwatch_qfswatch_unittest/

FAIL! : KDirWatch_UnitTest::benchNotifyWatcher() Compared values are not the same

Actual   ((spy.count())): 7442
Expected (numFiles)     : 7810
Loc: [/home/jenkins/workspace/Frameworks/kcoreaddons/kf5-qt5 SUSEQt5.10/autotests/kdirwatch_unittest.cpp(843)]
Restricted Application edited subscribers, added: kde-frameworks-devel; removed: Frameworks. · View Herald TranscriptFeb 2 2019, 10:19 AM