/** * Performance timing utility for tracking operation duration */ import type { UserEvents } from '../core/user-events'; export interface PerformanceTiming { startTime: number; endTime?: number; duration?: number; } /** * Start timing an operation * @param key - Unique identifier for the operation * @param timings - Map to store timing information * @returns The start timestamp */ export declare const startTiming: (key: string, timings?: Map) => number; /** * End timing an operation and calculate duration * @param key - Unique identifier for the operation * @param timings - Map containing timing information * @returns The duration in milliseconds, or undefined if timing wasn't started */ export declare const endTiming: (key: string, timings: Map) => number | undefined; /** * Get timing information for an operation * @param key - Unique identifier for the operation * @param timings - Map containing timing information * @returns The timing information, or undefined if not found */ export declare const getTiming: (key: string, timings: Map) => PerformanceTiming | undefined; /** * Clear timing information for an operation * @param key - Unique identifier for the operation * @param timings - Map containing timing information */ export declare const clearTiming: (key: string, timings: Map) => void; /** * Clear all timing information * @param timings - Map containing timing information */ export declare const clearAllTimings: (timings: Map) => void; /** * Execute a function with automatic timing * @param key - Unique identifier for the operation * @param fn - Function to execute * @param analytics - UserEvents instance for logging * @param timings - Optional map to store timing information * @returns Promise that resolves with the function result and timing duration */ export declare const withTiming: (key: string, fn: () => Promise, analytics: UserEvents, timings?: Map) => Promise<{ result: T; duration: number; }>; /** * Convenience function to track async operation timing * @param key - Unique identifier for the operation * @param fn - Function to execute * @param analytics - UserEvents instance for logging * @returns Promise that resolves with the function result */ export declare const trackPerformance: (key: string, fn: () => Promise, analytics: UserEvents) => Promise;