On Thu, 18 Mar 2004, Marcelo Roitburd wrote:
> the reason for the question it's to see in the same time the computer use
> the both cpu that he have or only one.
You still haven't answered the question about the OS, so I'll assume
that it's Linux.
As somebody else has already mentioned, the processes are dynamically
alocated on CPUs, so the fact that you know now that you are on CPU0
doesn't give you any information about what happened a time-slice ago
and doesn't guarantee that in another time-slice the process will
still run on CPU0.
On a SMP Linux system, with modern kernels, each process has a file
called /proc/<pid>/cpu with one line on top that give sums for all
CPUs and then separate lines for each CPU; each line gives the time
spent in user space (like computation) and in kernel space (like file
operations). If for a certain CPU both times are zero, that process
had never run on that CPU.
--
Bogdan Costescu
IWR - Interdisziplinaeres Zentrum fuer Wissenschaftliches Rechnen
Universitaet Heidelberg, INF 368, D-69120 Heidelberg, GERMANY
Telephone: +49 6221 54 8869, Telefax: +49 6221 54 8868
E-mail: Bogdan.Costescu_at_[hidden]
|