From: taninux on
Hi,

is there a tool, saying like lsof, to know wich core is executing a
program ?

Thanks
From: Grant on
On Fri, 16 Apr 2010 11:57:14 -0700 (PDT), taninux <taninux(a)gmail.com> wrote:

>Hi,
>
>is there a tool, saying like lsof, to know wich core is executing a
>program ?

Probably not, a program will jump cores, use more than one if
multi-threaded. Look for CPU affinity settings?

Grant.
--
http://bugs.id.au/
From: John K. Herreshoff on
Grant wrote:

> On Fri, 16 Apr 2010 11:57:14 -0700 (PDT), taninux <taninux(a)gmail.com>
> wrote:
>
>>Hi,
>>
>>is there a tool, saying like lsof, to know wich core is executing a
>>program ?
>
> Probably not, a program will jump cores, use more than one if
> multi-threaded. Look for CPU affinity settings?
>
> Grant.

You might try top. Pressing 1 on the keyboard will show all cores / cpus.
My experience on two smp boxes and this laptop with a dual core is that a
single program may swap cores / cpus as it goes about its business. Build
a kernel just for fun and watch top as it jumps from cpu(0) to cpu(1).

HTH.

John.

--
Using the Laptop at home.
From: Hans on
On 04/17/2010 03:31 AM, John K. Herreshoff wrote:
> Grant wrote:
>
>> On Fri, 16 Apr 2010 11:57:14 -0700 (PDT), taninux<taninux(a)gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> is there a tool, saying like lsof, to know wich core is executing a
>>> program ?
>>
>> Probably not, a program will jump cores, use more than one if
>> multi-threaded. Look for CPU affinity settings?
>>
>> Grant.
>
> You might try top. Pressing 1 on the keyboard will show all cores / cpus.
> My experience on two smp boxes and this laptop with a dual core is that a
> single program may swap cores / cpus as it goes about its business. Build
> a kernel just for fun and watch top as it jumps from cpu(0) to cpu(1).

Or build a kernel with -j n. where n is aboud two times the number of
cores and see all your cores heat up simultaneous.

--
Hans

From: Henrik Carlqvist on
"John K. Herreshoff" <nope(a)not.here> wrote:
> You might try top. Pressing 1 on the keyboard will show all cores / cpus.

Once top also displayed a CPU column showing the CPU Runqueue for each
process. I think that column is exactly what the OP was asking for, but
unfortunately top no longer does that.

On Slackware 9.1:
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
1957 henca 15 0 1204 1204 816 R 60.9 0.2 0:00 0 top

On Slackware 12.2:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5071 root 10 -5 0 0 0 S 0 0.0 0:00.27 cx88[0] dvb

The CPU column has been removed and I can't find any way to get it back in
12.2.

> My experience on two smp boxes and this laptop with a dual core is that a
> single program may swap cores / cpus as it goes about its business. Build
> a kernel just for fun and watch top as it jumps from cpu(0) to cpu(1).

Yes, but most likely a single working process will not switch CPU just for
fun. Switching CPU means lost cache and therefore also lost performance.
When building a kernel you get new c compiler processes for eachs source
file. You could also try to build your kernel with "make -j 2" or even
"make -j 3".

regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc3(at)poolhem.se Examples of addresses which go to spammers:
root(a)localhost postmaster(a)localhost