/**
 * Configuration for Perfetto trace event format
 */
export interface PerfettoConfig {
    /** Whether to include stack traces in events */
    includeStackTraces: boolean;
}
/**
 * Default Perfetto profiler configuration
 */
export declare const DEFAULT_PERFETTO_CONFIG: PerfettoConfig;
/**
 * Represents a trace event in Chrome Trace Event format
 */
export interface TraceEvent {
    /** Event name */
    name: string;
    /** Event phase: 'X' = Complete, 'B' = Begin, 'E' = End, 'I' = Instant, 'M' = Metadata */
    ph: "X" | "B" | "E" | "I" | "M";
    /** Timestamp in microseconds */
    ts: number;
    /** Duration in microseconds (for Complete events) */
    dur?: number;
    /** Process ID */
    pid: number;
    /** Thread ID */
    tid: number;
    /** Additional event arguments/metadata */
    args?: Record<string, any>;
}
/**
 * Represents the full trace file structure
 */
export interface PerfettoTrace {
    /** Array of trace events */
    traceEvents: TraceEvent[];
    /** Optional metadata */
    metadata?: Record<string, any>;
}
/**
 * Track information for organizing events by tool/operation type
 */
interface Track {
    id: number;
    name: string;
    type: "main" | "tool" | "llm" | "debug" | "file";
}
/**
 * A performance profiler that outputs Chrome Trace Event JSON format
 * compatible with Perfetto UI and chrome://tracing
 */
export declare class PerfettoProfiler {
    private events;
    private activeEvents;
    private tracks;
    private nextTrackId;
    private sessionStartTime;
    private config;
    constructor(config?: Partial<PerfettoConfig>);
    private getTimestamp;
    /**
     * Create or get a track for organizing events
     */
    createTrack(trackKey: string, trackName: string, type: Track["type"]): number;
    private getTrackId;
    /**
     * Start timing a new event
     */
    startFrame(frameName: string, trackKey?: string, args?: Record<string, any>): void;
    /**
     * Update the args of the most recent active event for a track
     */
    updateActiveFrameArgs(trackKey?: string, additionalArgs?: Record<string, any>): void;
    /**
     * End timing the most recent event for a track
     */
    endFrame(trackKey?: string): void;
    /**
     * Time a function execution with automatic start/end
     */
    timeAsync<T>(frameName: string, fn: () => Promise<T>, trackKey?: string, args?: Record<string, any>): Promise<T>;
    /**
     * Time a synchronous function execution with automatic start/end
     */
    timeSync<T>(frameName: string, fn: () => T, trackKey?: string, args?: Record<string, any>): T;
    /**
     * Add an instant event (single point in time)
     */
    addInstantEvent(name: string, trackKey?: string, args?: Record<string, any>): void;
    /**
     * End all active events across all tracks
     */
    endAllActiveEvents(): void;
    /**
     * Generate the complete Perfetto trace JSON
     */
    generateTrace(): PerfettoTrace;
    /**
     * Generate JSON string of the trace
     */
    generateJSON(): string;
    reset(): void;
    /**
     * Get current statistics
     */
    getStats(): {
        totalEvents: number;
        activeEvents: number;
        totalTracks: number;
    };
    updateConfig(config: Partial<PerfettoConfig>): void;
    getTracks(): Map<string, Track>;
}
export declare const globalPerfettoProfiler: PerfettoProfiler;
export {};
//# sourceMappingURL=perfetto-profiler.d.ts.map