On 9/26/06, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> wrote:
Hi folks... recently I did a simple experiment, that was running a CPU bound program on Linux kernels with different HZ setting. I pick three, HZ=100, HZ=250 and HZ=250. Here is the result: HZ=100 HZ=250 HZ=1000 Real 319.326 317.786 319.072 User 319.33 317.801 319.094 System 0 0.001 0 The result was taken by simply running the program with "time" command. The programs were ran 4 time each and the average was calculate for all real, user and system time. If you look closely, perhaps you will be shocked with the number. On HZ=250, the program seems running faster than the other two. I almost can believe it, as I suspected that it should run slower due to more work on taking care the interrupts. Anybody can kindly explain what happened here? Here is the program I used for the test: #include<stdio.h> #include<stdlib.h> int main(int argc, char *argv[]) { int i, j; long int l, m; unsigned long int k,loop_max; float hasil; if (argc >= 2) { loop_max = labs(strtoul(argv[1], (char **) NULL, 10)); } else loop_max = 1000; printf("loop_max is %lu\n", loop_max); for (i = 0; i <= 3000; i++) for (j = 0; j <= 1000; j++) for (k = 0; k <= loop_max; k++) { l = random(); do { m = random();
Hi Mulyadi, One thing I doubt here is the random function. As you are using random, it might be making the total runtime of this program different for every run, hope you get what I mean to say .... moreover I think you will see the improvement in cpu times as HZ increases to some limit and then it falls down. As you increase the HZ, you make system to respond more quickly to events, but increasing this HZ value to large value will degrate the stats just because you are spending more time in handling interrup than doing something usefull. So the curve for system response with increase in HZ goes in bell shape, this is what i think .... not sure about it. regards, Gaurav
} while (m == 0); hasil = l / m; } return (0); } regards, Mulyadi -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/
-- Gaurav Email: gauravd.chd@xxxxxxxxx -------------------------------------------- Read my articles at: http://lkdp.blogspot.com -------------------------------------------- Easy to get air tickets at affordable price, US to India Air Tickets: www.Ritz-Travel.com Call at 001-503-848-2299 or mail at info@xxxxxxxxxxxxxxx -------------------------------------------- -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/