Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

Thanks

share|improve this question
4  
Read up on cgroups and exclusive cpusets. stackoverflow.com/questions/6816069/… –  Mikel May 3 '12 at 18:57
add comment

2 Answers 2

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.

share|improve this answer
    
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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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