I assume you're compiling WITHOUT optimization? Because any decent optimizing compiler will optimize that entire thing to nothing, since the function has no side effects, and returns no value.
Here's what I get:
Code:
scott@scott-intel-mini-ubuntu:/tmp$ g++ -O3 -o timer timer.cpp
scott@scott-intel-mini-ubuntu:/tmp$ ./timer
Running inline function f1()...
Time elapsed: 0 ticks.
Running function f2()...
Time elapsed: 0 ticks.
sh: pause: not found
As opposed to without optimization:
Code:
scott@scott-intel-mini-ubuntu:/tmp$ g++ -O0 -o timer timer.cpp
scott@scott-intel-mini-ubuntu:/tmp$ ./timer
Running inline function f1()...
Time elapsed: 620000 ticks.
Running function f2()...
Time elapsed: 560000 ticks.
sh: pause: not found
Looking at the assembly code generated without optimization, neither call is being inlined, and the assembly code for f1() and f2() is identical. So why the difference? I can't explain it, honestly, but I doubt it has anything to do with inlining, since neither function is actually being inlined.
Your compiler may differ, of course.