machinekit / EMCApplication

Machinekit Featured Application for Enhanced Motion Controller from LinuxCNC
GNU General Public License v2.0
14 stars 11 forks source link

Higher CPU usage across the board #12

Open jallwine opened 3 years ago

jallwine commented 3 years ago

I've been working on making the switch from the archived version of Machinekit (pre HAL/CNC split) to Machinekit-HAL+EMCApplication on the Beaglebone Black. Besides the differences in implementation, there are a number of changes involved in my setup including upgrading to Debian Buster (from Stretch), Python 3 vs 2 and a newer kernel (though still 4.19). Across the board, I'm seeing higher CPU usage for key processes such as the rtapi, milltask, halui and other Python processes. I went from a system that is >90% idle when LinuxCNC is running but not doing anything, to a system that is <60% idle in a similar state. I know there could be a number of contributing factors, but I wanted to reach out and see if anyone had any thoughts on any obvious things to check that could improve performance. milltask seems to be the greatest offender going from ~2% CPU usage to ~17% CPU usage. rtapi went from about 16% up to 21%. halui from ~.5% to ~3%. Any ideas?

cerna commented 3 years ago

I have been scratching my head about this report, but I have no idea.

My first reaction would be to blame the system upgrade (which is unfortunate, as I will need to deprecate the Debian Stretch sooner than later because of the Python 3.5 end of life) or the Python. (I guess that you are not modifying the EMCApplication Debian packaging and thus using the Python2, right?)

jallwine commented 3 years ago

I built EMCApplication from source using this configure command in order to get it working with Python 3:

./configure --with-hal=machinekit-hal --with-python=python3 --with-boost-python=boost_python-py37
jallwine commented 3 years ago

I'm also using this version of machinekit-hal in order to use Python 3: machinekit-hal=0.4.21020-1.git941bffc90~buster

jallwine commented 3 years ago

I'm trying to simply install the emcapplication packages to test Python 2, but I'm getting these errors:

emcapplication : Depends: machinekit-hal (= 0.4.20868-1.gitc2e248500~buster) but 0.4.21020-1.git941bffc90~buster is to be installed
              Recommends: linuxcnc-doc-en but it is not installable or
                          linuxcnc-doc but it is not installable
              Recommends: machinekit-hal-dev (= 0.4.20868-1.gitc2e248500~buster) but it is not going to be installed
jallwine commented 3 years ago

Ok, after manually installing those specific versions of machinekit-hal and machinekit-hal-dev, I was able to start LinuxCNC and the idle time seems to have improved by a couple percent. Don't see exactly where the improvements are, probably miscellaneous lower CPU usage python tasks. rtapi, milltask, and halui still seem be about the same and seem to be the main performance hit.