wmmon: Add support for larger load averages.
Previously, a green hint line was drawn on the CPU window for each multiple of 1. This meant as the load average approached 40 (the height of the window), the window would gradually fill up entirely with green. To get around this, we switch to a yellow hint line for each multiple of 10 once the load passes 10. And then a red hint line for each multiple of 100 once the load passes 100. This fixes Debian bug #894801, reported by Pedro Gimeno <debian.bts@personal.formauri.es>.
This commit is contained in:
parent
bdfca9d3d0
commit
2a199f8b19
|
@ -30,6 +30,10 @@ WMMon currently provides:
|
||||||
* Realtime CPU 'stress' meter;
|
* Realtime CPU 'stress' meter;
|
||||||
* Average systemload, like xload & wmavgload;
|
* Average systemload, like xload & wmavgload;
|
||||||
* Average systemload graphic is autoscaling;
|
* Average systemload graphic is autoscaling;
|
||||||
|
* Hint lines change color as the systemload increases.
|
||||||
|
- Green for multiples of 1
|
||||||
|
- Yellow for multiples of 10
|
||||||
|
- Red for multiples of 100
|
||||||
* Realtime Disk I/O 'stress' meter;
|
* Realtime Disk I/O 'stress' meter;
|
||||||
* Average Disk I/O load grapic (autoscaling);
|
* Average Disk I/O load grapic (autoscaling);
|
||||||
* Realtime total Mem & Swap usage meters;
|
* Realtime total Mem & Swap usage meters;
|
||||||
|
|
|
@ -134,8 +134,8 @@ static char * wmmon_master_xpm[] = {
|
||||||
" s ",
|
" s ",
|
||||||
" X ",
|
" X ",
|
||||||
" d ",
|
" d ",
|
||||||
" ",
|
" e ",
|
||||||
" ",
|
" i ",
|
||||||
" ",
|
" ",
|
||||||
" ",
|
" ",
|
||||||
" ",
|
" ",
|
||||||
|
|
|
@ -45,6 +45,16 @@ an auto-scaled average system load meter, like
|
||||||
and
|
and
|
||||||
.BR wmavgload ;
|
.BR wmavgload ;
|
||||||
.IP \(bu
|
.IP \(bu
|
||||||
|
hint lines change color as the system load increases.
|
||||||
|
.RS
|
||||||
|
.IP \(bu
|
||||||
|
green for multiples of 1
|
||||||
|
.IP \(bu
|
||||||
|
yellow for multiples of 10
|
||||||
|
.IP \(bu
|
||||||
|
red for multiples of 100
|
||||||
|
.RE
|
||||||
|
.IP \(bu
|
||||||
a realtime disk I/O stress meter;
|
a realtime disk I/O stress meter;
|
||||||
.IP \(bu
|
.IP \(bu
|
||||||
auto-scaled disk I/O load meter;
|
auto-scaled disk I/O load meter;
|
||||||
|
|
|
@ -904,7 +904,7 @@ void DrawActive(char *name)
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
void DrawStats(int *his, int num, int size, int x_left, int y_bottom)
|
void DrawStats(int *his, int num, int size, int x_left, int y_bottom)
|
||||||
{
|
{
|
||||||
int pixels_per_byte, j, k, *p, d;
|
int pixels_per_byte, j, k, *p, d, hint_height, hint_color;
|
||||||
|
|
||||||
pixels_per_byte = 100;
|
pixels_per_byte = 100;
|
||||||
p = his;
|
p = his;
|
||||||
|
@ -932,10 +932,21 @@ void DrawStats(int *his, int num, int size, int x_left, int y_bottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Nu horizontaal op 100/200/300 etc lijntje trekken! */
|
/* Nu horizontaal op 100/200/300 etc lijntje trekken! */
|
||||||
for (j = pixels_per_byte-100; j > 0; j-=100) {
|
if (pixels_per_byte > 10000) {
|
||||||
d = (40.0 / pixels_per_byte) * j;
|
hint_height = 10000;
|
||||||
|
hint_color = 93; /* red */
|
||||||
|
} else if (pixels_per_byte > 1000) {
|
||||||
|
hint_height = 1000;
|
||||||
|
hint_color = 92; /* yellow */
|
||||||
|
} else {
|
||||||
|
hint_height = 100;
|
||||||
|
hint_color = 91; /* green */
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j = hint_height; j < pixels_per_byte; j += hint_height) {
|
||||||
|
d = (40.0 / pixels_per_byte) * j - 1;
|
||||||
for (k=0; k<num; k++) {
|
for (k=0; k<num; k++) {
|
||||||
copyXPMArea(2, 91, 1, 1, k+x_left, y_bottom-d);
|
copyXPMArea(2, hint_color, 1, 1, k+x_left, y_bottom-d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue