Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(cpu): Add %percentage-sum%#1517

Merged
patrick96 merged 4 commits into
polybar:masterfrom
BigRedEye:master
Dec 3, 2018
Merged

feat(cpu): Add %percentage-sum%#1517
patrick96 merged 4 commits into
polybar:masterfrom
BigRedEye:master

Conversation

@BigRedEye

@BigRedEye BigRedEye commented Nov 19, 2018

Copy link
Copy Markdown
Contributor

Adding option not to normalize cpu usage (#1516)

EDIT: Closes #1516

@codecov-io

codecov-io commented Nov 19, 2018

Copy link
Copy Markdown

Codecov Report

Merging #1517 into master will increase coverage by 17.68%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #1517       +/-   ##
==========================================
+ Coverage    5.92%   23.6%   +17.68%     
==========================================
  Files         162      50      -112     
  Lines        9037    2067     -6970     
==========================================
- Hits          535     488       -47     
+ Misses       8502    1579     -6923
Flag Coverage Δ
#unittests 23.6% <ø> (+17.68%) ⬆️
Impacted Files Coverage Δ
src/x11/connection.cpp 0.95% <0%> (-0.01%) ⬇️
include/events/signal.hpp 0% <0%> (ø) ⬆️
include/events/signal_receiver.hpp 0% <0%> (ø) ⬆️
include/components/config.hpp 0% <0%> (ø) ⬆️
include/x11/connection.hpp 0% <0%> (ø) ⬆️
include/x11/extensions/xkb.hpp 0% <0%> (ø) ⬆️
include/events/types.hpp
src/modules/xbacklight.cpp
include/modules/temperature.hpp
include/modules/date.hpp
... and 116 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f8e4a59...1084059. Read the comment docs.

@patrick96 patrick96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah crap! Was just about to merge this, but I just realized normalize-load = false breaks <ramp-load>, the ramp does not scale properly anymore (since it assumes a 100% max load).

Could you please adapt your code to instead add a new token %percentage-total% that gives you the non-normalized value. I think this approach would be cleaner and more isolated.

@TheSilvus

Copy link
Copy Markdown

This could alternatively be implemented as a separate token (e.g. %percentage-sum%).

      m_label->replace_token("%percentage-sum%", to_string(static_cast<int>(m_total * static_cast<float>(cores_n) + 0.5)));

I'd argue that this would be a simpler solution - it does not require adding another config option.

@patrick96

Copy link
Copy Markdown
Member

@TheSilvus that is what I proposed as well 😉

@patrick96 patrick96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Also a lot less code than the other variant.

@patrick96 patrick96 merged commit cc8947a into polybar:master Dec 3, 2018
@patrick96 patrick96 changed the title feat(cpu): Add normalize-load feat(cpu): Add %percentage-sum% Dec 11, 2018
patrick96 added a commit that referenced this pull request Dec 23, 2018
### Breaking Changes:
None

### Changelog

**New Config Options**
The following config options were added

In the `[settings]` section:
* `pseudo-transparency`

In `internal/cpu`:
* `ramp-coreload-spacing`, spacing between elements in `<ramp-coreload>` elements
* `%percentage-sum%` in `label`. Shows sum of all percentages

In `custom/script`:
* `double-click-left`
* `double-click-middle`
* `double-click-right`

In `internal/pulseaudio`:
* `interval`, volume increase and decrease steps in percentage points

In `internal/memory`:
* `bar-swap-used`
* `bar-swap-free`
* `ramp-swap-used`
* `ramp-swap-free`

**Deprecations**
* `tray-transparent` in the bar section is no longer used. The tray now always uses pseudo-transparency

**Features**
* volume: adjustable volume steps (#1364), see #1361
* memory: Add progress bars and ramps for swap (#1325)
* render: pseudo-transparency (always used in the tray)  (#595)
* cpu: 
    * Configurable spacing in between coreloads (#1472), see #1389
    * Non-normalized cpu load (#1517), see #1516
* script: Double click actions (#1442)
* net: Support for bridge interfaces (#1528), see #1522
* token: zero pad tokens when min-width value starts with a `0` (#1341), see #1332

**Fixes**
* config: Use font patterns detected on system in sample config (#1350)
* net: Disconnected module when SSID is only an emoji (#1371), see #1367
* tray: Tray overlapping with bar (#1392), see #591
* build: Several build errors (#1395, #1454, #1470, polybar/xpp#12, #1493), see #1447, #1469, #750, #1492
* mpd: format-online-prefix not working (#1402), see #1399
* font: Crash for some font-patterns (#1451), see #1435
* script: 
    * Only `%counter%` or `%pid%` token usable, never both (#1456)
    * click actions with colons in them (#1457), see #984
* renderer: Bar locks up when xorg composite extension is disabled (#1430), see #1425
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants