/**
 * SmartPerfetto Configurable Thresholds
 *
 * This module defines configurable thresholds for performance analysis.
 * These values were previously hardcoded throughout the codebase but are
 * now centralized here for:
 * - Easy customization per device/scenario
 * - Clear documentation of threshold semantics
 * - Future extensibility (e.g., device profiles)
 *
 * @module config/thresholds
 */
/**
 * Thresholds for classifying jank severity based on rate and count.
 *
 * These are used by FrameAgent and other components to determine
 * whether a jank issue is critical, warning, or informational.
 */
export interface JankSeverityThresholds {
    /** Jank rate (%) above which severity is 'critical' */
    criticalRate: number;
    /** Jank count above which severity is 'critical' */
    criticalCount: number;
    /** Jank rate (%) above which severity is 'warning' */
    warningRate: number;
    /** Jank count above which severity is 'warning' */
    warningCount: number;
}
/**
 * Default jank severity thresholds.
 *
 * Rationale:
 * - criticalRate (15%): 1 in 7 frames is janky - very noticeable to users
 * - criticalCount (30): ~0.5s of jank in a typical scroll session
 * - warningRate (5%): 1 in 20 frames - perceptible to sensitive users
 * - warningCount (10): ~0.17s of jank - worth investigating
 *
 * Note: These thresholds apply to all refresh rates. For 120Hz devices,
 * the same rate means more absolute jank events but the user perception
 * of jank rate (%) remains consistent.
 */
export declare const DEFAULT_JANK_THRESHOLDS: JankSeverityThresholds;
/**
 * Get jank thresholds adjusted for game scenarios.
 * Games typically have lower frame rates and different tolerance.
 */
export declare function getGameJankThresholds(): JankSeverityThresholds;
/**
 * Standard refresh rate to VSync period mapping (in nanoseconds).
 *
 * This is used when VSync period cannot be detected from the trace
 * and must be estimated from device configuration.
 */
export declare const VSYNC_PERIODS_NS: Record<number, bigint>;
/**
 * Default VSync period when refresh rate is unknown.
 * Uses 120Hz as the modern default for flagship devices.
 *
 * Rationale: Most modern Android flagships (2022+) support 120Hz displays.
 * Using 120Hz as default is more conservative for jank detection:
 * - A frame that's fine at 60Hz (16ms) would be janky at 120Hz (8.3ms)
 * - Better to catch potential issues than miss them
 * - The vsync_config skill will override this with actual trace data
 */
export declare const DEFAULT_VSYNC_PERIOD_NS: bigint;
/**
 * Number of VSync periods to use when estimating frame end time
 * from start time (when end_ts and dur_ms are both unavailable).
 *
 * Value of 2 accounts for:
 * - 1 vsync for the frame itself
 * - 1 vsync buffer for display latency
 */
export declare const DEFAULT_VSYNC_PERIODS_FOR_FRAME_ESTIMATION = 2;
/**
 * Infer VSync period from trace context or use default.
 *
 * Resolution order:
 * 1. Detected VSync period from trace (vsync_period_ns) - from vsync_config skill
 * 2. Device refresh rate config (device_refresh_rate)
 * 3. Default 120Hz (modern flagship assumption)
 *
 * @param traceContext - Context containing detected trace properties
 * @returns VSync period in nanoseconds as BigInt
 */
export declare function inferVsyncPeriodNs(traceContext?: {
    detectedVsyncPeriodNs?: string | bigint | number;
    deviceRefreshRate?: number;
}): bigint;
/**
 * VRR detection indicators.
 * Used to determine if a device is using Variable Refresh Rate.
 */
