Skip to content
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

Spikes in CPU usage of tmux on long uptimes attributed to tmux-battery #54

Open
BensonMuriithi opened this issue Jul 11, 2017 · 5 comments
Labels

Comments

@BensonMuriithi
Copy link

BensonMuriithi commented Jul 11, 2017

I had been having a problem with tmux whereby after it being running for periods of upwards of 12 or 24 hours I would observe spikes in cpu usage and it would always be caused by tmux. Cpu usage would oscillate between 15% to 80% in 2 seconds and keep on doing so. Similar problems were being faced by users of powerline with tmux. I however don't so I thought it could be tmux-battery as I don't have any intensive plugins and after removing it from the statusline the load vanished.
My .tmux.conf relevant to this is below; the rest doesn't seem to be part of the problem.

#commented out setting including tmux-battery use
#set -g status-right '#{battery_status_fg}Batt:#{battery_icon} #{battery_percentage}\
 #[fg=colour114]cont:#{continuum_status}\
 #[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M '

#after removing the use of tmux-battery
set -g status-right '\
#[fg=colour114]cont:#{continuum_status}\
 #[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M '
@martinbeentjes
Copy link
Collaborator

martinbeentjes commented Jul 12, 2017

That is strange behavior, there is an old issue with a same status. So when you remove the tmux-battery related parameters from your status-right the CPU spikes disappear? Did you test any of those three parameters you used?

@BensonMuriithi
Copy link
Author

BensonMuriithi commented Jul 12, 2017

The spikes stopped when I removed the uses of tmux-battery without any further intervention. I've since had tmux running for more than 50 hours and it's all ok. I did try disbaling each of the three flags separately and resourcing. I noticed that for each removed flag the spikes in cpu use would be smaller - peaking at 50% - but were still present. Disabling any two flags simultaneously would reduce the spikes just a bit more. I did however not notice any flag to have any greater consequence than any of the other two.

I should add that though most times the issue occurred with the battery fully charged, it would not stop even after the battery would then start discharging to any level or even charging again. The indicators are also accurate and in line with the system indicators.

@martinbeentjes
Copy link
Collaborator

martinbeentjes commented Sep 4, 2017

In the recent days I have been recognizing this behavior myself as well. For me it is not a single spike. I was monitoring the system for a while and it kept peaking at 100% for quite a while. And when I closed tmux, the CPU usage went back to normal.

And having my terminal doing the things I always do, does not make my CPU usage peak at all. I have not ruled out the reason for my personal problem. I will look into the question if it is caused by tmux-battery. I'll keep this updated.

@rux616
Copy link
Contributor

rux616 commented Feb 21, 2019

I was just experiencing a similar (though not as extreme) symptom. I am using Fedora 29 and when using upower to check the battery, I saw about an average 5% bump in sustained CPU usage. When I changed the scripts locally to call acpi instead, my CPU usage dropped down to my baseline again.

Has anyone else seen this? Would this be a good reason to use acpi instead of upower as the first choice?

@martinbeentjes
Copy link
Collaborator

martinbeentjes commented Feb 21, 2019

@rux616 Thank you for your comment. When Googling on excessive power usage of upower it seems to be a general problem. I see bug reports from back in 2011, some in 2014.

If acpi and upower are available on a machine and acpi does not cause those cpu and memory spikes, then choosing acpi over upower seems okay to me.

The comment https://bugs.launchpad.net/ubuntu/+source/upower/+bug/876279/comments/7 also tells something interesting: a possible flooding of monitoring events on the battery.

I am curious if we could get to know what exactly causes upower to randomly request this amount of cpu.

@martinbeentjes martinbeentjes changed the title spikes in cpu usage of tmux on long uptimes attributed to tmux-battery Spikes in CPU usage of tmux on long uptimes attributed to tmux-battery Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants