* looking for a function
@ 2008-09-16 12:50 Xu Yang
2008-09-16 14:00 ` Bernd Petrovitsch
0 siblings, 1 reply; 8+ messages in thread
From: Xu Yang @ 2008-09-16 12:50 UTC (permalink / raw
To: linux-kernel
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: looking for a function
2008-09-16 12:50 looking for a function Xu Yang
@ 2008-09-16 14:00 ` Bernd Petrovitsch
2008-09-16 14:11 ` Xu Yang
0 siblings, 1 reply; 8+ messages in thread
From: Bernd Petrovitsch @ 2008-09-16 14:00 UTC (permalink / raw
To: Xu Yang; +Cc: linux-kernel
Hi!
On Tue, 2008-09-16 at 14:50 +0200, Xu Yang wrote:
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: looking for a function
2008-09-16 14:00 ` Bernd Petrovitsch
@ 2008-09-16 14:11 ` Xu Yang
2008-09-16 14:18 ` Arjan van de Ven
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Xu Yang @ 2008-09-16 14:11 UTC (permalink / raw
To: Bernd Petrovitsch; +Cc: linux-kernel
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?
Best regards,
Yang
2008/9/16, Bernd Petrovitsch <bernd@firmix.at>:
> Hi!
>
> On Tue, 2008-09-16 at 14:50 +0200, Xu Yang wrote:
> > 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
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: looking for a function
2008-09-16 14:11 ` Xu Yang
@ 2008-09-16 14:18 ` Arjan van de Ven
2008-09-16 14:32 ` Xu Yang
2008-09-16 14:29 ` Frédéric Weisbecker
2008-09-16 19:04 ` Chris Snook
2 siblings, 1 reply; 8+ messages in thread
From: Arjan van de Ven @ 2008-09-16 14:18 UTC (permalink / raw
To: Xu Yang; +Cc: Bernd Petrovitsch, linux-kernel
On Tue, 16 Sep 2008 16:11:10 +0200
"Xu Yang" <risingsunxy@googlemail.com> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: looking for a function
2008-09-16 14:11 ` Xu Yang
2008-09-16 14:18 ` Arjan van de Ven
@ 2008-09-16 14:29 ` Frédéric Weisbecker
2008-09-16 14:33 ` Xu Yang
2008-09-16 19:04 ` Chris Snook
2 siblings, 1 reply; 8+ messages in thread
From: Frédéric Weisbecker @ 2008-09-16 14:29 UTC (permalink / raw
To: Xu Yang; +Cc: Bernd Petrovitsch, linux-kernel
2008/9/16 Xu Yang <risingsunxy@googlemail.com>:
> 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: looking for a function
2008-09-16 14:18 ` Arjan van de Ven
@ 2008-09-16 14:32 ` Xu Yang
0 siblings, 0 replies; 8+ messages in thread
From: Xu Yang @ 2008-09-16 14:32 UTC (permalink / raw
To: Arjan van de Ven; +Cc: Bernd Petrovitsch, linux-kernel
Hi Arjan,
thanks,
I will try that!
Best regards,
Yang
2008/9/16, Arjan van de Ven <arjan@infradead.org>:
> On Tue, 16 Sep 2008 16:11:10 +0200
> "Xu Yang" <risingsunxy@googlemail.com> 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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: looking for a function
2008-09-16 14:29 ` Frédéric Weisbecker
@ 2008-09-16 14:33 ` Xu Yang
0 siblings, 0 replies; 8+ messages in thread
From: Xu Yang @ 2008-09-16 14:33 UTC (permalink / raw
To: Frédéric Weisbecker; +Cc: Bernd Petrovitsch, linux-kernel
Hi Frederic,
thank you very much!
this is very useful for me. :-)
Best regards,
Yang
2008/9/16, Frédéric Weisbecker <fweisbec@gmail.com>:
> 2008/9/16 Xu Yang <risingsunxy@googlemail.com>:
> > 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.
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: looking for a function
2008-09-16 14:11 ` Xu Yang
2008-09-16 14:18 ` Arjan van de Ven
2008-09-16 14:29 ` Frédéric Weisbecker
@ 2008-09-16 19:04 ` Chris Snook
2 siblings, 0 replies; 8+ messages in thread
From: Chris Snook @ 2008-09-16 19:04 UTC (permalink / raw
To: Xu Yang; +Cc: Bernd Petrovitsch, linux-kernel
Xu Yang 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?
>
> Best regards,
>
> Yang
getcpu() should do what you want.
-- Chris
> 2008/9/16, Bernd Petrovitsch <bernd@firmix.at>:
>> Hi!
>>
>> On Tue, 2008-09-16 at 14:50 +0200, Xu Yang wrote:
>>> 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
>>
>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-09-16 19:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-16 12:50 looking for a function Xu Yang
2008-09-16 14:00 ` Bernd Petrovitsch
2008-09-16 14:11 ` Xu Yang
2008-09-16 14:18 ` Arjan van de Ven
2008-09-16 14:32 ` Xu Yang
2008-09-16 14:29 ` Frédéric Weisbecker
2008-09-16 14:33 ` Xu Yang
2008-09-16 19:04 ` Chris Snook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).