Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsCPC Timer Handler - linux thread performance
https://www.eclipse.org/forums/index.php/mv/msg/1087730/1768916/#msg_1768916
I am currently doing some performance analysis on a Forte implementation in an embedded environment and have found that the CPCTimerHandler thread seems to be a performance hog even when no forte resources are currently running. Is this an expected behaviour? It is my understanding that the thread is used to notify timer function blocks which should not be required when no resources are running.
Has anyone had similar findings? I have done a bit of hacking around with the enable/disableHandler functions in an attempt to mitigate unnecessary cpu usage by this timer thread with some success but am concerned these changes may effect other interactions that I am not familiar with.
Specifically, enabling the TimerHandler from the CEventchainExecutionThread constructor if a resource will be loaded and and disabling the timer from the createDev function in posix/main.cpp.
Any input on problems with my understanding or consequences with the suggested workaround are greatly appreciated. Has anyone had luck improving the efficiency of the posix CPCTimerHandler::run function?]]>Todd Cunningham2017-07-25T01:00:58-00:00Re: CPC Timer Handler - linux thread performance
https://www.eclipse.org/forums/index.php/mv/msg/1087730/1769009/#msg_1769009
thanks for pointing this out. It should definitely not take away the full performance an the intention is that the thread is sleeping most of the time and only woken up with x ticks per second. For posix targets we are using nanosleep for this task. In addition to informing timed fbs the timer handler is also in charge of maintainig a platform independent version of time. Which can be used in algorithms to perform some low precision measurements.
I had a quick look at the code and I noticed that one performance issue is the cirtical region which is entered in 89 of timerha.cpp. A solution that could improve the situation is to change line 88 to: "if (0 != m_pstTimedFBList){"
Would you mind giving it a try and let us know if it brings some improvements?
]]>Alois Zoitl2017-07-25T15:41:01-00:00Re: CPC Timer Handler - linux thread performance
https://www.eclipse.org/forums/index.php/mv/msg/1087730/1769038/#msg_1769038
Thanks for the suggestion and other information. I tinkered it a bit more and ended up finding some decent improvement by cutting our ticks per second to 100 rather than 1000 as 10ms resolution should be fine for our purposes and decreased the usage by about 75% (~2% CPU to ~0.4%). Your suggestion also offered some performance improvement (seems to be about 5~10%) when no resources are running. Performance when >0 resources are running is roughly equal, which if I understand correctly is expected.
To build off what I mentioned before, though I'm not sure it would be very straightforward to implement into the current architechture, from a conceptual standpoint I think it makes sense to only run the timer when there are resources using it.
I believe these updates will work for my needs at the moment. Thanks again!
]]>Todd Cunningham2017-07-26T05:07:31-00:00Re: CPC Timer Handler - linux thread performance
https://www.eclipse.org/forums/index.php/mv/msg/1087730/1769076/#msg_1769076
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=520202]]>Alois Zoitl2017-07-26T10:03:08-00:00