Subject: Re: [Q] top compiled?

From: [email-masked] (Michael Kutzner)
Date: 07 Sep 1993 20:45:28 GMT

>>>>> About Re: [Q] top compiled?, Ed Kubaitis said:

Ed> Top failed with the 'kvm_read for cpu: Error 0' after our 690MP was
Ed> changed from a 4 x SPARC 2 to a 2 x 50 MHz SuperSPARC. The problem appears
Ed> to be that on two processor models the processors are numbered 0 and *2*,
Ed> not 0 and 1 as top expects. Attached is a hack that got top to work
Ed> on our two processor machine.

This was a fine hack, but if don`t set ncpus explicitely =3, it runs
on one and two proc machines (I tried it). I don`t know, what getkval
returns on 4 (or more) proc-machines, so ...
But it returns 3 on a 2 PM and 1 on a 2 PM.

So your modified hack (see below) runs fine.

Greets, Michael

*** machine/m_sunos5.c-	Fri Jul  9 14:25:51 1993
--- machine/m_sunos5.c	Sat Sep  4 10:02:33 1993
***************
*** 313,320 ****
    /* get the cp_time array */
    for (j = 0; j < CPUSTATES; j++)
      cp_time[j] = 0L;
! 
!   for (i = 0; i < ncpus; i++)
      {
        (void) getkval (cpu_offset[i], &cpu, sizeof (struct cpu), "cpu");
        for (j = 0; j < CPUSTATES; j++)
--- 314,320 ----
    /* get the cp_time array */
    for (j = 0; j < CPUSTATES; j++)
      cp_time[j] = 0L;
!   for (i = 0; i < ncpus; i+=2)
      {
        (void) getkval (cpu_offset[i], &cpu, sizeof (struct cpu), "cpu");
        for (j = 0; j < CPUSTATES; j++)