export interface VRRIndicators {
    /** Whether VRR is detected */
    isVRR: boolean;
    /** Min observed refresh rate (Hz) */
    minRefreshRate?: number;
    /** Max observed refresh rate (Hz) */
    maxRefreshRate?: number;
    /** Dominant refresh rate (Hz) - most common during trace */
    dominantRefreshRate?: number;
}
/**
 * Get jank detection multiplier for VRR devices.
 *
 * VRR devices can dynamically adjust refresh rate, so jank detection
 * needs to account for variable vsync periods. The multiplier adjusts
 * the frame deadline threshold.
 *
 * @param vrr - VRR indicators from trace analysis
 * @returns Multiplier for frame deadline (1.0 = no adjustment)
 */
export declare function getVRRJankMultiplier(vrr: VRRIndicators): number;
/**
 * Circuit breaker configuration for user intervention handling.
 */
export interface CircuitBreakerThresholds {
    /** Max times user can force-close per session */
    maxForceCloseCount: number;
    /** Cooldown period between force-closes (ms) */
    forceCloseCooldownMs: number;
    /** Timeout waiting for user response (ms) */
    userResponseTimeoutMs: number;
    /** Number of successes needed to transition HALF_OPEN → CLOSED */
    halfOpenSuccessThreshold: number;
}
/**
 * Default circuit breaker thresholds.
 */
export declare const DEFAULT_CIRCUIT_BREAKER_THRESHOLDS: CircuitBreakerThresholds;
/**
 * Default concurrency limit for DirectSkillExecutor.
 *
 * This limits how many skills can execute in parallel to avoid
 * overwhelming trace_processor_shell with concurrent queries.
 */
export declare const DEFAULT_DIRECT_SKILL_CONCURRENCY = 6;
/**
 * Maximum number of frames to analyze per session in deep analysis.
 *
 * This prevents runaway analysis on traces with many jank frames.
 * Can be overridden via skill parameters.
 */
export declare const DEFAULT_MAX_FRAMES_PER_SESSION = 8;
/**
 * Maximum number of frames per session when cluster-first full analysis is required.
 *
 * Used by scrolling strategy stage-2 frame list extraction so we can analyze
 * significantly more frames (e.g., 50+) and produce actionable K1/K2/K3 clusters.
 */
export declare const DEFAULT_CLUSTERING_MAX_FRAMES_PER_SESSION = 200;
/**
 * Maximum number of sessions to analyze in overview stage.
 *
 * This limits the scope of analysis for very long traces.
 */
export declare const DEFAULT_MAX_SESSIONS_TO_ANALYZE = 10;
/**
 * Threshold for jank list to be classified as 'critical' severity.
 *
 * When the number of detected jank frames exceeds this, the finding
 * is reported as critical severity in the UI.
 */
export declare const JANK_LIST_CRITICAL_THRESHOLD = 20;
/**
 * Minimum confidence required to accept analysis results without
 * triggering additional rounds of investigation.
 */
export declare const DEFAULT_CONFIDENCE_THRESHOLD = 0.7;
/**
 * Confidence assigned to findings extracted from raw SQL results
 * (as opposed to AI-generated conclusions).
 */
export declare const DEFAULT_RAW_FINDING_CONFIDENCE = 0.75;
/**
 * Frame time thresholds for UI display (warning/critical coloring).
 *
 * These are derived from VSync periods:
 * - warningMs: 1 VSync period (16.67ms at 60Hz)
 * - criticalMs: 2 VSync periods (33.33ms at 60Hz)
 * - maxCriticalMs: ~6 VSync periods (100ms - severe jank)
 */
export interface FrameTimeDisplayThresholds {
    /** Average frame time warning threshold (ms) */
    avgWarningMs: number;
    /** Average frame time critical threshold (ms) */
    avgCriticalMs: number;
    /** Max frame time warning threshold (ms) */
    maxWarningMs: number;
    /** Max frame time critical threshold (ms) */
    maxCriticalMs: number;
}
/**
 * Default frame time display thresholds (120Hz assumptions).
 *
 * Updated from 60Hz to 120Hz to match modern devices.
 * These are UI display thresholds; actual jank detection uses vsync_config skill.
 */
