looking for a function
Hi guys,
I am looking for a function that can show me the current thread is running on which cpu.
e.g I am using pthread to write a multithreaded program, in each thread I would like to insert such kind of function so that I can know on which cpu this thread is running on.
which function should be used?
thanks for the help!!
best regards,
Yang
Hi!
Quoted 8 lines · Xu Yang
Hi guys,
I am looking for a function that can show me the current thread is running on which cpu.
e.g I am using pthread to write a multithreaded program, in each thread I would like to insert such kind of function so that I can know on which cpu this thread is running on.
That doesn't make much sense as the same thread can run on a different CPU after each scheduling decision. And - as it is in userspace - scheduling can happen before any assembler op.
Bernd
Signature · 3 lines
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and ServicesHi Bernd,
thanks for you reply.
yes, I know the thread migrates all the time, this is exactly what I would like to observe. I would like to learn about the thread migration of some specific scheduling algorithm. so ....
any idea about the function?
Best regards,
Yang
2008/9/16, Bernd Petrovitsch <[email protected]>:
Quoted 24 lines
Hi!
Quoted 8 lines · Xu Yang
Hi guys,
I am looking for a function that can show me the current thread is running on which cpu.
e.g I am using pthread to write a multithreaded program, in each thread I would like to insert such kind of function so that I can know on which cpu this thread is running on.
That doesn't make much sense as the same thread can run on a different CPU after each scheduling decision. And - as it is in userspace - scheduling can happen before any assembler op.
Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services
Quoted 9 lines · On Tue, 16 Sep 2008 16:11:10 +0200 "Xu Yang" <[email protected]> wrote:
Hi Bernd,
thanks for you reply.
yes, I know the thread migrates all the time, this is exactly what I would like to observe. I would like to learn about the thread migration of some specific scheduling algorithm. so ....
any idea about the function?
the getcpu() system call will do what you want.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Hi Arjan,
thanks,
I will try that!
Best regards,
Yang
2008/9/16, Arjan van de Ven <[email protected]>:
Quoted 22 lines
Quoted 9 lines · On Tue, 16 Sep 2008 16:11:10 +0200 "Xu Yang" <[email protected]> wrote:
Hi Bernd,
thanks for you reply.
yes, I know the thread migrates all the time, this is exactly what I would like to observe. I would like to learn about the thread migration of some specific scheduling algorithm. so ....
any idea about the function?
the
getcpu()system call will do what you want.--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings, visit http://www.lesswatts.org
2008/9/16 Xu Yang <[email protected]>:
Quoted 10 lines
Hi Bernd,
thanks for you reply.
yes, I know the thread migrates all the time, this is exactly what I would like to observe. I would like to learn about the thread migration of some specific scheduling algorithm. so ....
any idea about the function?
And perhaps you should have a look at the sched_switch tracer which will log for you the different context switches.
Regards,
Frederic.
Hi Frederic,
thank you very much!
this is very useful for me. :-)
Best regards,
Yang
2008/9/16, Frédéric Weisbecker <[email protected]>:
Quoted 19 lines
2008/9/16 Xu Yang <[email protected]>:
Quoted 10 lines
Hi Bernd,
thanks for you reply.
yes, I know the thread migrates all the time, this is exactly what I would like to observe. I would like to learn about the thread migration of some specific scheduling algorithm. so ....
any idea about the function?
And perhaps you should have a look at the
sched_switchtracer which will log for you the different context switches.Regards,
Frederic.
Quoted 8 lines · Xu Yang
Hi Bernd,
thanks for you reply.
yes, I know the thread migrates all the time, this is exactly what I would like to observe. I would like to learn about the thread migration of some specific scheduling algorithm. so ....
Quoted 5 lines
any idea about the function?
Best regards,
Yang
getcpu() should do what you want.
-- Chris
Quoted 28 lines
2008/9/16, Bernd Petrovitsch <[email protected]>:
Quoted 14 lines
Hi!
Quoted 7 lines · Xu Yang
Hi guys,
I am looking for a function that can show me the current thread is running on which cpu.
e.g I am using pthread to write a multithreaded program, in each thread I would like to insert such kind of function so that I can know on which cpu this thread is running on.That doesn't make much sense as the same thread can run on a different CPU after each scheduling decision. And - as it is in userspace - scheduling can happen before any assembler op.
Quoted 8 lines
Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/