Performance issue with plasmoid and dataengine combination

Evgeniy Alekseev i at arcanis.me
Tue Jan 26 11:47:21 UTC 2016


Hi there,

I'm experiencing the following performance issue with one of my pet project 
[1]. After some time plasmashell (some times it happens after 1 day uptime, 
sometime more) uses one CPU core on 100% without any additional actions from 
my side. The same issue was observed by at least one of users, in other hand I 
should note that on my another PC there is no such issue. 

After some debugging I've found that this issue is accompanied by increasing 
queue of updates from DataEngine which was still not processed. I suppose the 
issue is caused by the fact that my plasmoid is being subscribed on updates 
from about 100 sources from systemmonitor DataEngine. 

The issue occurs only for KF5 version (KDE4 version is not affected by this 
issue). And still persists even I increase update interval (I've tried to set 
it to 5 sec instead of default 1 sec), or even if I use QtConcurrent to work 
with received data from DataEngine. Also I should note that all methods 
related to DataEngine functions take place in C++ part of the widget (because 
it is recommended to avoid many C++ calls from QML code).

I suppose that *probably* if I will use less sources it will solve the issue, 
but I'm not sure in it (unfortunately it will take some time to change 
architecture to use only user requested sources). 

Are there any other possibilities which I may check to avoid this issue? Or is 
it possible that the problem maybe in DataEngine mechanics (e.g. DataEngine 
freezes updates when screen is locked and send all missing data after screen 
unlock)? Or maybe I just misuse DataEngine and there are better practice for 
my case?

The code which I use the following. Here is I create connection [2]:

Plasma::DataEngineConsumer *deConsumer = new Plasma::DataEngineConsumer();    
m_dataEngines[QString("systemmonitor")] = 
	deConsumer->dataEngine(QString("systemmonitor"));

And connect all available sources (sources which are not used will be dropped 
later by using DataEngine::disconnectSource() method) [3]:

m_dataEngines[QString("systemmonitor")]->connectAllSources(parent(),
                                                               m_interval);

And finally the following method is used to connect DataEngine update signal 
and update slot [4]:

void AWKeys::dataUpdated(const QString &sourceName,
                         const Plasma::DataEngine::Data &data)
{
	QtConcurrent::run(m_threadPool, this, &AWKeys::setDataBySource,
				sourceName, data);
}

1. https://github.com/arcan1s/awesome-widgets
2. https://github.com/arcan1s/awesome-widgets/blob/development/sources/
awesome-widget/plugin/awdataengineaggregator.cpp#L87
3. https://github.com/arcan1s/awesome-widgets/blob/development/sources/
awesome-widget/plugin/awdataengineaggregator.cpp#L76
4. https://github.com/arcan1s/awesome-widgets/blob/development/sources/
awesome-widget/plugin/awkeys.cpp#L424
-- 
Sincerely yours,
Evgeniy Alekseev

email: i at arcanis.me
ICQ: 407-398-235
Jabber: arcanis at jabber.ru


More information about the Plasma-devel mailing list