I have written some code to test the efficiency of some algorithms in real world.
Now, i think it would be better to disable the cpu interrupts but i wonder how to do it.
Does it have something to do with the compilation ( through compiler arguments )
or is it something that i should ask for the OS to do when executing the application ?
Any help is appreciated
PS: I use the mingw compiler
You're not going to disable the interrupts or any other high priority services on any pre-emptive desktop operating system.
I recently had to time some code on a desktop machine. My approach was to repeat the test 100's or 1000's of times and plot graphs of the timings. The minimum timings were pretty stable from one run to another, but the maximum times showed like ±100% variability in the results, depending on course on exactly what other things happened to momentarily interrupt the test.
The "best" you can manage is to up the priority (you need admin to do it IIRC), but beware of running long duration tasks at very high priority, you might upset something.
You can run your program in realtime which means that it will hog up the CPU. Most interrupts should be disabled. You can set the priority of execution for your program to realtime through the Windows API or the task manager. Be careful, though.