Fixed server->ncpu usage (SMP handling). Need more testing.

* cpu.c: (glibtop_get_cpu_s):
	* glibtop_private.c: (get_scaled), (check_cpu_line):
	* glibtop_private.h:
	* open.c: (glibtop_open_s):
	* proctime.c: (glibtop_get_proc_time_s):

	Fixed server->ncpu usage (SMP handling). Need more testing.
This commit is contained in:
Benoît Dejean
2005-12-13 09:15:49 +00:00
parent ba7355df9e
commit 806a816026
6 changed files with 64 additions and 12 deletions

View File

@@ -110,11 +110,11 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
* PER CPU
*/
for (i = 0; i < GLIBTOP_NCPU && i < server->ncpu; i++) {
for (i = 0; i <= server->ncpu; i++) {
p = skip_line(p); /* move to ^ */
if (strncmp (p, "cpu", 3) || !isdigit (p [3]))
if (!check_cpu_line_warn(server, p, i))
break;
p = skip_token(p); /* "cpuN" */
@@ -141,14 +141,14 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
}
}
if(i >= 2) /* ok, that's a real SMP */
if(server->ncpu) /* ok, that's a real SMP */
buf->flags |= _glibtop_sysdeps_cpu_smp;
if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0))
{
buf->flags |= _glibtop_sysdeps_cpu_2_6;
if(i >= 2) /* ok, that's a real SMP */
if(server->ncpu) /* ok, that's a real SMP */
buf->flags |= _glibtop_sysdeps_cpu_smp_2_6;
}
}