Skip to content
Open
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
17 changes: 2 additions & 15 deletions src/profile-logic/merge-compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1172,21 +1172,19 @@ function combineSamplesDiffing(
): RawSamplesTable {
const [
{
thread: { samples: samples1, tid: tid1 },
thread: { samples: samples1 },
weightMultiplier: weightMultiplier1,
},
{
thread: { samples: samples2, tid: tid2 },
thread: { samples: samples2 },
weightMultiplier: weightMultiplier2,
},
] = threadsAndWeightMultipliers;

const newWeight: number[] = [];
const newThreadId: Tid[] = [];
const newSamples = {
...getEmptySamplesTableWithEventDelay(),
weight: newWeight,
threadId: newThreadId,
};

const samples1Time = computeTimeColumnForRawSamplesTable(samples1);
Expand All @@ -1212,7 +1210,6 @@ function combineSamplesDiffing(
// of eventDelay/responsiveness don't mean anything.
newSamples.eventDelay!.push(null);
newSamples.time!.push(samples1Time[i]);
newThreadId.push(samples1.threadId ? samples1.threadId[i] : tid1);
// TODO (issue #3151): Figure out a way to diff CPU usage numbers.
// We add the first thread with a negative weight, because this is the
// base profile.
Expand All @@ -1228,7 +1225,6 @@ function combineSamplesDiffing(
// of eventDelay/responsiveness don't mean anything.
newSamples.eventDelay!.push(null);
newSamples.time!.push(samples2Time[j]);
newThreadId.push(samples2.threadId ? samples2.threadId[j] : tid2);
const sampleWeight = samples2.weight ? samples2.weight[j] : 1;
newWeight.push(weightMultiplier2 * sampleWeight);

Expand Down Expand Up @@ -1360,13 +1356,9 @@ function combineSamplesForMerging(threads: RawThread[]): RawSamplesTable {
const nextSampleIndexPerThread: number[] = Array(
samplesPerThread.length
).fill(0);
// This array will contain the source thread ids. It will be added to the
// samples table after the loop.
const newThreadId: Tid[] = [];
// Creating a new empty samples table to fill.
const newSamples = {
...getEmptySamplesTableWithEventDelay(),
threadId: newThreadId,
};

// If every source thread has threadCPUDelta, and if the threads are
Expand Down Expand Up @@ -1433,11 +1425,6 @@ function combineSamplesForMerging(threads: RawThread[]): RawSamplesTable {
// from independent threads instead.
ensureExists(newSamples.eventDelay).push(null);
newSamples.time!.push(sourceThreadSamplesTimeCol[sourceThreadSampleIndex]);
newThreadId.push(
sourceThreadSamples.threadId
? sourceThreadSamples.threadId[sourceThreadSampleIndex]
: threads[sourceThreadIndex].tid
);
if (newThreadCPUDelta !== undefined) {
newThreadCPUDelta.push(
ensureExists(sourceThreadSamples.threadCPUDelta)[
Expand Down
14 changes: 0 additions & 14 deletions src/profile-logic/profile-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2155,13 +2155,6 @@ export function filterThreadSamplesToRange(
);
}

if (samples.threadId) {
newSamples.threadId = samples.threadId.slice(
beginSampleIndex,
endSampleIndex
);
}

const newThread: Thread = {
...thread,
samples: newSamples,
Expand Down Expand Up @@ -2288,13 +2281,6 @@ export function filterRawThreadSamplesToRange(
);
}

if (samples.threadId) {
newSamples.threadId = samples.threadId.slice(
beginSampleIndex,
endSampleIndex
);
}

const newThread: RawThread = {
...thread,
samples: newSamples,
Expand Down
5 changes: 3 additions & 2 deletions src/types/profile-derived.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ export type SamplesTable = {
category: Uint8Array;
// The subcategory of each sample's stack in the unfiltered thread.
subcategory: Uint16Array | Uint8Array;
// This property isn't present in normal threads. However it's present for
// merged threads, so that we know the origin thread for these samples.
// Legacy: older profiles produced by merging may have a per-sample
// origin-thread column. Not written by current code, but tolerated on
// input so pre-existing profiles still parse.
threadId?: Tid[];
argumentValues?: Array<number | null>;
length: number;
Expand Down
5 changes: 3 additions & 2 deletions src/types/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ export type RawSamplesTable = {
// The first value is ignored - it's not meaningful because there is no previous
// sample.
threadCPUDelta?: Array<number | null>;
// This property isn't present in normal threads. However it's present for
// merged threads, so that we know the origin thread for these samples.
// Legacy: older profiles produced by merging may have a per-sample
// origin-thread column. Not written by current code, but tolerated on
// input so pre-existing profiles still parse.
threadId?: Tid[];
length: number;
};
Expand Down
Loading