UNPKG

@snap/camera-kit

Version:
58 lines 2.24 kB
/** * @category Rendering * @category Metrics */ export interface ComputedFrameMetrics { avgFps: number; lensFrameProcessingTimeMsAvg: number; lensFrameProcessingTimeMsStd: number; lensFrameProcessingTimeMsMedian: number; lensFrameProcessingN: number; } /** * Represents an ongoing measurement of rendering metrics. * * An instance of this class is obtained by calling {@link LensPerformanceMetrics.beginMeasurement}. Then it may be * used to record rendering performance metrics, reset measurement, or end the measurement. * * @category Rendering * @category Metrics */ export declare class LensPerformanceMeasurement { private instances; private state; private priorFrameCompletedTime?; constructor(instances: Set<LensPerformanceMeasurement>); /** @internal */ update(processingTimeMs: number): void; /** * Return a {@link ComputedFrameMetrics} object, containing lens performance metrics. * * This method may be called multiple times, each time reporting values computed since the time when this instance * was created. */ measure(): ComputedFrameMetrics; /** * Reset the measured performance statistics (averages, std deviations). This is equivalent to using * {@link LensPerformanceMetrics.beginMeasurement} to create a new LensPerformanceMeasurement instance, but may be * more convenient. */ reset(): void; /** * Stop measuring performance statistics. * * This instance will not be garbage collected until this method is called. Therefore it is important to call this * method at the appropriate time to avoid leaking memory -- particularly if your application creates many * LensPerformanceMeasurement instances. */ end(): void; /** * In order to calculate the mean, variance, and standard deviation for the processing times * we are using Welford's online algorithm. * https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm * * @param processingTimeMs Processing time that is returned from registered callback */ private computeRunningStats; } //# sourceMappingURL=LensPerformanceMeasurement.d.ts.map