public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Snook <csnook@redhat.com>
To: Xu Yang <risingsunxy@googlemail.com>
Cc: Bernd Petrovitsch <bernd@firmix.at>, linux-kernel@vger.kernel.org
Subject: Re: looking for a function
Date: Tue, 16 Sep 2008 15:04:51 -0400	[thread overview]
Message-ID: <48D00353.3080203@redhat.com> (raw)
In-Reply-To: <ab40e9c0809160711p4182d9e7n9b3ce965b3ce9f1f@mail.gmail.com>

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/


      parent reply	other threads:[~2008-09-16 19:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48D00353.3080203@redhat.com \
    --to=csnook@redhat.com \
    --cc=bernd@firmix.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=risingsunxy@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox