export class ServerTiming {
    headers;
    constructor() {
        this.headers = [];
    }
    getHeader() {
        return this.headers.join(',');
    }
    async time(name, description, promise) {
        const startTime = performance.now();
        try {
            return await promise; // Execute the function
        }
        finally {
            const endTime = performance.now();
            const duration = (endTime - startTime).toFixed(1); // Duration in milliseconds
            this.headers.push(`${name};dur=${duration};desc="${description}"`);
        }
    }
}
//# sourceMappingURL=server-timing.js.map