Re: looking for a function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Xu Yang,

On Linux sched_getcpu(3) comes to mind.  This function is not
particularly useful since the information returned by the function
might not be correct at the point of its return as threads can be
switched to other CPUs (read: cores) at anytime (although CPU/core
switching can be quite expensive due to cache line bouncing for
instance)

So, once the information has been obtained it might already be
obsolete.  Anyway, I hope that is what you're looking for.

        \Steve

--

Steve Grägert


On Tue, Sep 16, 2008 at 3:26 PM, Xu Yang <risingsunxy@xxxxxxxxxxxxxx> 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.
>
> which function should be used?
>
> thanks for the help!!
>
> best regards,
>
>
>
> Yang
> --
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux