mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
00c1a0c688
Summary: Decoding large actions is a plausible culprit for hogging CPU time for certain documents. To begin with, log the time taken for this operation, so that we can tell if it's a problem in practice. Test Plan: Should not affect any current behaviors Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2989
12 lines
315 B
TypeScript
12 lines
315 B
TypeScript
import * as log from 'app/server/lib/log';
|
|
|
|
export function reportTimeTaken<T>(locationLabel: string, callback: () => T): T {
|
|
const start = Date.now();
|
|
try {
|
|
return callback();
|
|
} finally {
|
|
const timeTaken = Date.now() - start;
|
|
log.debug("Time taken in %s: %s ms", locationLabel, timeTaken);
|
|
}
|
|
}
|