Commit graph

8 commits

Author SHA1 Message Date
Doug Torrance bdfca9d3d0 wmmon: Only compute vertical position of hint lines once.
The system load monitor displays green hint lines at every 100 units once
load average rises above 100.

Previously, the vertical position of these lines was computed before
each and every pixel was drawn.  But since the horizontal position
isn't needed for this computation, we move it up a level to the
outer for loop.
2018-04-11 00:06:58 +01:00
Doug Torrance 7354c4df53 wmmon: Properly compute height of system load window.
Previously, we looped through the history and added 100 whenever we found
a larger value.  This has a number of problems.  In particular,
* We get a maximum possible value of 5500 (100 * the number of values in
  the history).  It is certainly possible to have a system load north of
  this on modern systems.
* If the system load in history were to jump by more than 100 in a single
  step, then we wouldn't be adding enough.  For example, suppose the
  system load in history is 175, and our height was previously computed
  to be 200.  Suppose the next value in history is 320.  We would add
  100 to get a new height of 300, which isn't sufficient to display the
  320.

The fix is simple -- replace the if statement with a while loop, i.e.,
continue adding 100 until we get a height that fits our value.
2018-04-11 00:06:49 +01:00
Doug Torrance 3ec1a9cde3 wmmon: Fix jiffy counter overflowing long on 32-bit systems.
Based on patch by Pedro Gimeno Fortea for Debian bug #670151 [1].

[1] https://bugs.debian.org/670151
2017-08-12 22:40:32 +01:00
Doug Torrance cd2115dbe8 wmmon: Use consistent data types. 2017-08-12 22:40:32 +01:00
Doug Torrance 4a1a75e65a wmmon: Remove redundant #define. 2017-08-12 22:40:32 +01:00
Doug Torrance a7a65a17ce wmmon: Update includes based on results of include-what-you-use. 2017-08-12 22:40:32 +01:00
Doug Torrance 61ff28e190 wmmon: Use autotools for build. 2017-08-12 22:40:32 +01:00
Doug Torrance 0306231dcb wmmon: Move all source files to top directory for simplicity. 2017-08-12 22:40:32 +01:00
Renamed from wmmon/wmmon/wmmon.c (Browse further)