I\'m trying to write a function that measures the execution time of another function:
export class Profiler {
public measureSyncFunc(fn: () => any): P
Have a look at timeFnPromise and the related test cases.
Samples Usage:
const wrappedFn = timeFnPromise(aFunctionThatReturnsAPromise)
wrappedFn()
.then((values)=>{
const {ret, elapsedTime} = values
console.log(`ret:[${ret}] elapsedTime:[${elapsedTime}]`)
})
Also available via NPM module jschest.