High CPU use on idle
While doing nothing on my PC the program sits around 4% CPU use. It seems a bit high for a basic utility service that has to run always.
Can't reproduce
The specific script is one of the input-remapper-service processes.
(There are 3 running, interesting to note here these kernel workers are the only ones on my system that say events_unbound)
root 12527 0.1 0.2 2132092 34588 ? Sl 09:50 0:00 /usr/bin/python3 /usr/bin/input-remapper-service --hide-info
root 12528 0.0 0.1 50264 21644 ? S 09:50 0:00 /usr/bin/python3 /usr/bin/input-remapper-service --hide-info
root 12536 2.8 0.0 0 0 ? I 09:50 0:07 [kworker/u8:2-events_unbound]
root 12612 1.4 0.0 0 0 ? I 09:50 0:03 [kworker/u8:4-events_unbound]
root 13042 2.9 0.1 2132092 26064 ? S 09:51 0:05 /usr/bin/python3 /usr/bin/input-remapper-service --hide-info
Version Info:
> python --version
Python 3.9.7
> uname -srvmo
Linux 5.10.0-13-amd64 #1 SMP Debian 5.10.106-1 (2022-03-17) x86_64 GNU/Linux
> lsb_release -d
Description: Debian GNU/Linux 11 (bullseye)
I'd like to try and figure out how to get the python debugger attached to the service so I can see what code we seem to be constantly hitting. I'll see how that goes.
I guess it might matter, I am only remapping one device- a Logitech M570

I have CPU usage 1-2% on my Intel i7-9850H (12) @ 4.600GHz
Seems like a lot, right? Any idea how to reduce this? I am ready to help with debugging.
There are apparently ways to profile python applications. I haven't done it myself yet though, so I don't know how it works.
If you research into it, make sure to profile the beta branch, not main
If anyone can come up with a small guide on how to get profiling data for input-remapper-service it would also be of help already, even if the cause is not found yet
Restarted service and problem gone. Can't reproduce for now. I did not switched to beta. I will let you know if find out something new
Allright, thanks.
Profiling might have to work across multiple processes.
In the case of coverage this is just a matter of configuration, so maybe some profiling tool has some tricks as well to get it to work with the multiprocessing module.
By the way, for me "Idle" would be defined as "no injection started, no autoload, no apply-button-click, no input-remapper-gtk running"
I have mappings for 2 keyboards and also I had a mouse button mapping. Now mouse was unplugged. When i connect it, CPU goes from 0% to 0.7%, and when i moving cursor with exactly this mouse (not a touch-pad) - it goes up to 4% (depending how intensive i moving)
UPD: same thing on Beta branch
I get ~100% CPU load when I unplug the device with the GUI open. Fedora 36, input-remapper 1.5.0, python-evdev 1.6.0

As for profiling, I've never done it myself but it could be as easy as calling the module/app through cProfile: python -m cProfile script.py
Should I open another issue? My problem only occurs if there is an active injection.
This is a different problem, yeah, please open a separate issue
@TacticalCode has provided an example on how python can be profiled: https://github.com/sezanzeb/input-remapper/issues/527
In this case, cProfile.run needs to be added to the bin/input-remappser-service file, possibly wrapping daemon.run()