Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions docs-developer/CHANGELOG-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,17 @@ We've also cleaned up the ResourceTable format:

### Older Versions

Older versions are not documented in this changelog but can be found in [processed-profile-versioning.jt](../src/profile-logic/processed-profile-versioning.ts).
Older versions are not documented in this changelog but can be found in [processed-profile-versioning.ts](../src/profile-logic/processed-profile-versioning.ts).

## Gecko profile format

### Version 33

The `sources` field in the Gecko profile format is now non-optional. An upgrader was added that creates an empty `SourceTable` for profiles that don't have one.

### Version 32

`frameTable` `location` string field was changed to include an optional `sourceIndex` at the end of the string inside brackets for JS sources. For example, new JS frames look like this: `functionName (http://script.url/:1234:1234)[1234]` with the last number being its `sourceIndex`. This index references entries in the shared `SourceTable` in `profile.sources` (added in in the same version) which centralizes all source file information.
`frameTable` `location` string field was changed to include an optional `sourceIndex` at the end of the string inside brackets for JS sources. For example, new JS frames look like this: `functionName (http://script.url/:1234:1234)[1234]` with the last number being its `sourceIndex`. This index references entries in the shared `SourceTable` in `profile.sources` (added in the same version) which centralizes all source file information.

### Version 31

Expand Down Expand Up @@ -163,4 +167,4 @@ The `searchable` property is implemented in the marker schema. Previously all th

### Older Versions

Older versions are not documented in this changelog but can be found in [gecko-profile-versioning.jt](../src/profile-logic/gecko-profile-versioning.ts).
Older versions are not documented in this changelog but can be found in [gecko-profile-versioning.ts](../src/profile-logic/gecko-profile-versioning.ts).
2 changes: 1 addition & 1 deletion src/app-logic/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { MarkerPhase } from 'firefox-profiler/types';
// The current version of the Gecko profile format.
// Please don't forget to update the gecko profile format changelog in
// `docs-developer/CHANGELOG-formats.md`.
export const GECKO_PROFILE_VERSION = 32;
export const GECKO_PROFILE_VERSION = 33;

// The current version of the "processed" profile format.
// Please don't forget to update the processed profile format changelog in
Expand Down
23 changes: 23 additions & 0 deletions src/profile-logic/gecko-profile-versioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,29 @@ const _upgraders: {
// within the existing location string.
// - The source ID is optional, so v31 profiles are valid v32 profiles.
},
[33]: (profile: any) => {
// Make SourceTable non-optional by adding an empty one if it doesn't exist.
// The sources table was added as optional in version 32, but we now require
// it to always be present to simplify the code that uses it and support
// source maps in the future.
// Source IDs are still optional in the frameTable location strings.
function convertToVersion33Recursive(p: any) {
if (!p.sources) {
p.sources = {
schema: {
uuid: 0,
filename: 1,
},
data: [],
};
}

for (const subprocessProfile of p.processes) {
convertToVersion33Recursive(subprocessProfile);
}
}
convertToVersion33Recursive(profile);
},

// If you add a new upgrader here, please document the change in
// `docs-developer/CHANGELOG-formats.md`.
Expand Down
6 changes: 3 additions & 3 deletions src/profile-logic/process-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ type ExtractionInfo = {
{ funcIndex: IndexIntoFuncTable; frameAddress: Address | null }
>;
globalDataCollector: GlobalDataCollector;
geckoSourceTable: GeckoSourceTable | undefined;
geckoSourceTable: GeckoSourceTable;
};

