MCPcopy
hub / github.com/tensorflow/tfjs / TestBackendTimer

Class TestBackendTimer

tfjs-core/src/profiler_test.ts:26–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24import {TypedArray} from './types';
25
26class TestBackendTimer implements BackendTimer {
27 private counter = 1;
28 constructor(
29 private delayMs: number, private queryTimeMs: number,
30 private extraInfo: string) {}
31
32 timerAvailable() {
33 return true;
34 }
35
36 async time(query: () => void): Promise<BackendTimingInfo> {
37 query();
38 const kernelMs = await new Promise<number>(
39 resolve => setTimeout(
40 () => resolve(this.queryTimeMs * this.counter++), this.delayMs));
41 return {kernelMs, getExtraProfileInfo: () => this.extraInfo};
42 }
43}
44
45class TestLogger extends Logger {
46 override logKernelProfile(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…