/***************************************************************************** * * waiter_freq05.c 2012.05.19 Smythies * A program to build a script for use with the waiter program. * Everything is coded herein. Re-compile to change things. * This one sweeps the actual load over various sleep frequencies * *****************************************************************************/ #include #include #include #include #define LOOPS_PER_USEC 207.547 /* Tight loops per second. s15.smythies.com. CONFIG_NO_HZ=n and CONFIG_NO_HZ=y kernels */ void main(int argc, char **argv){ double load, period, s, c, freq; int l; printf("#! /bin/bash\n"); printf("uptime >freq_load\n"); for(freq = 30.0; freq <= 150.1; freq = freq + 30.0){ for(load = 0.05; load <= 0.96; load = load + 0.05){ period = 1.0 / freq; c = period * load; s = period - c; if(s < 0.0){ printf("Doug: you have screwed up. Sleep time is negative: %lf\n", s); exit (-1); } /* endif */ l = (int) (c * LOOPS_PER_USEC * 1000000 + 0.5); printf("../c/waiter 1 %d %d %d\n", (int) (10.0 * freq + 0.5), l, (int) (s * 1000000 + 0.5)); printf("uptime >>freq_load\n"); } /* endfor */ printf("\n"); } /* endfor */ } /* endprogram */