export declare const DEFAULT_FRAME_TIME_DISPLAY_THRESHOLDS: FrameTimeDisplayThresholds;
/**
 * Generate frame time thresholds for a specific refresh rate.
 *
 * @param hz - Refresh rate in Hz (must be > 0 and <= 500)
 * @returns Thresholds for the given refresh rate, or default 60Hz thresholds for invalid input
 */
export declare function getFrameTimeThresholdsForHz(hz: number): FrameTimeDisplayThresholds;
/**
 * VSync period in nanoseconds for SQL queries.
 * Used as a constant in SQL WHERE clauses for jank detection.
 *
 * Note: We use 16666666 (rounded down from 16666667) for two reasons:
 * 1. Many existing SQL queries in the codebase use this value
 * 2. Slightly lower threshold is more conservative (catches edge cases)
 *
 * The 1ns difference (0.000001ms) is negligible in practice.
 */
export declare const SQL_VSYNC_THRESHOLD_NS = 16666666;
/**
 * Double VSync period for jank detection in SQL.
 * Missing 2+ VSyncs is typically considered jank.
 */
export declare const SQL_JANK_THRESHOLD_NS: number;
/**
 * Thresholds used in jank_frame_detail.skill.yaml root cause analysis.
 *
 * These define when specific conditions trigger diagnostic rules.
 * Priority order in the YAML determines which rule fires first.
 *
 * Design rationale:
 * - sliceDur (>8ms): Half of 16.7ms vsync, significant for 60Hz
 * - gpuFence (>3ms): Noticeable GPU blocking
 * - schedLatency (>5ms): Severe scheduling issue
 * - ioBlock (>2ms): IO on main thread is problematic
 * - totalSchedLatency (>3ms): Cumulative runnable wait
 * - q3 (>20%): Significant CPU contention
 * - q4 (>30%): Too much blocking/sleeping
 * - bigFreq (<1200MHz): Below typical boost frequency
 * - bigLoadPct (>90%): CPU cluster near saturation
 */
export declare const ROOT_CAUSE_THRESHOLDS: {
    sliceDurCritical: number;
    sliceDurWarning: number;
    gpuFenceCritical: number;
    gpuFenceWarning: number;
    schedLatencyCritical: number;
    q3CriticalPct: number;
    ioBlockCritical: number;
    totalSchedLatencyCritical: number;
    q4WarningPct: number;
    renderQ4WarningPct: number;
    q2WarningPct: number;
    bigFreqWarningMhz: number;
    bigLoadCriticalPct: number;
    bigLoadWarningPct: number;
};
export declare const ANALYSIS_THRESHOLDS: {
    jank: JankSeverityThresholds;
    circuitBreaker: CircuitBreakerThresholds;
    vsync: {
        periods: Record<number, bigint>;
        default: bigint;
        framesForEstimation: number;
    };
    execution: {
        directSkillConcurrency: number;
        maxFramesPerSession: number;
        clusteringMaxFramesPerSession: number;
        maxSessionsToAnalyze: number;
    };
    confidence: {
        threshold: number;
        rawFinding: number;
    };
    ui: {
        jankListCriticalThreshold: number;
        frameTimeDisplay: FrameTimeDisplayThresholds;
    };
    sql: {
        vsyncThresholdNs: number;
        jankThresholdNs: number;
    };
    rootCause: {
        sliceDurCritical: number;
        sliceDurWarning: number;
        gpuFenceCritical: number;
        gpuFenceWarning: number;
        schedLatencyCritical: number;
        q3CriticalPct: number;
        ioBlockCritical: number;
        totalSchedLatencyCritical: number;
        q4WarningPct: number;
        renderQ4WarningPct: number;
        q2WarningPct: number;
        bigFreqWarningMhz: number;
        bigLoadCriticalPct: number;
        bigLoadWarningPct: number;
    };
};
//# sourceMappingURL=thresholds.d.ts.map