const downloadText = (filename, text) => {
    const element = document.createElement('a');
    element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
    element.setAttribute('download', filename);
    element.style.display = 'none';
    element.click();
};
export class Profiler {
    constructor() {
        this.baseline = 0;
        this.logs = [];
    }
    setBaseline() {
        this.baseline = performance.now();
    }
    mark(task = 'unknown') {
        const time = performance.now() - this.baseline;
        this.logs.push({
            time,
            task,
        });
        this.baseline = performance.now();
    }
    dumpAsCsv() {
        let result = 'task,tile\n';
        for (let i = 0; i < this.logs.length; i++) {
            result += `${this.logs[i].task},${this.logs[i].time}\n`;
        }
        downloadText('axRevealHighlightProfileDetail.csv', result);
    }
}
//# sourceMappingURL=Profiler.js.map