[Profiling] fixing show more information flyout (#161968)

Before:
<img width="1764" alt="Screenshot 2023-07-14 at 10 30 40 AM"
src="12afac5a-bb28-4b2c-8ae4-e0f8ade1af7c">
<img width="1018" alt="Screenshot 2023-07-14 at 10 30 46 AM"
src="986a03cd-faf8-4e9d-bb32-9d09043fd5a2">

After:
<img width="1768" alt="Screenshot 2023-07-14 at 10 27 40 AM"
src="bf148ab8-cc65-4fa2-bd0f-fcc24bbc8260">
<img width="1020" alt="Screenshot 2023-07-14 at 10 27 47 AM"
src="8f26dcea-18a1-4603-8f4e-d80306f3bf88">
This commit is contained in:
Cauê Marcondes 2023-07-17 09:04:19 -03:00 committed by GitHub
parent a2eda904dd
commit 1137e6f6d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,12 +34,16 @@ interface Row {
rank: number;
frame: StackFrameMetadata;
samples: number;
exclusiveCPUPerc: number;
inclusiveCPUPerc: number;
exclusiveCPU: number;
inclusiveCPU: number;
impactEstimates?: ReturnType<typeof calculateImpactEstimates>;
diff?: {
rank: number;
samples: number;
exclusiveCPUPerc: number;
inclusiveCPUPerc: number;
exclusiveCPU: number;
inclusiveCPU: number;
};
@ -204,15 +208,15 @@ export function TopNFunctionsTable({
scaleFactor: baselineScaleFactor,
});
const inclusiveCPU = (topN.CountInclusive / topNFunctions.TotalCount) * 100;
const exclusiveCPU = (topN.CountExclusive / topNFunctions.TotalCount) * 100;
const inclusiveCPUPerc = (topN.CountInclusive / topNFunctions.TotalCount) * 100;
const exclusiveCPUPerc = (topN.CountExclusive / topNFunctions.TotalCount) * 100;
const totalSamples = topN.CountExclusive;
const impactEstimates =
totalSeconds > 0
? calculateImpactEstimates({
countExclusive: exclusiveCPU,
countInclusive: inclusiveCPU,
countExclusive: topN.CountExclusive,
countInclusive: topN.CountInclusive,
totalSamples,
totalSeconds,
})
@ -228,11 +232,13 @@ export function TopNFunctionsTable({
return {
rank: topN.Rank - comparisonRow.Rank,
samples: topNCountExclusiveScaled - comparisonCountExclusiveScaled,
exclusiveCPU:
exclusiveCPU -
exclusiveCPU: comparisonRow.CountExclusive,
inclusiveCPU: comparisonRow.CountInclusive,
exclusiveCPUPerc:
exclusiveCPUPerc -
(comparisonRow.CountExclusive / comparisonTopNFunctions.TotalCount) * 100,
inclusiveCPU:
inclusiveCPU -
inclusiveCPUPerc:
inclusiveCPUPerc -
(comparisonRow.CountInclusive / comparisonTopNFunctions.TotalCount) * 100,
};
}
@ -242,8 +248,10 @@ export function TopNFunctionsTable({
rank: topN.Rank,
frame: topN.Frame,
samples: topNCountExclusiveScaled,
exclusiveCPU,
inclusiveCPU,
exclusiveCPUPerc,
inclusiveCPUPerc,
exclusiveCPU: topN.CountExclusive,
inclusiveCPU: topN.CountInclusive,
impactEstimates,
diff: calculateDiff(),
};
@ -304,8 +312,8 @@ export function TopNFunctionsTable({
iconSize="s"
/>
),
render: (_, { exclusiveCPU, diff }) => {
return <CPUStat cpu={exclusiveCPU} diffCPU={diff?.exclusiveCPU} />;
render: (_, { exclusiveCPUPerc, diff }) => {
return <CPUStat cpu={exclusiveCPUPerc} diffCPU={diff?.exclusiveCPUPerc} />;
},
align: 'right',
},
@ -319,8 +327,8 @@ export function TopNFunctionsTable({
iconSize="s"
/>
),
render: (_, { inclusiveCPU, diff }) => {
return <CPUStat cpu={inclusiveCPU} diffCPU={diff?.inclusiveCPU} />;
render: (_, { inclusiveCPUPerc, diff }) => {
return <CPUStat cpu={inclusiveCPUPerc} diffCPU={diff?.inclusiveCPUPerc} />;
},
align: 'right',
},
@ -460,7 +468,7 @@ export function TopNFunctionsTable({
sourceLine: selectedRow.frame.SourceLine,
}}
totalSeconds={totalSeconds ?? 0}
totalSamples={selectedRow.samples}
totalSamples={totalCount}
samplingRate={topNFunctions?.SamplingRate ?? 1.0}
/>
)}