nocobase/packages/core/utils/src/measure-execution-time.ts

8 lines
282 B
TypeScript
Raw Normal View History

export async function measureExecutionTime(operation, operationName) {
const startTime = Date.now();
await operation();
const endTime = Date.now();
const duration = (endTime - startTime).toFixed(0);
console.log(`${operationName} completed in ${duration} milliseconds`);
}