MCPcopy Create free account
hub / github.com/angular/angular / spin

Function spin

packages/compiler-cli/preprocessor/test/perf_spec.ts:32–41  ·  view source on GitHub ↗

Busy-waits so that a section has a measurable duration.

(us: number)

Source from the content-addressed store, hash-verified

30
31/** Busy-waits so that a section has a measurable duration. */
32function spin(us: number): void {
33 const [s, ns] = process.hrtime();
34 const end = s * 1e6 + ns / 1e3 + us;
35 while (true) {
36 const [s2, ns2] = process.hrtime();
37 if (s2 * 1e6 + ns2 / 1e3 >= end) {
38 return;
39 }
40 }
41}
42
43function spans(events: TraceEvent[], ph: TraceEvent['ph']): TraceEvent[] {
44 return events.filter((e) => e.ph === ph);

Callers 1

perf_spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected