I am trying to measure the performance of a process. I have widely ranging performance measurements on small bit of single-threaded deterministic code that should perform the same every time.

I would like to set exclusive use of a processor for the process in order to test if the performance fluctuation is due to scheduling of other processes, context switches, etc. I don't care about affinity because I don't care which core it runs on. What I do care about is that my single-threaded process has exclusive access to the core it runs on, whichever core that is. Is this possible? I don't think 'nice' does what I want because that just lets me set a priority. Some other task with the same priority may share processor time with my process. I also don't care if my process has to wait in a queue. I just want to ensure that once it starts running, it is not interrupted.



Could always use taskset -c 0 in order to set the process you want to have uninterupted to the first core then set all other processes to use other cores. Sounds pretty inefficient IMHO but it would accomplish what you are looking to do.

  • Thanks. The only 'efficient' thing I could think to do is isolate a core and reboot the box. That's an option but I was looking for something less intrusive. – user1332148 May 3 '12 at 19:21

The best you can do is use chrt to set the scheduling class of the process to realtime.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.