1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 12:10:03 +00:00

smp support, should be the last commit (yeah right!)

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@212 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2005-08-27 10:17:41 +00:00
parent e3f5429f9d
commit e93155d26b
3 changed files with 9 additions and 11 deletions

View File

@ -4,6 +4,7 @@
* 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

View File

@ -124,16 +124,17 @@
<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
@ -143,10 +144,10 @@
<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>

View File

@ -370,11 +370,7 @@ inline static void update_stat()
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));
}
}
if (stat_fp == NULL) {
stat_fp = open_file("/proc/stat", &rep);
@ -396,13 +392,13 @@ inline static void update_stat()
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) {