@vulcan-sql/core
Version:
Core package of VulcanSQL
35 lines (34 loc) • 1.44 kB
TypeScript
/**
* This is a performance analysis tool for concurrent tasks
* You can use it to collect the start and end time of a task, the collected data with the same key will be summarized
* the summarzied report contains the min, max, avg, median, p90 of the task
* When the code snippet is executed, the performance analysis tool will automatically collect the start and end time of the task
*
* example:
* const start = Date.now();
* await fn_to_measure()
* const end = Date.now();
* PerformanceAnalysis.collect('fn_to_measure', start, end)
*
* You can choose when to summarize the performance data
* for example, you can summarize the performance data before server closed
*
* public async close() {
if (this.servers) {
... close server
}
PerformanceAnalysis.count();
}
*
* Note: If you want to view the performance by each API call, you can use k6 or you can specify the group name when collecting the performance data
* and implement another count & writePerformanceReport funtion to summarize the performance data by group name
*
*/
export declare class PerformanceAnalysis {
static collect(key: string, start: number, end: number, group?: string): void;
static count(): boolean;
static getStatistic(key: string): any;
static clean: () => void;
static writePerformanceReport(): void;
}
export declare function getAnalysis(): void;