molstar
Version:
A comprehensive macromolecular library.
45 lines (44 loc) • 1.37 kB
TypeScript
/**
* Copyright (c) 2022-2025 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
import { GLRenderingContext } from './compat';
import { WebGLStats } from './context';
import { WebGLExtensions } from './extensions';
export type TimerResult = {
readonly label: string;
readonly gpuElapsed: number;
readonly gpuAvg: number;
readonly cpuElapsed: number;
readonly cpuAvg: number;
readonly children: TimerResult[];
readonly calls?: Calls;
readonly note?: string;
};
type WebGLTimerOptions = {
captureStats?: boolean;
note?: string;
};
export type WebGLTimer = {
/** Check with GPU for finished timers. */
resolve: () => TimerResult[];
mark: (label: string, options?: WebGLTimerOptions) => void;
markEnd: (label: string) => void;
stats: () => {
gpu: Record<string, number>;
cpu: Record<string, number>;
};
formatedStats: () => Record<string, string>;
clear: () => void;
destroy: () => void;
};
type Calls = {
drawInstanced: number;
counts: number;
};
export declare function createTimer(gl: GLRenderingContext, extensions: WebGLExtensions, stats: WebGLStats, options?: {
avgCount: number;
}): WebGLTimer;
export declare function printTimerResults(results: TimerResult[]): void;
export {};