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

[BUG] High cpu usage whith an offset that is not zero in i3 #667

Open
3 tasks done
Hackeitos opened this issue Jan 19, 2023 · 4 comments
Open
3 tasks done

[BUG] High cpu usage whith an offset that is not zero in i3 #667

Hackeitos opened this issue Jan 19, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@Hackeitos
Copy link

Hackeitos commented Jan 19, 2023

Checklist before submitting an issue

  • I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
  • I have specifically verified that this bug is not a common user error
  • I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)

Description of the bug

Title says it all. Cpu jumps to about 19-23% when using an offset in a bar that is not zero. When changing the offset back to zero cpu usage is 4-5%.

Tested with the following:

  • CPU: AMD Ryzen 5 5600X
  • GPU: NVIDIA GeForce RTX 3060 Ti Lite Hash Rate with nvidia-dkms 525.78.01-1
  • eww version: eww 0.4.0 d58d91d
  • Xorg server version: 21.1.6-1
  • i3 version: 4.22 (2023-01-02)

Reproducing the issue

Using this config:

(defwindow bar
  :stacking "bg"
  :geometry (geometry
    :x "0px"
    :y "0px"
    :width "100%"
    :height "40px"
    :anchor "top left"
  )
  :reserve (struts :side "top" :distance "40px")
  (box)
)

Everything works normally. However, setting geometry.x and/or geometry.y to something non-zero makes eww, xorg and i3 use a significant amount of cpu.

Expected behaviour

Cpu usage to be about the same both with and without offset.

Additional context

With non-zero offset:
image
About 20% total cpu usage and 54ºC cpu temperature.

With zero offset:
image
About 4% total cpu usage and 40ºC cpu temperature.

EDIT: Saw another issue which attached a flamegraph. Turns out them flamegraphs are pretty easy to do, so I made these:
With offset:
flamegraph-with-offset

Without offset:
flamegraph-no-offset

Seems like g_signal_emit_valist might be the culprit. I don't know if this is an issue with eww or gtk, so I would appreciate if someone could shine some light about this.

@Hackeitos Hackeitos added the bug Something isn't working label Jan 19, 2023
@tkapias
Copy link

tkapias commented Jan 19, 2023

I use offsets and do not notice any load because of it.

  • Eww use around 0.6-1% most of the time.

  • also note that in my experience i3 does not exceed 1% consumption, even on 12 years old hardware. Yours use 14%.

(defwindow bar
    :monitor "0"
    :geometry (geometry
                  :x "-67px"
                  :y "180px"
                  :width "140px"
                  :anchor "top right"
              )
    :stacking "bg"
    :focusable false
    :reserve (struts 
                 :distance "0px"
                 :side "right"
             )
    :windowtype "dock"
    :wm-ignore true
    (top)
)

@Hackeitos
Copy link
Author

Hackeitos commented Jan 19, 2023

Putting :wm-ignore true seems to fix the high load issue. Maybe i3 and eww are 'fighting' each other to position the bar in a loop, which then causes the high cpu usage. But not an actual solution since I (and surely other many people) do not want that option set.

@tkapias
Copy link

tkapias commented Jan 20, 2023

I use :wm-ignore true because my main window is a vertical dock; and currently i3 does not support vertical docks. There is an issue about this in eww and i3.

@elkowar
Copy link
Owner

elkowar commented Feb 24, 2023

Putting :wm-ignore true seems to fix the high load issue. Maybe i3 and eww are 'fighting' each other to position the bar in a loop, which then causes the high cpu usage. But not an actual solution since I (and surely other many people) do not want that option set.

I think that is In fact what's going on, i3 specifically seems really happy to just spam moving my windows around for no reason... I'll need to look into a better fix here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants