Bug 339598

Summary: Icon animation using up lots of CPU
Product: [Plasma] plasma-nm Reporter: Dima Ryazanov <dima>
Component: appletAssignee: Jan Grulich <jgrulich>
Status: RESOLVED DUPLICATE    
Severity: minor CC: jgrulich, lukas
Priority: NOR    
Version: 0.9.3.4   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Dima Ryazanov 2014-10-02 07:29:07 UTC
I noticed a spike in CPU usage while I was trying to connect to VPN. Looks like whenever the icon is animated (showing a connection in progress), plasma-desktop uses up 35% of CPU, which is a bit excessive. It's happening very consistently: as soon as the animation stops, the CPU usage goes down.

Here's a stack trace I get from gdb:

#0  0x00007f739c647707 in QMap<QWidget*, QRect>::mutableFindNode (this=0x34bce10, aupdate=aupdate@entry=0x7ffff8d78d50, akey=@0x7ffff8d78c28: 0x308c380)
    at ../../include/QtCore/../../src/corelib/tools/qmap.h:785
#1  0x00007f739c63f4ad in insert (avalue=..., akey=@0x7ffff8d78c28: 0x308c380, this=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qmap.h:565
#2  QGraphicsScenePrivate::drawSubtreeRecursive (this=0x1954250, item=0x34bcd10, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d7ab10, exposedRegion=0x30249e8, widget=0x308c380, 
    parentOpacity=<optimized out>, effectTransform=0x0) at graphicsview/qgraphicsscene.cpp:4800
#3  0x00007f739c63e63c in QGraphicsScenePrivate::draw (this=0x34bce10, this@entry=0x1954250, item=0x1, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d78d50, 
    viewTransform@entry=0x7ffff8d7ab10, transformPtr=0x30249e8, transformPtr@entry=0x0, exposedRegion=0x1, exposedRegion@entry=0x30249e8, widget=0x308c380, opacity=-16776945, 
    opacity@entry=1, effectTransform=0x0, wasDirtyParentSceneTransform=false, drawItem=false) at graphicsview/qgraphicsscene.cpp:4996
#4  0x00007f739c63f335 in QGraphicsScenePrivate::drawSubtreeRecursive (this=0x1954250, item=0x34bbba0, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d7ab10, 
    exposedRegion=0x30249e8, widget=0x308c380, parentOpacity=<optimized out>, effectTransform=0x0) at graphicsview/qgraphicsscene.cpp:4857
#5  0x00007f739c63e63c in QGraphicsScenePrivate::draw (this=0x34bce10, this@entry=0x1954250, item=0x0, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d78d50, 
    viewTransform@entry=0x7ffff8d7ab10, transformPtr=0x30249e8, transformPtr@entry=0x0, exposedRegion=0x1, exposedRegion@entry=0x30249e8, widget=0x308c380, opacity=-16776945, 
    opacity@entry=1, effectTransform=0x0, wasDirtyParentSceneTransform=false, drawItem=false) at graphicsview/qgraphicsscene.cpp:4996
#6  0x00007f739c63f335 in QGraphicsScenePrivate::drawSubtreeRecursive (this=0x1954250, item=0x34b7490, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d7ab10, 
    exposedRegion=0x30249e8, widget=0x308c380, parentOpacity=<optimized out>, effectTransform=0x0) at graphicsview/qgraphicsscene.cpp:4857
#7  0x00007f739c63e63c in QGraphicsScenePrivate::draw (this=0x34bce10, this@entry=0x1954250, item=0x0, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d78d50, 
    viewTransform@entry=0x7ffff8d7ab10, transformPtr=0x30249e8, transformPtr@entry=0x0, exposedRegion=0x1, exposedRegion@entry=0x30249e8, widget=0x308c380, opacity=-16776945, 
    opacity@entry=1, effectTransform=0x0, wasDirtyParentSceneTransform=false, drawItem=false) at graphicsview/qgraphicsscene.cpp:4996
#8  0x00007f739c63f335 in QGraphicsScenePrivate::drawSubtreeRecursive (this=0x1954250, item=0x34b6f00, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d7ab10, 
    exposedRegion=0x30249e8, widget=0x308c380, parentOpacity=<optimized out>, effectTransform=0x0) at graphicsview/qgraphicsscene.cpp:4857
#9  0x00007f739c63e63c in QGraphicsScenePrivate::draw (this=0x34bce10, this@entry=0x1954250, item=0x2, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d78d50, 
    viewTransform@entry=0x7ffff8d7ab10, transformPtr=0x30249e8, transformPtr@entry=0x0, exposedRegion=0x1, exposedRegion@entry=0x30249e8, widget=0x308c380, opacity=-16776945, 
    opacity@entry=1, effectTransform=0x0, wasDirtyParentSceneTransform=false, drawItem=false) at graphicsview/qgraphicsscene.cpp:4996
#10 0x00007f739c63f335 in QGraphicsScenePrivate::drawSubtreeRecursive (this=0x1954250, item=0x34ad190, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d7ab10, 
    exposedRegion=0x30249e8, widget=0x308c380, parentOpacity=<optimized out>, effectTransform=0x0) at graphicsview/qgraphicsscene.cpp:4857
#11 0x00007f739c63e63c in QGraphicsScenePrivate::draw (this=0x34bce10, this@entry=0x1954250, item=0x2, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d78d50, 
    viewTransform@entry=0x7ffff8d7ab10, transformPtr=0x30249e8, transformPtr@entry=0x0, exposedRegion=0x1, exposedRegion@entry=0x30249e8, widget=0x308c380, opacity=-16776945, 
    opacity@entry=1, effectTransform=0x0, wasDirtyParentSceneTransform=false, drawItem=false) at graphicsview/qgraphicsscene.cpp:4996
#12 0x00007f739c63f335 in QGraphicsScenePrivate::drawSubtreeRecursive (this=0x1954250, item=0x2cdb990, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d7ab10, 
    exposedRegion=0x30249e8, widget=0x308c380, parentOpacity=<optimized out>, effectTransform=0x0) at graphicsview/qgraphicsscene.cpp:4857
#13 0x00007f739c63e63c in QGraphicsScenePrivate::draw (this=0x34bce10, this@entry=0x1954250, item=0x0, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d78d50, 
    viewTransform@entry=0x7ffff8d7ab10, transformPtr=0x30249e8, transformPtr@entry=0x7ffff8d7a0d0, exposedRegion=0x1, exposedRegion@entry=0x30249e8, widget=0x308c380, 
    opacity=-16776945, opacity@entry=1, effectTransform=0x0, wasDirtyParentSceneTransform=false, drawItem=false) at graphicsview/qgraphicsscene.cpp:4996
#14 0x00007f739c63f335 in QGraphicsScenePrivate::drawSubtreeRecursive (this=0x1954250, item=0x2cddad0, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d7ab10, 
    exposedRegion=0x30249e8, widget=0x308c380, parentOpacity=<optimized out>, effectTransform=0x0) at graphicsview/qgraphicsscene.cpp:4857
#15 0x00007f739c63e63c in QGraphicsScenePrivate::draw (this=0x34bce10, this@entry=0x1954250, item=0x3, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d78d50, 
    viewTransform@entry=0x7ffff8d7ab10, transformPtr=0x30249e8, transformPtr@entry=0x0, exposedRegion=0x1, exposedRegion@entry=0x30249e8, widget=0x308c380, opacity=-16776945, 
    opacity@entry=1, effectTransform=0x0, wasDirtyParentSceneTransform=false, drawItem=false) at graphicsview/qgraphicsscene.cpp:4996
#16 0x00007f739c63f335 in QGraphicsScenePrivate::drawSubtreeRecursive (this=0x1954250, item=0x2b99b50, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d7ab10, 
---Type <return> to continue, or q <return> to quit---
    exposedRegion=0x30249e8, widget=0x308c380, parentOpacity=<optimized out>, effectTransform=0x0) at graphicsview/qgraphicsscene.cpp:4857
