Google
  Web www.spinics.net

Re: How to check the core execution for each thread?

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


Charly Bechara <c_bechara@xxxxxxxxxxx> writes:
> I have a multithreaded C program executing on an MPCore system. I
> want to know if there is any function from glibc or a kernel system
> call which can return me the current core where the thread is
> executing on?

Glibc has sched_getcpu(), dunno when it got it, probably glibc-2.6ish,
uses the getcpu system call. When using, it is good to remember [1]:

    The result is the index of the CPU in the CPU set. Due
    to the nature of scheduling this number cannot always be
    100% correct. The thread might have been moved to a
    different CPU between the time the result was returned
    and when the thread returns to userlevel.

[1] http://people.redhat.com/drepper/cpumemory.pdf

--
http://www.iki.fi/~ananaza/


-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

[Site Home]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux ARM Kernel]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Tools]     [DDR & Rambus]     [Monitors]

Powered by Linux

Google PageRank Checking tool