From 7bc758e815c3cf37edbbabf42c97695e7e414450 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 6 Jul 2026 15:59:01 -0400 Subject: [PATCH] Remove unused samples.thread column. This was added by the merging/diffing code and propagated in various places, but never actually read. There is a possibility that we may want to make use of this field in the future, but it's been many years and it hasn't happened, so let's just remove it for now. We can always add it back once we need it. --- src/profile-logic/merge-compare.ts | 17 ++--------------- src/profile-logic/profile-data.ts | 14 -------------- src/types/profile-derived.ts | 5 +++-- src/types/profile.ts | 5 +++-- 4 files changed, 8 insertions(+), 33 deletions(-) diff --git a/src/profile-logic/merge-compare.ts b/src/profile-logic/merge-compare.ts index 3e6f600dcf..833b4be80a 100644 --- a/src/profile-logic/merge-compare.ts +++ b/src/profile-logic/merge-compare.ts @@ -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); @@ -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. @@ -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); @@ -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 @@ -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)[ diff --git a/src/profile-logic/profile-data.ts b/src/profile-logic/profile-data.ts index d55997a537..60b30a27f6 100644 --- a/src/profile-logic/profile-data.ts +++ b/src/profile-logic/profile-data.ts @@ -2155,13 +2155,6 @@ export function filterThreadSamplesToRange( ); } - if (samples.threadId) { - newSamples.threadId = samples.threadId.slice( - beginSampleIndex, - endSampleIndex - ); - } - const newThread: Thread = { ...thread, samples: newSamples, @@ -2288,13 +2281,6 @@ export function filterRawThreadSamplesToRange( ); } - if (samples.threadId) { - newSamples.threadId = samples.threadId.slice( - beginSampleIndex, - endSampleIndex - ); - } - const newThread: RawThread = { ...thread, samples: newSamples, diff --git a/src/types/profile-derived.ts b/src/types/profile-derived.ts index 6568b3b209..dc9ba9ccd8 100644 --- a/src/types/profile-derived.ts +++ b/src/types/profile-derived.ts @@ -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; length: number; diff --git a/src/types/profile.ts b/src/types/profile.ts index 8b470516e2..aa68ae82c1 100644 --- a/src/types/profile.ts +++ b/src/types/profile.ts @@ -142,8 +142,9 @@ export type RawSamplesTable = { // The first value is ignored - it's not meaningful because there is no previous // sample. threadCPUDelta?: Array; - // 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; };