139 lines
4.1 KiB
TypeScript
139 lines
4.1 KiB
TypeScript
// Metro module 12704 (f12705).
|
|
import { cloneDeep } from "../../_bundle/Module12";
|
|
const r20 = {
|
|
LONGER_DISPATCH: "longer_dispatch",
|
|
EXCEEDED_MAX_CONSECUTIVE_FLUSHES: "exceeded_max_consecutive_flushes",
|
|
FIRED_DUE_TO_MAX_TIMEOUT: "fired_due_to_max_timeout",
|
|
SKIP_IDLE_CALLBACK_DUE_TO_BACKGROUNDED: "skip_idle_callback_due_to_backgrounded"
|
|
};
|
|
const r25 = {
|
|
TIME_TO_FIRE_IDLE_CALLBACK: "time_to_fire_idle_callback",
|
|
TIME_TO_QUEUE_EMPTY: "time_to_flush_all_work",
|
|
TIME_OVER_DEADLINE: "time_over_deadline",
|
|
DEADLINE_INITIAL_TIME_REMAINING: "initial_time_of_deadline"
|
|
};
|
|
const r30 = {
|
|
COUNT_DISPATCHES_LEFT_AFTER_YIELD: "count_dispatches_left_after_yield",
|
|
COUNT_FLUSH_BEFORE_QUEUE_EMPTY: "count_flush_before_queue_empty",
|
|
COUNT_INITIAL_DISPATCHS_LENGTH: "count_initial_dispatches_length"
|
|
};
|
|
const r13 = Object;
|
|
const r34 = {};
|
|
r34[r25.TIME_TO_FIRE_IDLE_CALLBACK] = null;
|
|
r34[r25.TIME_TO_QUEUE_EMPTY] = null;
|
|
r34[r25.TIME_OVER_DEADLINE] = null;
|
|
r34[r25.DEADLINE_INITIAL_TIME_REMAINING] = null;
|
|
let c8754_3 = r13.freeze(r34);
|
|
const r39 = Object;
|
|
const r41 = {};
|
|
r41[r25.TIME_TO_FIRE_IDLE_CALLBACK] = [0, 0];
|
|
r41[r25.TIME_TO_QUEUE_EMPTY] = [0, 0];
|
|
r41[r25.TIME_OVER_DEADLINE] = [0, 0];
|
|
r41[r25.DEADLINE_INITIAL_TIME_REMAINING] = [0, 0];
|
|
let c8754_4 = r39.freeze(r41);
|
|
const r50 = Object;
|
|
const r52 = {};
|
|
r52[r30.COUNT_FLUSH_BEFORE_QUEUE_EMPTY] = [0, 0];
|
|
r52[r30.COUNT_DISPATCHES_LEFT_AFTER_YIELD] = [0, 0];
|
|
r52[r30.COUNT_INITIAL_DISPATCHS_LENGTH] = [0, 0];
|
|
let c8754_5 = r50.freeze(r52);
|
|
const r60 = Object;
|
|
const r62 = {};
|
|
r62[r20.LONGER_DISPATCH] = 0;
|
|
r62[r20.EXCEEDED_MAX_CONSECUTIVE_FLUSHES] = 0;
|
|
r62[r20.FIRED_DUE_TO_MAX_TIMEOUT] = 0;
|
|
r62[r20.SKIP_IDLE_CALLBACK_DUE_TO_BACKGROUNDED] = 0;
|
|
let c8754_6 = r60.freeze(r62);
|
|
export { r20 as WorkSchedulerTelemetryEvent };
|
|
export { r25 as WorkSchedulerTelemetryTiming };
|
|
export { r30 as WorkSchedulerTelemetryMeasurement };
|
|
export class WorkSchedulerTelemetry {
|
|
constructor() {
|
|
const r11 = {
|
|
__proto__: new.target.prototype,
|
|
_timeTracking: cloneDeep(c8754_3),
|
|
_timingStats: null,
|
|
_measurements: null,
|
|
_eventCounts: null,
|
|
_enabled: false
|
|
};
|
|
r11._timingStats = cloneDeep(c8754_4);
|
|
r11._measurements = cloneDeep(c8754_5);
|
|
r11._eventCounts = cloneDeep(c8754_6);
|
|
return r11;
|
|
}
|
|
reset() {
|
|
this._timeTracking = cloneDeep(c8754_3);
|
|
this._timingStats = cloneDeep(c8754_4);
|
|
this._measurements = cloneDeep(c8754_5);
|
|
this._eventCounts = cloneDeep(c8754_6);
|
|
}
|
|
clearTime(a0) {
|
|
this._timeTracking[a0] = null;
|
|
}
|
|
_storeTimeValue(a0, a1) {
|
|
const [r11, r12] = this._timingStats[a0];
|
|
this._timingStats[a0] = [(r11 * r12 + a1) / (r12 + 1), r12 + 1];
|
|
}
|
|
time(a0) {
|
|
if (this._enabled) {
|
|
this._timeTracking[a0] = performance.now();
|
|
}
|
|
}
|
|
timeEnd(a0) {
|
|
if (this._enabled) {
|
|
const r4 = this._timeTracking[a0];
|
|
if (r4 != null) {
|
|
this._storeTimeValue(a0, performance.now() - r4);
|
|
this._timeTracking[a0] = null;
|
|
}
|
|
}
|
|
}
|
|
timeTrack(a0, a1) {
|
|
if (this._enabled) {
|
|
this._storeTimeValue(a0, a1);
|
|
}
|
|
}
|
|
measure(a0, a1) {
|
|
if (this._enabled) {
|
|
const [r12, r13] = this._measurements[a0];
|
|
this._measurements[a0] = [(r12 * r13 + a1) / (r13 + 1), r13 + 1];
|
|
}
|
|
}
|
|
track(a0) {
|
|
if (this._enabled) {
|
|
const _eventCounts = this._eventCounts;
|
|
_eventCounts[a0] = _eventCounts[a0] + 1;
|
|
}
|
|
}
|
|
toggleTelemetry(a0) {
|
|
this._enabled = a0;
|
|
}
|
|
get isTelemetryEnabled() {
|
|
return this._enabled;
|
|
}
|
|
generateTelemetry() {
|
|
const r13 = Object.entries(this._timingStats).reduce((acc, item) => {
|
|
const [r8, r7] = item;
|
|
const [r36] = r7;
|
|
acc[`avg_${r8}`] = `${r36.toFixed(2)}ms`;
|
|
return acc;
|
|
}, {});
|
|
const r20 = Object.entries(this._measurements).reduce((acc, item) => {
|
|
const [r8, r7] = item;
|
|
const [r35] = r7;
|
|
acc[`avg_${r8}`] = `${r35.toFixed(2)}`;
|
|
return acc;
|
|
}, {});
|
|
return {
|
|
...Object.entries(this._eventCounts).reduce((acc, item) => {
|
|
const [r8, r7] = item;
|
|
acc[`count_${r8}`] = `${r7}`;
|
|
return acc;
|
|
}, {}),
|
|
...r13,
|
|
...r20
|
|
};
|
|
}
|
|
}
|