modernc.org/99c@v1.0.1-0.20181109153923-a9e8197063d9/examples/prof/bogomips.c (about) 1 #include <stdlib.h> 2 #include <stdio.h> 3 4 // src: https://en.wikipedia.org/wiki/BogoMips#Computation_of_BogoMIPS 5 static void delay_loop(long loops) 6 { 7 long d0 = loops; 8 do { 9 --d0; 10 } 11 while (d0 >= 0); 12 } 13 14 int main(int argc, char **argv) 15 { 16 if (argc != 2) { 17 return 2; 18 } 19 20 int n = atoi(argv[1]); 21 if (n <= 0) { 22 return 1; 23 } 24 25 delay_loop(n); 26 }