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

Method asyncEvent

packages/compiler-cli/preprocessor/src/perf.ts:412–444  ·  view source on GitHub ↗
(
    ph: 'b' | 'e',
    kind: SpanKind,
    fileId: number,
    args?: Record<string, unknown>,
  )

Source from the content-addressed store, hash-verified

410 }
411
412 private asyncEvent(
413 ph: 'b' | 'e',
414 kind: SpanKind,
415 fileId: number,
416 args?: Record<string, unknown>,
417 ): void {
418 const now = nowMicros();
419 const key = fileId * SPAN_KINDS + kind;
420 if (ph === 'b') {
421 this.asyncOpen.set(key, now);
422 } else {
423 const start = this.asyncOpen.get(key);
424 if (start === undefined) {
425 return;
426 }
427 this.asyncOpen.delete(key);
428 this.asyncCount[kind]++;
429 this.asyncWallUs[kind] += Math.max(0, now - start);
430 }
431 const event: TraceEvent = {
432 name: SPAN_NAMES[kind],
433 cat: 'ngp.file',
434 ph,
435 pid: this.pid,
436 tid: 1,
437 ts: now,
438 id2: {local: fileId},
439 };
440 if (args !== undefined) {
441 event.args = args;
442 }
443 this.events.push(event);
444 }
445
446 count(counter: Counter, n = 1): void {
447 this.counters[counter] += n;

Callers 3

newFileIdMethod · 0.95
asyncBeginMethod · 0.95
asyncEndMethod · 0.95

Calls 6

nowMicrosFunction · 0.85
setMethod · 0.65
getMethod · 0.65
deleteMethod · 0.45
maxMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected