@forgeax/engine-profiler 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser-user-timing.d.ts.map +1 -1
- package/dist/browser-user-timing.mjs +1 -6
- package/dist/browser-user-timing.mjs.map +1 -1
- package/dist/cli.d.ts +2 -14
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.mjs +1 -14
- package/dist/cli.mjs.map +1 -1
- package/dist/compare.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +14 -51
- package/dist/index.mjs.map +1 -1
- package/dist/recorder.d.ts.map +1 -1
- package/package.json +1 -1
- package/scripts/generate-profile-types.mjs +3 -12
- package/src/__tests__/cli-input-errors.test.ts +0 -39
- package/src/__tests__/cli-process.integration.test.ts +1 -28
- package/src/browser-user-timing.ts +3 -11
- package/src/cli.ts +6 -21
- package/src/clock.ts +1 -1
- package/src/compare.ts +1 -4
- package/src/index.ts +0 -6
- package/src/recorder.ts +15 -16
- package/dist/__tests__/browser-profile-detail-owner.test-d.d.ts +0 -2
- package/dist/__tests__/browser-profile-detail-owner.test-d.d.ts.map +0 -1
- package/dist/__tests__/browser-user-timing.test.d.ts +0 -2
- package/dist/__tests__/browser-user-timing.test.d.ts.map +0 -1
- package/dist/__tests__/comparison-side-owner.test-d.d.ts +0 -2
- package/dist/__tests__/comparison-side-owner.test-d.d.ts.map +0 -1
- package/dist/__tests__/schema-derived-union-owner.test.d.ts +0 -2
- package/dist/__tests__/schema-derived-union-owner.test.d.ts.map +0 -1
- package/dist/tool-preview-profile.d.ts +0 -33
- package/dist/tool-preview-profile.d.ts.map +0 -1
- package/src/__tests__/browser-profile-detail-owner.test-d.ts +0 -26
- package/src/__tests__/browser-user-timing.test.ts +0 -127
- package/src/__tests__/comparison-side-owner.test-d.ts +0 -28
- package/src/__tests__/schema-derived-union-owner.test.ts +0 -57
- package/src/tool-preview-profile.ts +0 -67
package/dist/compare.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../src/compare.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACzB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhE,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IAC1D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,QAAQ,EAAE,8BAA8B,CAAC;IAClD,QAAQ,CAAC,IAAI,CAAC,EAAE,0BAA0B,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,0BAA0B,CAAC;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,2BAA2B,CAAC;C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3C;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,QAAQ,EAAE,8BAA8B,CAAC;IAClD,QAAQ,CAAC,IAAI,CAAC,EAAE,0BAA0B,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,0BAA0B,CAAC;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,2BAA2B,CAAC;CAC9C;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACvD;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,SAAS,yBAAyB,EAAE,CAAC;CACvD;AAED,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,GAAG;IAC1D,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GAAG;QAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;KACjC,CAAC;CACH,CAAC;AA6FF,oFAAoF;AACpF,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,OAAO,GACb,aAAa,CAAC,2BAA2B,EAAE,sBAAsB,CAAC,CAQpE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,5 @@ export { createProfiler } from './profiler.js';
|
|
|
17
17
|
export type { ProfileDetail, RecorderSession } from './recorder.js';
|
|
18
18
|
/** Validates a persisted capture before model building or CLI-style analysis. */
|
|
19
19
|
export { validateProfileCapture } from './schema.js';
|
|
20
|
-
export { consumeToolPreviewProfile, type ToolPreviewProfileManifest, type ToolPreviewProfileRef, type ToolPreviewProfileResult, } from './tool-preview-profile.js';
|
|
21
20
|
export type { ProfileAllocationReport, ProfileCapture, ProfileCompleteness, ProfileFrameToken, ProfilePhaseRecord, ProfileRecord, ProfileResult, ProfileSink, ProfileSkipRecord, ProfileSource, } from './types.js';
|
|
22
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,6EAA6E;AAC7E,OAAO,EACL,wBAAwB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EACV,sBAAsB,EACtB,2BAA2B,EAC3B,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,sFAAsF;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,sEAAsE;AACtE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpE,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,2EAA2E;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,4FAA4F;AAC5F,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,qFAAqF;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACpE,iFAAiF;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,6EAA6E;AAC7E,OAAO,EACL,wBAAwB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EACV,sBAAsB,EACtB,2BAA2B,EAC3B,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,sFAAsF;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,sEAAsE;AACtE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpE,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,2EAA2E;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,4FAA4F;AAC5F,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,qFAAqF;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACpE,iFAAiF;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EACV,uBAAuB,EACvB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,aAAa,GACd,MAAM,YAAY,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -7058,11 +7058,6 @@ var require__ = __commonJS({
|
|
|
7058
7058
|
});
|
|
7059
7059
|
|
|
7060
7060
|
// src/browser-user-timing.ts
|
|
7061
|
-
var DEFAULT_CAPTURE_ID = "capture-0001";
|
|
7062
|
-
var CAPTURE_ID_PATTERN = /^capture-[0-9]{4,}$/;
|
|
7063
|
-
function resolveCaptureId(captureId) {
|
|
7064
|
-
return captureId === void 0 || CAPTURE_ID_PATTERN.test(captureId) ? captureId ?? DEFAULT_CAPTURE_ID : DEFAULT_CAPTURE_ID;
|
|
7065
|
-
}
|
|
7066
7061
|
function partialCapture(captureId, phaseCatalog) {
|
|
7067
7062
|
return {
|
|
7068
7063
|
schemaVersion: "1.0",
|
|
@@ -7092,7 +7087,7 @@ function diagnosticsDetail(key) {
|
|
|
7092
7087
|
}
|
|
7093
7088
|
function createUserTimingProfiler(options = {}) {
|
|
7094
7089
|
const diagnosticsKey = options.diagnosticsKey ?? "__forgeaxFramePhaseDiagnostics";
|
|
7095
|
-
const captureId =
|
|
7090
|
+
const captureId = options.captureId ?? "forgeax-user-timing";
|
|
7096
7091
|
const timingEnabled = diagnosticsEnabled(diagnosticsKey);
|
|
7097
7092
|
const detail = diagnosticsDetail(diagnosticsKey);
|
|
7098
7093
|
const performanceApi = timingEnabled ? globalThis.performance : void 0;
|
|
@@ -7200,7 +7195,7 @@ function createProfileClock(readMicros = defaultReadMicros) {
|
|
|
7200
7195
|
return {
|
|
7201
7196
|
nowMicros() {
|
|
7202
7197
|
const currentMicros = readMicros();
|
|
7203
|
-
|
|
7198
|
+
lastMicros = Math.max(lastMicros, currentMicros);
|
|
7204
7199
|
return lastMicros;
|
|
7205
7200
|
}
|
|
7206
7201
|
};
|
|
@@ -7775,7 +7770,6 @@ function buildCapture(state) {
|
|
|
7775
7770
|
function createRecorder(captureId, limits, clock, phaseCatalog, allocationReport) {
|
|
7776
7771
|
const validLimits = validateRecorderLimits(limits);
|
|
7777
7772
|
if (!validLimits.ok) return validLimits;
|
|
7778
|
-
const nowMicros = clock.nowMicros;
|
|
7779
7773
|
const state = {
|
|
7780
7774
|
limits,
|
|
7781
7775
|
phaseCatalog,
|
|
@@ -7788,15 +7782,15 @@ function createRecorder(captureId, limits, clock, phaseCatalog, allocationReport
|
|
|
7788
7782
|
render: new Set(phaseCatalog.render)
|
|
7789
7783
|
},
|
|
7790
7784
|
recordStore: {
|
|
7791
|
-
kinds:
|
|
7792
|
-
sources:
|
|
7793
|
-
phases:
|
|
7794
|
-
frameIds:
|
|
7795
|
-
parentSources:
|
|
7796
|
-
parentPhases:
|
|
7797
|
-
startMicros:
|
|
7798
|
-
endMicros:
|
|
7799
|
-
reasons:
|
|
7785
|
+
kinds: [],
|
|
7786
|
+
sources: [],
|
|
7787
|
+
phases: [],
|
|
7788
|
+
frameIds: [],
|
|
7789
|
+
parentSources: [],
|
|
7790
|
+
parentPhases: [],
|
|
7791
|
+
startMicros: [],
|
|
7792
|
+
endMicros: [],
|
|
7793
|
+
reasons: [],
|
|
7800
7794
|
count: 0
|
|
7801
7795
|
},
|
|
7802
7796
|
captureId,
|
|
@@ -7844,7 +7838,7 @@ function createRecorder(captureId, limits, clock, phaseCatalog, allocationReport
|
|
|
7844
7838
|
state.openSources[index] = source;
|
|
7845
7839
|
state.openPhaseNames[index] = phase;
|
|
7846
7840
|
state.openFrameIds[index] = frameId;
|
|
7847
|
-
state.openStartMicros[index] = nowMicros();
|
|
7841
|
+
state.openStartMicros[index] = clock.nowMicros();
|
|
7848
7842
|
state.openDepth += 1;
|
|
7849
7843
|
return OK_VOID;
|
|
7850
7844
|
},
|
|
@@ -7865,7 +7859,7 @@ function createRecorder(captureId, limits, clock, phaseCatalog, allocationReport
|
|
|
7865
7859
|
const parentSource = parentIndex >= 0 ? state.openSources[parentIndex] : void 0;
|
|
7866
7860
|
const parentPhase = parentIndex >= 0 ? state.openPhaseNames[parentIndex] : void 0;
|
|
7867
7861
|
if (!state.overflow) {
|
|
7868
|
-
const endMicros = Math.max(startMicros, nowMicros());
|
|
7862
|
+
const endMicros = Math.max(startMicros, clock.nowMicros());
|
|
7869
7863
|
retainPhaseRecord(
|
|
7870
7864
|
state,
|
|
7871
7865
|
source,
|
|
@@ -8075,37 +8069,6 @@ function wrapSink(session, sink, frameLimit, complete) {
|
|
|
8075
8069
|
};
|
|
8076
8070
|
}
|
|
8077
8071
|
|
|
8078
|
-
|
|
8079
|
-
function consumeToolPreviewProfile(input) {
|
|
8080
|
-
if (input.ref.digest !== input.manifest.profileDigest) {
|
|
8081
|
-
return fail("profile digest matches manifest identity");
|
|
8082
|
-
}
|
|
8083
|
-
const profileResult = validateProfileCapture(input.profile);
|
|
8084
|
-
if (!profileResult.ok) return fail(profileResult.error.expected);
|
|
8085
|
-
if (profileResult.value.captureId !== input.manifest.captureId) {
|
|
8086
|
-
return fail("ProfileCapture.captureId matches manifest captureId");
|
|
8087
|
-
}
|
|
8088
|
-
return {
|
|
8089
|
-
ok: true,
|
|
8090
|
-
value: {
|
|
8091
|
-
runId: input.manifest.runId,
|
|
8092
|
-
captureId: input.manifest.captureId,
|
|
8093
|
-
profile: profileResult.value
|
|
8094
|
-
}
|
|
8095
|
-
};
|
|
8096
|
-
}
|
|
8097
|
-
function fail(expected) {
|
|
8098
|
-
return {
|
|
8099
|
-
ok: false,
|
|
8100
|
-
error: {
|
|
8101
|
-
code: "tool-preview-profile-mismatch",
|
|
8102
|
-
expected,
|
|
8103
|
-
hint: "read the ProfileCapture through its owner schema and regenerate the manifest join",
|
|
8104
|
-
detail: { expected }
|
|
8105
|
-
}
|
|
8106
|
-
};
|
|
8107
|
-
}
|
|
8108
|
-
|
|
8109
|
-
export { buildProfileModel, compareProfileCaptures, consumeToolPreviewProfile, createProfileClock, createProfiler, createUserTimingProfiler, validateProfileCapture };
|
|
8072
|
+
export { buildProfileModel, compareProfileCaptures, createProfileClock, createProfiler, createUserTimingProfiler, validateProfileCapture };
|
|
8110
8073
|
//# sourceMappingURL=index.mjs.map
|
|
8111
8074
|
//# sourceMappingURL=index.mjs.map
|