-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tccd uses 3% CPU continuously #37
Comments
Hello, this is in percentage of one logical core right? It is not clear what your exact issue is. Does this affect the performance of other programs you run? How is the CPU usage during other types of load? Does it have a noticeable effect on energy performance for you? |
Same here ~2.8% of a logical core v1.0.3. |
We just received our 2nd InfinityBook S 14 v5 with a 4 core Intel i7-10510U which shows the same behavior.
Yes,
No.
It goes down to about 1%. To reproduce use e.g.
This is hard to measure, as you know. Moreover, I have only very limited time where I can test the hardware before I have to give it to the users we bought it for. Anyway, 3% for a program that I expect to idle (especially when the system is idling) seems like too much. BTW, I am not running the Control Center GUI, not even the tray icon. BTW2, I realized the Awk command in OP does not work well in Mawk which is the default at least on the Tuxedo Budgie I received:
|
Right. Of course it is idling for the most part. According to previous profiling the "heaviest" part is the fan control. This is, of course, idling for the most part as well but spends some time reading/writing to the hardware, which I believe should not actually be CPU intensive. How often to do this is a balance between responsiveness, "smoothness" and being lean. I'll have a look in between on what can be further optimized. Otherwise please let me know if there are any concrete noticeable issues regarding energy performance. Our aim is of course to have all passive processes (tccd and the tray) use the least amount of resources while providing their benefits. Note: With GUI, especially on the dashboard, more communication is done with tccd. |
I have the same situation where tccd takes around 5-10% cpu at all times. After some fiddling I was able to run the service without having it packaged so that I could use the node profiler (using
An overview of the results are
So, there are a few things to note from the results
from what I can tell, the using
I could be wrong about what is going on however. I haven't written any node applications so there may be some things I'm missing. |
Having the same behavior (~4 % constant CPU usage) on my Infinity Book with Ubuntu 18. Control center is not running. I saw no updates on the issue for quite some time. Is the current status that it is an expected / to be tolerated behavior? |
I would still be interested in looking more into this at some point but it's a bit disheartening that there is no communication from tuxedo computers (my first pull request has been sitting idle for 5 months). If a simpler c++ daemon was written that would be easier to profile as there would be no node runtime polluting things and it might turn out that node was the culprit anyway, meaning the problem would automatically be solved by this c++ daemon. The first step to achieve this is to move the configuration state out of the typescript code and into configuration files so that TCC and tccd aren't so coupled. That's what my pull request #44 starts to do |
Hi @mbway I don't get high cpu usage, but I'm using a ryzen 3900x. If you try to increase this value from 500 to, 3000 for example:
Do you get a reduction in cpu usage? It seems there a lot of IO fetch happening there every 500ms and dbus-next is the library being used to do that. So I'm not sure if its their code or something on their dbus-library which could be blocking somewhere. |
I just bought a InfinityBook S 15, very nice hardware. With help of powertop I got the power consumption down to about 5 W, mostly screen and keyboard backlight. Is nodejs this inefficient? How often is the hardware polled, and can this be adjusted (I have a hard time finding anything in the code). |
@MartinLuethi maybe take a look here:
try increasing this time from 500 to something like 3000 to see if CPU usage reduces. |
Thanks! I tried this and it changed a lot! Never having used npm before, the instructions in the README are not sufficient. Missing packages were
|
Angular is very unperformant if not tamed (which is very hard to do). It can very well be angular. |
On my Infinity Book Pro 14 gen 6 tccd consumes more than 0.4W constantly, according to powertop. That's about as much as plasmashell, which does a lot more. On ~6.5W total idle consumption that's quite significant. And I too wonder about the choice to use web technology as Angular and Electron for a always-active background service on a device where power efficiency is a top priority. Wrong tool for the job? |
I think so too. Electron is a bad tool for the job. |
I have the same issue with tccd using constantly 5% CPU of my Infinity S17 Gen 6 :-( |
Same issue on pulse 14 |
Same issue on Polaris 17 - Gen1 and tuxedo-control-center 1.2.4 |
I have the impression that tccd is supposed to optimize battery life, but my Aura15 Gen 2 had a single CPU at 100% for tccd, and when I stopped the daemon the predicted life of the battery jumped from one hour to more than two, so it's a huge battery drain right now. |
This problem is still relevant as of TCC 2.1.6: tccd doesn't pin any core, however it consumes a contiguous 2% of total CPU (on a Pulse 15 gen2 with ryzen 7500U, kernel version doesn't seem to matter). Unfortunately this kills the battery life since it never allows the CPU to idle, and thus I am forced to disable tccd until this is solved. I have done some light digging and it seems that some peaks of CPU usage can be traced back to this line:
which seems to be regularly called, with a spike right after the command exits, sometimes upwards of 30/40% on various cores. I am on GNOME Wayland if it is relevant. |
Wow! In terms of performance, that code excerpt is horrible. |
WTF |
Thank you for the reply! Seems the command was a red herring, sorry about that. Still, TCC doesn't expose any kind of display settings for my device so seeing something polling X specific envvars was puzzling. Regarding usage, I may think that the difference may be in our setups since on mine, after not touching the laptop for ~20 minutes, My setup is the following:
As soon as I have some free time I'll give it a spin on X11 to see if something is different and poke around disabling some control features to see if I can narrow the cause. |
2.3 % CPU usage constantly. InfinityBook S 17 Gen7/NS5x_7xPU, BIOS 1.07.09RTR2 11/17/2022 |
I'd start by limiting the number of pid to get information from. The more processes running the worst this piece of code runs and that's a huge no-no. I have quite some ideas here, so I'll try building tccd in my system and test them. Edit: |
@tuxedoder, I made a proposal @ #362 . Check it when able please. |
It was the goal to not display certain settings when wayland is used.
Thank you for your suggestions, I will check it next week. |
Any news? |
Not yet. I was trying to at least test it this friday. Didn't have time due to other tasks. |
@tuxedoder Any news? |
I did try to gather information before I reply today. I think I managed to make it a little faster with your suggestions. All benchmarks ran sequentially without waiting periods with |
Regardless of how many PID you try, I don't know how you only get |
I mainly did it for benchmarking purposes. The goal was to limit the maximum.
Currently I have 182 if I do |
OK. You have about a third than me and maybe more powerful CPU and also how much I limit my CPU. |
@tuxedoder Were you able to find a solution? |
@tuxedoder News? |
I don't have news yet. If there aren't more suggestions I would add the fastest pgrep command later at some point after some more testing. |
The provided command didn't work on my system.
I fixed it by removing quotes like the screenshot shows.
When I run that command in my cli without su I get:
So I added an additional
I tested hyperfine with
Your new approach seems faster by ~41% if I take the hyperfine benchmarks and that aligns with your ~52%. If I take multitime numbers it is only ~26% for some reason. Thanks for the suggestion, since it is faster on average I will try to get that into the code after some more testing. |
I tested it with root running it. Isn't that the user that runs the command? |
@tuxedoder News? |
The command is for tccd and tccd runs with root. My intent was to showcase what happens if a path is not available and that
I tried to make a new release soon which should also fix 2 other unrelated issues. I also noticed a few things related to the display worker and adjusted code a bit, but that was rather bug fixing. |
I've been using 2.1.8 for a while now. From what I got, the % CPU used by tccd has improved significantly. It was doing spikes of 10-12% with continuous 2-5% and now it's been doing spikes of 5% with continuous 2-3% (according to Htop). I still don't know what else it's doing that causes those spikes. @tuxedoder What is it programmed to do periodically? Maybe every second. |
Sorry for the late reply, I was actually trying to improve code and gather data. To answer the question,
There are a few more but aren't always active, only when requested via
While I was working on rewriting the fan control to properly add a new fan api to control new devices, I did notice that it does vary a lot across devices. While reworking the fan code, I also tried to improve performance. Notable changes to reduce calls between
Some results:
node profiler with 2.1.10 + new fan control on the IBS17 Gen7 (ACPI)
node profiler with 2.1.10 + new fan control on the Pulse14 Gen3 (direct)
node profiler with 2.1.10 + new fan control on the Pulse15 Gen1 (WMI)
`strace` with 2.1.10 on the Pulse 14 Gen 3 (direct)
`strace` with 2.1.10 + new fan control on the Pulse 14 Gen 3 (direct)
`strace` with 2.1.10 on the Polaris 15 Gen 3 (WMI)
`strace` with 2.1.10 + new fan control on the Polaris 15 Gen 3 (WMI)
`strace` with 2.1.10 on the IBS17 Gen 7 (ACPI)
`strace` with 2.1.10 + new fan control on the IBS17 Gen 7 (ACPI)
`strace` with 2.1.10 on the Aura 15 Gen2 (ACPI)
`strace` with 2.1.10 + new fan control on the Aura 15 Gen2 (ACPI)
`strace` with 2.1.10 on the Gemini 17 Gen1 (ACPI)
`strace` with 2.1.10 + new fan control on the Gemini 17 Gen1 (ACPI)
These just mainly show that usage mainly comes from C++ and ioctl, but also shows the improvement of the new fan control. Further analysis with
`perf` with 2.1.10 on the IBS17 Gen 7 (ACPI)
`perf` with 2.1.10 + new fan control on the IBS17 Gen 7 (ACPI)
`perf` with 2.1.10 + new fan control on the Pulse 14 Gen 3 (direct)
`perf` with 2.1.10 + new fan control on the Pulse 15 Gen 1 (WMI)
`perf` with 2.1.10 on the Gemini 17 Gen 1 (ACPI)
`perf` with 2.1.10 + new fan control on the Gemini 17 Gen 1 (ACPI)
To be transparent I included a lot of my measurements, but only kept the important parts due to github text limits. The graphs look different between some measurements because different approaches are used depending on the laptop, because of different EC. For the WMI and ACPI api
To further lower tccd usage, you can disable fan control in tcc globally, then fans will be in auto mode instead and Keep in mind that I am primarily a TypeScript dev and I wasn't involved with kernel, driver, acpi, wmi or firmware development, so my knowledge in code below Not sure when my new code will release, since it isn't finished yet. It took me a while to gather all of this, but I wanted to explain it a bit more indepth. One last idea that I have is to not write fan speed if it is unchanged. |
Issue was probably closed since I finished the fan control internally, but it isn't released yet. I will leave the issue open until the code is public. It was planned to update dependencies (angular, electron, node, ...) and fan control at once, since both are rather big changes. Updating the fan speed values on changes seemingly further helped on some devices. To test the impact of partially writing values I ran The dependency branch isn't finished yet, so these numbers aren't final, but I don't think the
I observed around roughly 1% or less for most devices on average during development with |
I'm sorry if this would be better asked elsewhere (the tuxedo-drivers repository perhaps?) but since you seem to know about this (and it's somewhat relevant to this issue, at least for Sirius users), I figured I might as well ask here: The "high CPU usage" with Sirius that you speak of is/was related to implementing fan control for Sirius at the driver level, right? Since fan control is now available for Sirius, I assume a way has been found to implement it without causing the high CPU usage? Is there perhaps some more information about the issue and how it was fixed that you could point me to? I'm mainly interested because I've put in an order for a Sirius Gen2 and am trying to learn about potential culprits in advance (and even if this issue may now be fixed, it still interests me). Also, does that mean that Sirius will see similarly low tccd CPU usage as the other devices once this new TCC release is made? Finally, is there any timeframe for the release? |
I was referring to the fan implementation in
Because of that
The fan rework won't do a lot on a Sirius, because
I assume you mean the fan rework and dependency update, because |
We received an InfinityBook S 14 v5 installed w/ Tuxedo Ubuntu Budgie 20.04 and we observed the following also on the same hardware with a fresh installation of Tuxedo Ubuntu 20.04 (i.e. w/ GNOME 3):
tccd
continuously uses about 3% CPU according totop
.The text was updated successfully, but these errors were encountered: