[user@host][~] 6> cc -xO4 timing.c -o timing
[user@host][~] 6> ./timing
Total run time: 0
[user@host][~] 6>
Could someone tell me what this snippet of code does and where it is used? I am supposing from the command line.
Aso, it seems like someone is testing a .c program for run time. But why is Total run time 0? Im not familiar with this command -xO4, either.
I was showed this example aswell, where the run time isnt 0. Obviously the -xO4 does something or…?
[user@host][~] 6> cc timing.c -o timing
[user@host][~] 6> ./timing
Total run time: 3520000
[user@host][~] 6>
If the question is: “If timing.c is compiled with -xO4, why does the run time go from 3520000 to 0?”, then the answer is that -x04 performs optimizations* that make timing run faster than if it were built without the flag. We don’t know what units are used for run time. If it’s milliseconds, then your speedup is from about 1 hour runtime to less than a millisecond. That’s a little surprising.
*(See Abel’s post for specific details.)