/**
Expand All @@ -214,7 +214,7 @@ export function extractFuncsAndResourcesFromFrameLocations(
libs: LibMapping[],
extensions: ExtensionTable = getEmptyExtensions(),
globalDataCollector: GlobalDataCollector,
geckoSourceTable: GeckoSourceTable | undefined
geckoSourceTable: GeckoSourceTable
): {
funcTable: FuncTable;
resourceTable: ResourceTable;
Expand Down Expand Up @@ -539,7 +539,7 @@ function _extractJsFunction(
if (sourceIndex !== undefined) {
const geckoSourceIdx = parseInt(sourceIndex, 10);
// Look up the UUID for this source index from the process's sources table
if (geckoSourceTable && geckoSourceIdx < geckoSourceTable.data.length) {
if (geckoSourceIdx < geckoSourceTable.data.length) {
const uuidIndex = geckoSourceTable.schema.uuid;
const filenameIndex = geckoSourceTable.schema.filename;
const uuid = geckoSourceTable.data[geckoSourceIdx][uuidIndex];
Expand Down
15 changes: 15 additions & 0 deletions src/test/fixtures/profiles/gecko-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type {
GeckoMarkerTuple,
VisualMetrics,
Nanoseconds,
GeckoSourceTable,
} from 'firefox-profiler/types';

import {
Expand All @@ -45,6 +46,16 @@ function getEmptyMarkers(): GeckoMarkers {
};
}

export function getEmptySourceTable(): GeckoSourceTable {
return {
schema: {
uuid: 0 as const,
filename: 1 as const,
},
data: [],
};
}

export function createGeckoMarkerStack({
stackIndex,
time,
Expand Down Expand Up @@ -111,6 +122,7 @@ export function createGeckoSubprocessProfile(
meta: contentProcessMeta,
pausedRanges: [],
libs: [contentProcessBinary, ...parentProfile.libs.slice(1)], // libs are stringified in the Gecko profile
sources: getEmptySourceTable(),
pages: [
{
tabID: 123123,
Expand Down Expand Up @@ -315,6 +327,7 @@ export function createGeckoProfile(): GeckoProfile {
meta: parentProcessMeta,
libs: [parentProcessBinary].concat(extraBinaries),
pages: parentProcessPages,
sources: getEmptySourceTable(),
counters: parentProcessCounters,
profilerOverhead: parentProcessOverhead,
pausedRanges: [],
Expand Down Expand Up @@ -384,6 +397,7 @@ export function createGeckoProfileWithMarkers(
meta: geckoProfile.meta,
libs: geckoProfile.libs,
pages: geckoProfile.pages,
sources: geckoProfile.sources,
pausedRanges: [],
threads: [_createGeckoThreadWithMarkers(markers)],
processes: [],
Expand Down Expand Up @@ -950,6 +964,7 @@ export function createGeckoProfileWithJsTimings(): GeckoProfile {
meta: geckoProfile.meta,
libs: geckoProfile.libs,
pages: geckoProfile.pages,
sources: geckoProfile.sources,
pausedRanges: [],
threads: [
_createGeckoThreadWithJsTimings('GeckoMain'),
Expand Down
2 changes: 1 addition & 1 deletion src/test/store/__snapshots__/profile-view.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ Object {
"startTime": 0,
"symbolicated": true,
"toolkit": "",
"version": 32,
"version": 33,
},
"pages": Array [
Object {
Expand Down
32 changes: 16 additions & 16 deletions src/test/unit/__snapshots__/profile-conversion.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ Object {
"symbolicated": true,
"toolkit": undefined,
"updateChannel": undefined,
"version": 32,
"version": 33,
"visualMetrics": undefined,
},
"pages": Array [],
Expand Down Expand Up @@ -85577,7 +85577,7 @@ Object {
"symbolicated": true,
"toolkit": undefined,
"updateChannel": undefined,
"version": 32,
"version": 33,
"visualMetrics": undefined,
},
"pages": Array [],
Expand Down Expand Up @@ -334708,7 +334708,7 @@ Object {
"startTime": 0,
"symbolicated": true,
"toolkit": "",
"version": 32,
"version": 33,
},
"pages": Array [],
"shared": Object {
Expand Down Expand Up @@ -370190,7 +370190,7 @@ Object {
"startTime": 0,
"symbolicated": true,
"toolkit": "",
"version": 32,
"version": 33,
},
"pages": Array [],
"shared": Object {
Expand Down Expand Up @@ -405651,7 +405651,7 @@ Object {
"startTime": 0,
"symbolicated": true,
"toolkit": "",
"version": 32,
"version": 33,
},
"pages": Array [],
"shared": Object {
Expand Down Expand Up @@ -408280,7 +408280,7 @@ Object {
"startTime": 0,
"symbolicated": true,
"toolkit": "",
"version": 32,
"version": 33,
},
"pages": Array [],
"shared": Object {
Expand Down Expand Up @@ -410641,7 +410641,7 @@ Object {
"startTime": 1700159839203.051,
"symbolicated": true,
"toolkit": "",
"version": 32,
"version": 33,
},
"pages": Array [],
"shared": Object {
Expand Down Expand Up @@ -414171,7 +414171,7 @@ Object {
"startTime": 0,
"symbolicated": true,
"toolkit": "",
"version": 32,
"version": 33,
},
"pages": Array [],
"shared": Object {
Expand Down Expand Up @@ -419436,7 +419436,7 @@ Object {
"startTime": 0,
"symbolicated": true,
"toolkit": "",
"version": 32,
"version": 33,
},
"pages": Array [],
"shared": Object {
Expand Down Expand Up @@ -420466,7 +420466,7 @@ Object {
"symbolicated": true,
"toolkit": undefined,
"updateChannel": undefined,
"version": 32,
"version": 33,
"visualMetrics": undefined,
},
"pages": Array [],
Expand Down Expand Up @@ -426405,7 +426405,7 @@ Object {
"symbolicated": true,
"toolkit": undefined,
"updateChannel": undefined,
"version": 32,
"version": 33,
"visualMetrics": undefined,
},
"pages": Array [],
Expand Down Expand Up @@ -441300,7 +441300,7 @@ Object {
"symbolicated": true,
"toolkit": undefined,
"updateChannel": undefined,
"version": 32,
"version": 33,
"visualMetrics": undefined,
},
"pages": Array [],
Expand Down Expand Up @@ -447504,7 +447504,7 @@ Object {
"symbolicated": true,
"toolkit": undefined,
"updateChannel": undefined,
"version": 32,
"version": 33,
"visualMetrics": undefined,
},
"pages": Array [],
Expand Down Expand Up @@ -606878,7 +606878,7 @@ Object {
"startTime": 0,
"symbolicated": true,
"toolkit": "",
"version": 32,
"version": 33,
},
"pages": Array [],
"shared": Object {
Expand Down Expand Up @@ -630473,7 +630473,7 @@ Object {
"startTime": 0,
"symbolicated": true,
"toolkit": "",
"version": 32,
"version": 33,
},
"pages": Array [],
"shared": Object {
Expand Down Expand Up @@ -938356,7 +938356,7 @@ Object {
"startTime": 0,
"symbolicated": true,
"toolkit": "",
"version": 32,
"version": 33,
},
"pages": Array [],
"shared": Object {
Expand Down
34 changes: 31 additions & 3 deletions src/test/unit/__snapshots__/profile-upgrading.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Object {
"symbolicated": true,
"toolkit": undefined,
"updateChannel": undefined,
"version": 32,
"version": 33,
"visualMetrics": undefined,
},
"pages": Array [],
Expand Down Expand Up @@ -6389,7 +6389,7 @@ Object {
"stackwalk": 1,
"startTime": 1460221352723.438,
"toolkit": "cocoa",
"version": 32,
"version": 33,
},
"pausedRanges": Array [],
"processes": Array [
Expand Down Expand Up @@ -6501,6 +6501,13 @@ Object {
},
"pausedRanges": Array [],
"processes": Array [],
"sources": Object {
"data": Array [],
"schema": Object {
"filename": 1,
"uuid": 0,
},
},
"threads": Array [
Object {
"frameTable": Object {
Expand Down Expand Up @@ -6783,6 +6790,13 @@ Object {
],
},
],
"sources": Object {
"data": Array [],
"schema": Object {
"filename": 1,
"uuid": 0,
},
},
"threads": Array [
Object {
"frameTable": Object {
Expand Down Expand Up @@ -7845,7 +7859,7 @@ Object {
"stackwalk": 1,
"startTime": 1460221352723.438,
"toolkit": "cocoa",
"version": 32,
"version": 33,
},
"pages": Array [
Object {
Expand Down Expand Up @@ -7985,6 +7999,13 @@ Object {
],
"pausedRanges": Array [],
"processes": Array [],
"sources": Object {
"data": Array [],
"schema": Object {
"filename": 1,
"uuid": 0,
},
},
"threads": Array [
Object {
"frameTable": Object {
Expand Down Expand Up @@ -8349,6 +8370,13 @@ Object {
],
},
],
"sources": Object {
"data": Array [],
"schema": Object {
"filename": 1,
"uuid": 0,
},
},
"threads": Array [
Object {
"frameTable": Object {
Expand Down
Loading