* Fixed slight vertical misalignment of bars/graphs (sf.net 1273994)
* Diskio fixes (sf.net 1274140)
* $alignr and $alignc now have 25% more goodness! (sf.net bug 1273905)
+ * Far better SMP support
2005-08-25
* More own_window fixes
<varlistentry>
<term>
<command><option>cpu</option></command>
+ <option>(cpu number)</option>
</term>
<listitem>
- CPU usage in percents
+ CPU usage in percents. For SMP machines, the CPU number can be provided as an argument. 0 is the total usage, and >=1 are individual CPUs. See $cpu for more info on SMP.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>cpubar</option></command>
- <option>(height),(width)</option>
+ <option>(cpu number) (height),(width)</option>
</term>
<listitem>
Bar that shows CPU usage, height is bar's height in pixels
<varlistentry>
<term>
<command><option>cpugraph</option></command>
- <option>(height),(width) (gradient colour 1) (gradient colour 2)</option>
+ <option>(cpu number) (height),(width) (gradient colour 1) (gradient colour 2)</option>
</term>
<listitem>
- CPU usage graph, with optional colours in hex, minus the #.
+ CPU usage graph, with optional colours in hex, minus the #. See $cpu for more info on SMP.
<para></para></listitem>
</varlistentry>
cpu_setup = 1;
}
if (cpu == NULL) {
- if (info.cpu_count > 1) {
- cpu = malloc((info.cpu_count + 1) * sizeof(struct cpu_info));
- } else {
- cpu = malloc(info.cpu_count * sizeof(struct cpu_info));
- }
+ cpu = malloc((info.cpu_count + 1) * sizeof(struct cpu_info));
}
if (stat_fp == NULL) {
stat_fp = open_file("/proc/stat", &rep);
sscanf(buf, "%*s %u %u %u", &(cpu[index].cpu_user), &(cpu[index].cpu_nice), &(cpu[index].cpu_system));
index++;
info.mask |= (1 << INFO_CPU);
- } else if (strncmp(buf, "cpu", 3) == 0 && isdigit(buf[3]) && index < info.cpu_count) {
+ } else if (strncmp(buf, "cpu", 3) == 0 && isdigit(buf[3]) && index <= info.cpu_count) {
sscanf(buf, "%*s %u %u %u", &(cpu[index].cpu_user), &(cpu[index].cpu_nice), &(cpu[index].cpu_system));
index++;
info.mask |= (1 << INFO_CPU);
}
}
- for (index = 0; index < info.cpu_count; index++) {
+ for (index = 0; index < info.cpu_count + 1; index++) {
double delta;
delta = current_update_time - last_update_time;
if (delta <= 0.001) {