Skip to content

Commit

Permalink
Two small changes (#5313)
Browse files Browse the repository at this point in the history
Two small changes in preparation for #5287. No changes in behavior.
  • Loading branch information
julienw authored Jan 15, 2025
2 parents de87ffa + 0d46a3a commit c2af69b
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 56 deletions.
80 changes: 39 additions & 41 deletions src/profile-logic/process-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ export function processGeckoProfile(geckoProfile: GeckoProfile): Profile {
// exception.
upgradeGeckoProfileToCurrentVersion(geckoProfile);

let threads = [];
const threads = [];

const extensions: ExtensionTable = geckoProfile.meta.extensions
? _toStructOfArrays(geckoProfile.meta.extensions)
Expand All @@ -1553,51 +1553,49 @@ export function processGeckoProfile(geckoProfile: GeckoProfile): Profile {
for (const subprocessProfile of geckoProfile.processes) {
const adjustTimestampsBy =
subprocessProfile.meta.startTime - geckoProfile.meta.startTime;
threads = threads.concat(
subprocessProfile.threads.map((thread) => {
const newThread: Thread = _processThread(
thread,
subprocessProfile,
extensions,
globalDataCollector
for (const thread of subprocessProfile.threads) {
const newThread: Thread = _processThread(
thread,
subprocessProfile,
extensions,
globalDataCollector
);
newThread.samples = adjustTableTimestamps(
newThread.samples,
adjustTimestampsBy
);
newThread.markers = adjustMarkerTimestamps(
newThread.markers,
adjustTimestampsBy
);
if (newThread.jsTracer) {
newThread.jsTracer = _adjustJsTracerTimestamps(
newThread.jsTracer,
adjustTimestampsBy
);
newThread.samples = adjustTableTimestamps(
newThread.samples,
}
if (newThread.jsAllocations) {
newThread.jsAllocations = adjustTableTimestamps(
newThread.jsAllocations,
adjustTimestampsBy
);
newThread.markers = adjustMarkerTimestamps(
newThread.markers,
}
if (newThread.nativeAllocations) {
newThread.nativeAllocations = adjustTableTimestamps(
newThread.nativeAllocations,
adjustTimestampsBy
);
if (newThread.jsTracer) {
newThread.jsTracer = _adjustJsTracerTimestamps(
newThread.jsTracer,
adjustTimestampsBy
);
}
if (newThread.jsAllocations) {
newThread.jsAllocations = adjustTableTimestamps(
newThread.jsAllocations,
adjustTimestampsBy
);
}
if (newThread.nativeAllocations) {
newThread.nativeAllocations = adjustTableTimestamps(
newThread.nativeAllocations,
adjustTimestampsBy
);
}
newThread.processStartupTime += adjustTimestampsBy;
if (newThread.processShutdownTime !== null) {
newThread.processShutdownTime += adjustTimestampsBy;
}
newThread.registerTime += adjustTimestampsBy;
if (newThread.unregisterTime !== null) {
newThread.unregisterTime += adjustTimestampsBy;
}
return newThread;
})
);
}
newThread.processStartupTime += adjustTimestampsBy;
if (newThread.processShutdownTime !== null) {
newThread.processShutdownTime += adjustTimestampsBy;
}
newThread.registerTime += adjustTimestampsBy;
if (newThread.unregisterTime !== null) {
newThread.unregisterTime += adjustTimestampsBy;
}
threads.push(newThread);
}

counters.push(
..._processCounters(subprocessProfile, threads, adjustTimestampsBy)
Expand Down
32 changes: 17 additions & 15 deletions src/types/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,26 +617,28 @@ export type ProfilerOverhead = {|
mainThreadIndex: ThreadIndex,
|};

// This list of process types is defined here:
// https://searchfox.org/mozilla-central/rev/819cd31a93fd50b7167979607371878c4d6f18e8/xpcom/build/nsXULAppAPI.h#383
export type ProcessType =
| 'default'
| 'plugin'
| 'tab'
| 'ipdlunittest'
| 'geckomediaplugin'
| 'gpu'
| 'pdfium'
| 'vr'
// Unknown process type:
// https://searchfox.org/mozilla-central/rev/819cd31a93fd50b7167979607371878c4d6f18e8/toolkit/xre/nsEmbedFunctions.cpp#232
| 'invalid'
| string;

/**
* Gecko has one or more processes. There can be multiple threads per processes. Each
* thread has a unique set of tables for its data.
*/
export type Thread = {|
// This list of process types is defined here:
// https://searchfox.org/mozilla-central/rev/819cd31a93fd50b7167979607371878c4d6f18e8/xpcom/build/nsXULAppAPI.h#383
processType:
| 'default'
| 'plugin'
| 'tab'
| 'ipdlunittest'
| 'geckomediaplugin'
| 'gpu'
| 'pdfium'
| 'vr'
// Unknown process type:
// https://searchfox.org/mozilla-central/rev/819cd31a93fd50b7167979607371878c4d6f18e8/toolkit/xre/nsEmbedFunctions.cpp#232
| 'invalid'
| string,
processType: ProcessType,
processStartupTime: Milliseconds,
processShutdownTime: Milliseconds | null,
registerTime: Milliseconds,
Expand Down

0 comments on commit c2af69b

Please sign in to comment.