#17 0x00007f739c63e63c in QGraphicsScenePrivate::draw (this=0x34bce10, this@entry=0x1954250, item=0x0, painter=0x7ffff8d7aa60, viewTransform=0x7ffff8d78d50, 
    viewTransform@entry=0x7ffff8d7ab10, transformPtr=0x30249e8, transformPtr@entry=0x0, exposedRegion=0x1, exposedRegion@entry=0x30249e8, widget=0x308c380, opacity=-16776945, 
    opacity@entry=1, effectTransform=0x0, wasDirtyParentSceneTransform=false, drawItem=false) at graphicsview/qgraphicsscene.cpp:4996
#18 0x00007f739c63f335 in QGraphicsScenePrivate::drawSubtreeRecursive (this=this@entry=0x1954250, item=0x2500a70, painter=painter@entry=0x7ffff8d7aa60, 
    viewTransform=viewTransform@entry=0x7ffff8d7ab10, exposedRegion=exposedRegion@entry=0x30249e8, widget=widget@entry=0x308c380, parentOpacity=parentOpacity@entry=1, 
    effectTransform=0x0) at graphicsview/qgraphicsscene.cpp:4857
#19 0x00007f739c63fa10 in QGraphicsScenePrivate::drawItems (this=0x1954250, painter=painter@entry=0x7ffff8d7aa60, viewTransform=viewTransform@entry=0x7ffff8d7ab10, 
    exposedRegion=exposedRegion@entry=0x30249e8, widget=0x308c380) at graphicsview/qgraphicsscene.cpp:4739
#20 0x00007f739c65d634 in QGraphicsView::paintEvent (this=<optimized out>, event=<optimized out>) at graphicsview/qgraphicsview.cpp:3471
#21 0x00007f739c0a4ce8 in QWidget::event (this=0x34bce10, this@entry=0x31127e0, event=0x7ffff8d78d50, event@entry=0x7ffff8d7b0c0) at kernel/qwidget.cpp:8775
#22 0x00007f739c44e9fe in QFrame::event (this=0x31127e0, e=0x7ffff8d7b0c0) at widgets/qframe.cpp:557
#23 0x00007f739c65c441 in QGraphicsView::viewportEvent (this=0x31127e0, event=0x7ffff8d7b0c0) at graphicsview/qgraphicsview.cpp:2866
#24 0x00007f739ccc89d6 in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=this@entry=0x188bc40, receiver=receiver@entry=0x308c380, event=event@entry=0x7ffff8d7b0c0)
    at kernel/qcoreapplication.cpp:1063
#25 0x00007f739c0550fc in QApplicationPrivate::notify_helper (this=this@entry=0x188bc40, receiver=receiver@entry=0x308c380, e=e@entry=0x7ffff8d7b0c0)
    at kernel/qapplication.cpp:4566
#26 0x00007f739c05b870 in QApplication::notify (this=this@entry=0x1879030, receiver=receiver@entry=0x308c380, e=e@entry=0x7ffff8d7b0c0) at kernel/qapplication.cpp:4356
#27 0x00007f739d9b657a in KApplication::notify (this=0x1879030, receiver=0x308c380, event=0x7ffff8d7b0c0) at ../../kdeui/kernel/kapplication.cpp:311
#28 0x00007f739ccc886d in QCoreApplication::notifyInternal (this=0x1879030, receiver=receiver@entry=0x308c380, event=event@entry=0x7ffff8d7b0c0) at kernel/qcoreapplication.cpp:953
#29 0x00007f739c09f7ad in sendSpontaneousEvent (event=0x7ffff8d7b0c0, receiver=0x308c380) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:234
#30 QWidgetPrivate::drawWidget (this=this@entry=0x311e9a0, pdev=pdev@entry=0x2362480, rgn=..., offset=..., flags=flags@entry=4, sharedPainter=0x0, backingStore=0x29d3120)
    at kernel/qwidget.cpp:5599
