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.
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.