Reputation: 17
Currently, the time $0 command within my bash script shows the following similar output
time $0
real 0m0.000s
user 0m0.000s
sys 0m0.000s
but ideally, I would like to see the execution time of the script in nanoseconds. How would this be done? Thanks
Upvotes: 0
Views: 676
Reputation: 31
I'm afraid that you won't get reliable measurements with this precision.
Upvotes: 1
Reputation: 17
This solution worked
start_time="$(date -u +%N)"
end_time="$(date -u +%N)"
nanotime="$(bc <<<"$end_time-$start_time")"
echo "$nanotime"
Upvotes: 0