#31 0x00007f739c0a0227 in QWidgetPrivate::paintSiblingsRecursive (this=this@entry=0x3024560, pdev=pdev@entry=0x2362480, siblings=..., index=<optimized out>, index@entry=4, 
    rgn=..., offset=..., flags=4, sharedPainter=0x0, backingStore=0x29d3120) at kernel/qwidget.cpp:5808
#32 0x00007f739c0a009e in QWidgetPrivate::paintSiblingsRecursive (this=this@entry=0x3024560, pdev=pdev@entry=0x2362480, siblings=..., index=4, rgn=..., offset=..., flags=4, 
    sharedPainter=0x0, backingStore=0x29d3120) at kernel/qwidget.cpp:5795
#33 0x00007f739c09f33d in QWidgetPrivate::drawWidget (this=0x3024560, pdev=0x2362480, rgn=..., offset=..., flags=flags@entry=5, sharedPainter=sharedPainter@entry=0x0, 
    backingStore=0x29d3120) at kernel/qwidget.cpp:5652
#34 0x00007f739c2670e2 in QWidgetBackingStore::sync (this=0x29d3120) at painting/qbackingstore.cpp:1373
#35 0x00007f739c094a70 in QWidgetPrivate::syncBackingStore (this=0x3024560) at kernel/qwidget.cpp:1894
#36 0x00007f739c0a4f00 in QWidget::event (this=0x34bce10, this@entry=0x31127e0, event=0x7ffff8d78d50, event@entry=0x4a1db00) at kernel/qwidget.cpp:8693
#37 0x00007f739c44e9fe in QFrame::event (this=this@entry=0x31127e0, e=e@entry=0x4a1db00) at widgets/qframe.cpp:557
#38 0x00007f739c4cacf3 in QAbstractScrollArea::event (this=0x31127e0, e=0x4a1db00) at widgets/qabstractscrollarea.cpp:996
#39 0x00007f739c05511c in QApplicationPrivate::notify_helper (this=this@entry=0x188bc40, receiver=receiver@entry=0x31127e0, e=e@entry=0x4a1db00) at kernel/qapplication.cpp:4570
#40 0x00007f739c05b870 in QApplication::notify (this=this@entry=0x1879030, receiver=receiver@entry=0x31127e0, e=e@entry=0x4a1db00) at kernel/qapplication.cpp:4356
#41 0x00007f739d9b657a in KApplication::notify (this=0x1879030, receiver=0x31127e0, event=0x4a1db00) at ../../kdeui/kernel/kapplication.cpp:311
#42 0x00007f739ccc886d in QCoreApplication::notifyInternal (this=0x1879030, receiver=receiver@entry=0x31127e0, event=event@entry=0x4a1db00) at kernel/qcoreapplication.cpp:953
#43 0x00007f739cccbf41 in sendEvent (event=0x4a1db00, receiver=0x31127e0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
---Type <return> to continue, or q <return> to quit---
#44 QCoreApplicationPrivate::sendPostedEvents (receiver=0x31127e0, event_type=event_type@entry=77, data=0x1819f30) at kernel/qcoreapplication.cpp:1577
#45 0x00007f739cccc3d3 in QCoreApplication::sendPostedEvents (receiver=<optimized out>, event_type=event_type@entry=77) at kernel/qcoreapplication.cpp:1470
#46 0x00007f739c633293 in dispatchPendingUpdateRequests (this=0x3024560) at ../../include/QtGui/private/../../../src/gui/graphicsview/qgraphicsview_p.h:200
#47 QGraphicsScenePrivate::_q_processDirtyItems (this=0x1954250) at graphicsview/qgraphicsscene.cpp:515
#48 0x00007f739c636e19 in QGraphicsScene::qt_static_metacall (_o=0x34bce10, _id=-120091312, _a=0x7ffff8d78c28, _c=<optimized out>) at .moc/release-shared/moc_qgraphicsscene.cpp:106
#49 0x00007f739cce0f41 in QObject::event (this=this@entry=0x1a8eb10, e=e@entry=0x499c2c0) at kernel/qobject.cpp:1222
#50 0x00007f739c644f3b in QGraphicsScene::event (this=0x1a8eb10, event=0x499c2c0) at graphicsview/qgraphicsscene.cpp:3565
#51 0x00007f739c05511c in QApplicationPrivate::notify_helper (this=this@entry=0x188bc40, receiver=receiver@entry=0x1a8eb10, e=e@entry=0x499c2c0) at kernel/qapplication.cpp:4570
#52 0x00007f739c05b870 in QApplication::notify (this=this@entry=0x1879030, receiver=receiver@entry=0x1a8eb10, e=e@entry=0x499c2c0) at kernel/qapplication.cpp:4356
#53 0x00007f739d9b657a in KApplication::notify (this=0x1879030, receiver=0x1a8eb10, event=0x499c2c0) at ../../kdeui/kernel/kapplication.cpp:311
#54 0x00007f739ccc886d in QCoreApplication::notifyInternal (this=0x1879030, receiver=receiver@entry=0x1a8eb10, event=event@entry=0x499c2c0) at kernel/qcoreapplication.cpp:953
#55 0x00007f739cccbf41 in sendEvent (event=0x499c2c0, receiver=0x1a8eb10) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#56 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x1819f30) at kernel/qcoreapplication.cpp:1577
#57 0x00007f739cccc3d3 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1470
#58 0x00007f739ccf5ed3 in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#59 postEventSourceDispatch (s=0x1891910) at kernel/qeventdispatcher_glib.cpp:287
#60 0x00007f73938f1c1d in g_main_dispatch (context=0x188f5f0) at /build/buildd/glib2.0-2.41.5/./glib/gmain.c:3064
#61 g_main_context_dispatch (context=context@entry=0x188f5f0) at /build/buildd/glib2.0-2.41.5/./glib/gmain.c:3663
#62 0x00007f73938f1f08 in g_main_context_iterate (context=context@entry=0x188f5f0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at /build/buildd/glib2.0-2.41.5/./glib/gmain.c:3734
#63 0x00007f73938f1fbc in g_main_context_iteration (context=0x188f5f0, may_block=1) at /build/buildd/glib2.0-2.41.5/./glib/gmain.c:3795
#64 0x00007f739ccf6031 in QEventDispatcherGlib::processEvents (this=0x181b830, flags=...) at kernel/qeventdispatcher_glib.cpp:434
#65 0x00007f739c0f84e6 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#66 0x00007f739ccc74f1 in QEventLoop::processEvents (this=this@entry=0x7ffff8d7c320, flags=...) at kernel/qeventloop.cpp:149
#67 0x00007f739ccc7805 in QEventLoop::exec (this=this@entry=0x7ffff8d7c320, flags=...) at kernel/qeventloop.cpp:204
#68 0x00007f739ccccf67 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1225
#69 0x00007f739c0534dc in QApplication::exec () at kernel/qapplication.cpp:3828
#70 0x00007f73a04ca46d in kdemain (argc=1, argv=0x7ffff8d7c558) at ../../../../plasma/desktop/shell/main.cpp:126
#71 0x00007f73a00e6ec5 in __libc_start_main (main=0x4006e0 <main(int, char**)>, argc=1, argv=0x7ffff8d7c558, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7ffff8d7c548) at libc-start.c:287
#72 0x000000000040070e in _start ()


Reproducible: Always

Steps to Reproduce:
1. Start connecting to VPN (or some network that takes a long time to connect to)
2. 
3.

Actual Results:  
plasma-desktop uses up a lot of CPU

Expected Results:  
There shouldn't be any noticeable CPU usage for such a tiny animation
Comment 1 Jan Grulich 2014-10-02 07:31:41 UTC

*** This bug has been marked as a duplicate of bug 333752 ***
Comment 2 Jan Grulich 2014-10-02 07:35:15 UTC

*** This bug has been marked as a duplicate of bug 336274 ***