mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 15:36:25 +00:00
19 lines
387 B
TypeScript
19 lines
387 B
TypeScript
|
let startTime = 0;
|
||
|
let lastTime = 0;
|
||
|
let splits: Record<string, number> = {};
|
||
|
|
||
|
export function splitInit(): void {
|
||
|
splits = {};
|
||
|
startTime = Date.now();
|
||
|
lastTime = startTime;
|
||
|
}
|
||
|
|
||
|
export function addSplit(name: string): void {
|
||
|
splits[name] = Date.now() - lastTime;
|
||
|
lastTime = Date.now();
|
||
|
}
|
||
|
|
||
|
export function getSplits(): any {
|
||
|
return { splits, total: Date.now() - startTime };
|
||
|
}
|