Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
* SMP processor identification
@ 2000-05-08  4:00 Alex Rhomberg
  2000-05-08  4:00 ` Peter Boyle
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Rhomberg @ 2000-05-08  4:00 UTC (permalink / raw)


Does anybody know a way how I can identify on which processor a thread
is currently running on UP2000?

Thanks
- Alex



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: SMP processor identification
  2000-05-08  4:00 SMP processor identification Alex Rhomberg
@ 2000-05-08  4:00 ` Peter Boyle
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Boyle @ 2000-05-08  4:00 UTC (permalink / raw)




On Mon, 8 May 2000, Alex Rhomberg wrote:

> Does anybody know a way how I can identify on which processor a thread
> is currently running on UP2000?
> 
> Thanks
> - Alex
> 
> 

Hi, 

had a quick look in the fs/proc kernel source and there is a routine 
which puts a per processor cpu time into a buffer, so I am sure that
somewhere in /proc/pid the per processor cpu time usage is available.
Watching that file to see which cpu time is increasing will be available
(I am running a single processor kernal, so the #ifdef stops me seeing
it in my /proc )

HTH,

Peter


#ifdef __SMP__
static int get_pidcpu(int pid, char * buffer)
{
        struct task_struct * tsk = current ;
        int i, len;

        read_lock(&tasklist_lock);
        if (pid != tsk->pid)
                tsk = find_task_by_pid(pid);
        read_unlock(&tasklist_lock);    /* FIXME!! This should be done
after the
 last use */

        if (tsk == NULL)
                return 0;

        len = sprintf(buffer,
                "cpu  %lu %lu\n",
                tsk->times.tms_utime,
                tsk->times.tms_stime);

        for (i = 0 ; i < smp_num_cpus; i++)
                len += sprintf(buffer + len, "cpu%d %lu %lu\n",
                        i,
                        tsk->per_cpu_utime[cpu_logical_map(i)],
                        tsk->per_cpu_stime[cpu_logical_map(i)]);

        return len;
}


Peter Boyle	pboyle@physics.gla.ac.uk






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-05-08  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-05-08  4:00 SMP processor identification Alex Rhomberg
2000-05-08  4:00 ` Peter Boyle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox