$ time ./a.out
The sum of all truncatable prime numbers from right to left or left to right is 748317.
The elapsed time was 0.032926 seconds.
real 0m0.053s
user 0m0.050s
sys 0m0.000s |
> The elapsed time was 0.352119 seconds.
I've got 10 times less, ¿did you compile with optimizations?
> Could you explain the differences between the two timing techniques?
>> The one that returns a class/struct is slower than the one returning a value only.
¿slower how?
> Also, why is a wall clock not suitable for timing processes? In fact, I don't even know what a wall clock is...
get a clock, put it on the wall, use it to measure time.
from the manual:
(i) the elapsed real time between invocation and termination, [like using a wall clock]
(ii) the user CPU time [time spent executing instructions of the calling process.
(iii) the system CPU time [time spent in the system while executing tasks on behalf of the calling process]
your process is not the only one executing.