KDirWatch and kdevelop idle CPU usage (4.7/1.7)

René J.V. Bertin rjvbertin at gmail.com
Mon Apr 20 11:32:14 BST 2015


On Thursday April 16 2015 15:14:28 Milian Wolff wrote:

> On Thursday April 16 2015 14:09:41 Milian Wolff wrote:
> 
> >Please attach a profiler and figure out where the CPU time is spent. This 
> does 
> >not sound good at all. But without help from your side that tells us where 
> the 
> >CPU cycles are spent there is nothing we can do.

Below is a backtrace that should give some hints as to what those CPU cycles are spent on. It's from the main thread, the only one (of 14 total) that's taking between roughly 20% and 35% CPU. The session has 4 projects imported through kdev-qmake (thanks for pointing me to that one): two created from qtbase src.pro (the git 5.4.2 head and the other from the recent 5.4.2 snapshot); a small qmake test project and a project containing the MacPorts tcl and patchfiles that make up the qt5 port.

I think it's rather evident that we're looking at CPU usage from watching the project directories. If there are OS differences in the way this is implemented (which doesn't seem unlikely at all, and btw, yes, we're talking about OS X here) that would explain why there's no such idle activity on Linux (if that's indeed the case).

I haven't yet had the time to look at KDirWatch nor at how it is deployed in KDevelop (or KDevPlatform). Is it possible to decrease the resources used for instance by decreasing a poll frequency? What do I lose if I switch off the feature altogether?

R.


