It would be very useful for me to run specific programs in a Linux environment with a fixed (lower) CPU clock speed (say,
runat 400mhz ./my-program --argument-of="my program" for getting that clock speed).
I need it to generate delays between each assembly instruction of my program, and it wouldn't kill me if the delay isn't exact (say, if it depends on the OS scheduler, as it almost sure will).
The goal is to make algorithms efficiency very explicit when programming not-that-heavy applications at school (having a 3GHz CPU makes it difficult to notice slow algorithms that run for little time and could be really optimized). Also, it could be useful for spotting race conditions in real time, maybe.
Do you know of any such tool? Is there any kind-of-interpreter that I could hack to achieve this? Can gdb help me in a relatively easy way? I think it's the closest thing to controlling a Linux program execution I know.
Running the hole system in a CPU capped VM could be another option, given it provides me that illusion - a lower speed CPU - but or would be best to run single programs.