/***************************************************************************** * * waiter_high_freq.c 2012.06.14 Smythies * High Frequency sweep, into breakdown range. * * waiter_freq04.c 2012.05.07 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 load for different numbers of processes. * *****************************************************************************/ #include #include #include #include #define LOOPS_PER_USEC 207.547 /* Tight loops per second. s15.smythies.com. CONFIG_NO_HZ=n or y kernels */ /* for CPUs set to powersave mode */ /* The above number is machine dependent. You will need to figure it out for yours */ void main(int argc, char **argv){ double load, period, s, c, freq; int l; printf("#! /bin/bash\n"); printf("# generated by waiter_high_freq.c - a high frequency sweep, well into the breakdown range.\n"); printf("# Note: the ability to estimate accurately is greately reduced at high frequencies.\n"); printf("# Please recored the actual resulting loads and frequencies.\n"); load = 0.80; /* we go with a fixed load for this one */ for(freq = 100.0; freq <= 2100.1; freq = freq + 100.0){ 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("# Freq = %4lf Hz; Processes = 3; Load = %4.2lf\n", freq, load); if(freq == 100.0){ /* do some settling for the first one */ printf("../c/waiter 3 180 %d %d %d 1\n", (int) (10.0 * freq + 0.5), l, (int) (s * 1000000 + 0.5)); printf("../c/waiter 3 180 %d %d %d 1\n", (int) (10.0 * freq + 0.5), l, (int) (s * 1000000 + 0.5)); printf("../c/waiter 3 180 %d %d %d 1 > waiter_ex_data\n", (int) (10.0 * freq + 0.5), l, (int) (s * 1000000 + 0.5)); /* and start the files */ printf("uptime >freq_high\n\n"); } else { printf("../c/waiter 3 180 %d %d %d 1 >> waiter_ex_data\n", (int) (10.0 * freq + 0.5), l, (int) (s * 1000000 + 0.5)); printf("uptime >>freq_high\n\n"); } /* endif */ } /* endfor */ } /* endprogram */