* thread #1: tid = 0x75cff9, 0x0000000109a4f1be QtCore`QUtf8::convertFromUnicode(uc=<unavailable>, len=<unavailable>, state=0x0000000000000000) + 462 at qutfcodec.cpp:92, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x0000000109a4f1be QtCore`QUtf8::convertFromUnicode(uc=<unavailable>, len=<unavailable>, state=0x0000000000000000) + 462 at qutfcodec.cpp:92
   89       const QChar *end = ch + len;
   90       while (ch < end) {
   91           uint u = ch->unicode();
-> 92           if (surrogate_high >= 0) {
   93               if (ch->isLowSurrogate()) {
   94                   u = QChar::surrogateToUcs4(surrogate_high, u);
   95                   surrogate_high = -1;
(lldb) bt
* thread #1: tid = 0x75cff9, 0x0000000109a4f1be QtCore`QUtf8::convertFromUnicode(uc=<unavailable>, len=<unavailable>, state=0x0000000000000000) + 462 at qutfcodec.cpp:92, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x0000000109a4f1be QtCore`QUtf8::convertFromUnicode(uc=<unavailable>, len=<unavailable>, state=0x0000000000000000) + 462 at qutfcodec.cpp:92
    frame #1: 0x0000000109959159 QtCore`QString::toUtf8(this=<unavailable>) const + 41 at qstring.cpp:3793
    frame #2: 0x0000000109996ab7 QtCore`locale_encode(f=<unavailable>) + 39 at qfile.cpp:68
    frame #3: 0x000000010999768f QtCore`QFile::encodeName(fileName=<unavailable>) + 15 at qfile.cpp:515
    frame #4: 0x00000001086978f0 libkdecore.5.dylib`KDirWatchPrivate::scanEntry(KDirWatchPrivate::Entry*) [inlined] KDE::stat(path=0x00007ff491b83260, buf=0x000181a401000004) + 8 at kde_file.h:209
    frame #5: 0x00000001086978e8 libkdecore.5.dylib`KDirWatchPrivate::scanEntry(this=0x00007ff48b04df70, e=0x00007ff491b83228) + 104 at kdirwatch.cpp:1242
    frame #6: 0x0000000108698622 libkdecore.5.dylib`KDirWatchPrivate::slotRescan(this=0x00007ff48b04df70) + 338 at kdirwatch.cpp:1435
    frame #7: 0x0000000109a2fc0b QtCore`QMetaObject::activate(sender=0x00007ff48b04df80, m=<unavailable>, local_signal_index=<unavailable>, argv=<unavailable>) + 2363 at qobject.cpp:3638
    frame #8: 0x0000000109a29ef0 QtCore`QObject::event(this=0x00007ff48b04df80, e=<unavailable>) + 48 at qobject.cpp:1184
    frame #9: 0x0000000108be10db QtGui`QApplicationPrivate::notify_helper(this=<unavailable>, receiver=0x00007ff48b04df80, e=0x00007fff58fd4590) + 251 at qapplication.cpp:4565
    frame #10: 0x0000000108be25f9 QtGui`QApplication::notify(this=<unavailable>, receiver=<unavailable>, e=0x00007fff58fd4590) + 905 at qapplication.cpp:3947
    frame #11: 0x0000000109a160d6 QtCore`QCoreApplication::notifyInternal(this=<unavailable>, receiver=<unavailable>, event=<unavailable>) + 118 at qcoreapplication.cpp:955
    frame #12: 0x0000000108be475d QtGui`qt_sendSpontaneousEvent(QObject*, QEvent*) [inlined] QCoreApplication::sendSpontaneousEvent(event=<unavailable>) + 35 at qcoreapplication.h:234
    frame #13: 0x0000000108be473a QtGui`qt_sendSpontaneousEvent(receiver=<unavailable>, event=<unavailable>) + 10 at qapplication.cpp:5563
    frame #14: 0x0000000108b956a5 QtGui`QEventDispatcherMacPrivate::activateTimer(__CFRunLoopTimer*, void*) + 197
    frame #15: 0x00007fff8841b3e4 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
    frame #16: 0x00007fff8841af1f CoreFoundation`__CFRunLoopDoTimer + 1151
    frame #17: 0x00007fff8848c5aa CoreFoundation`__CFRunLoopDoTimers + 298
    frame #18: 0x00007fff883d66a5 CoreFoundation`__CFRunLoopRun + 1525
    frame #19: 0x00007fff883d5e75 CoreFoundation`CFRunLoopRunSpecific + 309
    frame #20: 0x00007fff8a021a0d HIToolbox`RunCurrentEventLoopInMode + 226
    frame #21: 0x00007fff8a0217b7 HIToolbox`ReceiveNextEventCommon + 479
    frame #22: 0x00007fff8a0215bc HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 65
    frame #23: 0x00007fff8f04424e AppKit`_DPSNextEvent + 1434
    frame #24: 0x00007fff8f04389b AppKit`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
    frame #25: 0x00007fff8f03799c AppKit`-[NSApplication run] + 553
    frame #26: 0x0000000108b96a9b QtGui`QEventDispatcherMac::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 2059
    frame #27: 0x0000000109a1346f QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) [inlined] QFlags<QEventLoop::ProcessEventsFlag>::QFlags(this=0x00007fff00000024) + 9 at qglobal.h:2434
    frame #28: 0x0000000109a13466 QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) [inlined] QFlags<QEventLoop::ProcessEventsFlag>::QFlags(this=0x00007fff00000024) at qglobal.h:2434
    frame #29: 0x0000000109a13466 QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) [inlined] QFlags<QEventLoop::ProcessEventsFlag>::operator|(f=<unavailable>) const + 59 at qeventloop.cpp:149
    frame #30: 0x0000000109a1342b QtCore`QEventLoop::exec(this=0x00007fff58fd6f40, flags=(i = 0)) + 427 at qeventloop.cpp:204
    frame #31: 0x0000000109a16687 QtCore`QCoreApplication::exec() + 199 at qcoreapplication.cpp:1227
    frame #32: 0x0000000106c3dafa kdevelop`main(argc=<unavailable>, argv=<unavailable>) + 54122 at main.cpp:582
    frame #33: 0x00007fff893fb5fd libdyld.dylib`start + 1




More information about the KDevelop mailing list