get current core id

Ian Lance Taylor
Tue Jun 1 06:38:00 GMT 2010

fozzie <> writes:

> Does anyone know if it is possible to get the ID of the core which is
> executing code at a given point in a C++ program? I'm running code built
> using gcc 4.4.1 on Ubuntu Koala 64-bit with an Intel core 2 quad and would
> like to see whether external code calling a function in a shared library is
> making use of multiple cores.

This isn't a gcc question.  The compiler doesn't know anything about
different cores.  I say this not to chastise you, but to let you know
that you are more likely to get the answer if you ask on a more
appropriate forum.  The answer may be operating system specific.

I don't know the answer myself.


More information about the Gcc-help mailing list