For research purpose, I have to degrade the performance of some computer using a cpuburner. I code a program which do this by getting the maximum priority of SCHED_FIFO and then execute the following algorithm:
sleep_time_tot = 0;
while (1) {
usleep (1);
sleep_time_tot += CLOCK_UDIFF(c2, c1);
while (time_tot*(100-percent)/100 < sleep_time_tot) {
CLOCK(c3); time_tot = CLOCK_UDIFF(c3, c0);

My first problem is that in the second part (when the program execute the second loop), all the cpu is used by the program and network communication are stalled. The goal of the program is to decrease only the cpu perf, not the network comm. There is certainly a solution for this, but I don't know how the kernel work for doing. Any ideas ?

Another problem: the program should be the more accurate possible and it depends on the time effectively taken by the usleep call. This time is related to the HZ constant. I tryed to increase this constant to at least 10000 (and possibly 100000) but I was constraint at compilation time to take 1500 (or 4000 if I modified another file). How can I increase this constant to the previous values ?
I also found a patch (High Res POSIX Timers) which improve the precision of the timers, however it is quite old and this is still not in the main line. Any hope ? (I was not able to compile a kernel with this patch).