Skip to main content
Version: 0.4.0

getRuntimeSync

This method calculates the execution time of async functions and returns the execution time to you in the form of a promise.

Params

getRuntimeSync(inputFunction);
  • inputFunction → This input is a function. The function whose execution time will be calculated

Returns

<Promise> //2002.993833
  • Promise → Returns a promise that contains the duration of the function's execution

Usage

const inpFuncSync1 = async () => {
return await new Promise((resolve, reject) => {
setTimeout(() => {
resolve(true);
}, 2000);
});
};

const momentMachine = async () => {
const runtime = await getRuntimeSync(inpFuncSync1);
console.log(runtime);//2002.993833
};

momentMachine();