How to know on which physical processor and on which physical core my code is running

前端 未结 5 1085
抹茶落季
抹茶落季 2020-12-01 22:06

How can I know in a C program, on which physical processor and core my code is running? I\'m using Linux and gcc 4.4.3.

5条回答
  •  爱一瞬间的悲伤
    2020-12-01 22:34

    You can get the affinity of the process to a processor using GCC. The CPU affinity APIs might help you out. Are you trying to use this information to ensure your process is not interrupted or such high priority task?

提交回复
热议问题