I tried >>time ./a.out
got
real 0m0.035s
user 0m0.008s
sys 0m0.004s
what it really means?
when I repeated I got
real 0m0.012s
user 0m0.000s
sys 0m0.012s
if I try this many times each time I am getting different output why? how can I solve it.
Each of those are the different runtimes of your program.
Real is the actual wallclock time it took to run
sys is the amount of time the system spent while executing your program (i.e. time spent by the kernel)
user is the amount of time that was spent in user-mode executing it (i.e. time spent excuting where you weren't in the kernel).
There is no "solution" because there is no problem. You are running a multi tasking system and it depends on the load how fast you get the response. What you can do is running it a few times and take the average as "guide".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With