I have a node file which contains many methods including a Async call method which fetches data from db. I need to find the exact execution time of it.
So i tried,
.
.
var start = Date.now();
await dbFetching()
var end = Date.now();
console.log(end - start)
.
Then I tried with an external shell script which executes the file and find the actual time execution of the entire file execution. But the issue is i need to calculate only the time taken for the Async call (dbFetching). Below is my shell script,
#!/bin/sh
START=$(date +%s)
node ./s3-glacier.js
END=$(date +%s)
DIFF=$(( $END - $START ))
echo "It took $DIFF seconds"
But i though like, if i can run entire node script in the shell script, May be i can calculate the time. Therefore suggest your thought on this to calculate only the Async time consumption. Thanks in advance