Skip to content

Commit befee12

Browse files
authored
Show the 'inl' badge on inlined frames showing in marker stacks. (#5628)
2 parents 687156c + b7464c7 commit befee12

File tree

5 files changed

+64
-33
lines changed

5 files changed

+64
-33
lines changed

locales/en-US/app.ftl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ AppViewRouter--error-from-localhost-url-safari =
4747
AppViewRouter--route-not-found--home =
4848
.specialMessage = The URL you tried to reach was not recognized.
4949
50+
## Backtrace
51+
## This is used to display a backtrace (call stack) for a marker or sample.
52+
53+
# Variables:
54+
# $function (String) - Name of the function that was inlined.
55+
Backtrace--inlining-badge = (inlined)
56+
.title = { $function } was inlined into its caller by the compiler.
57+
5058
## CallNodeContextMenu
5159
## This is used as a context menu for the Call Tree, Flame Graph and Stack Chart
5260
## panels.

src/components/calltree/CallTree.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
}
3232

3333
.treeBadge.inlined,
34-
.treeBadge.divergent-inlining {
34+
.treeBadge.divergent-inlining,
35+
.backtraceBadge.inlined {
3536
background: url(../../../res/img/svg/inlined-icon.svg);
3637
}

src/components/shared/Backtrace.tsx

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
import classNames from 'classnames';
6+
import { Localized } from '@fluent/react';
67
import { getBacktraceItemsForStack } from 'firefox-profiler/profile-logic/transforms';
8+
import { getFunctionName } from 'firefox-profiler/profile-logic/function-info';
79

810
import type {
911
CategoryList,
@@ -39,21 +41,34 @@ export function Backtrace(props: Props) {
3941
{funcNamesAndOrigins
4042
// Truncate the stacks
4143
.slice(0, maxStacks)
42-
.map(({ funcName, origin, isFrameLabel, category }, i) => (
43-
<li
44-
key={i}
45-
className={classNames('backtraceStackFrame', {
46-
backtraceStackFrame_isFrameLabel: isFrameLabel,
47-
})}
48-
>
49-
<span
50-
className={`colored-border category-color-${categories[category].color}`}
51-
title={categories[category].name}
52-
/>
53-
{funcName}
54-
<em className="backtraceStackFrameOrigin">{origin}</em>
55-
</li>
56-
))}
44+
.map(
45+
({ funcName, origin, isFrameLabel, category, inlineDepth }, i) => (
46+
<li
47+
key={i}
48+
className={classNames('backtraceStackFrame', {
49+
backtraceStackFrame_isFrameLabel: isFrameLabel,
50+
})}
51+
>
52+
<span
53+
className={`colored-border category-color-${categories[category].color}`}
54+
title={categories[category].name}
55+
/>
56+
{inlineDepth > 0 ? (
57+
<Localized
58+
id="Backtrace--inlining-badge"
59+
vars={{ function: getFunctionName(funcName) }}
60+
attrs={{ title: true }}
61+
>
62+
<span className="backtraceBadge inlined" title="inlined">
63+
(inlined)
64+
</span>
65+
</Localized>
66+
) : null}
67+
{funcName}
68+
<em className="backtraceStackFrameOrigin">{origin}</em>
69+
</li>
70+
)
71+
)}
5772
{funcNamesAndOrigins.length > maxStacks
5873
? [
5974
<span

src/components/shared/TreeView.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@
132132
flex: none;
133133
}
134134

135-
.treeBadge {
135+
.treeBadge,
136+
.backtraceBadge {
136137
display: inline-block;
137138
overflow: hidden;
138139
width: 12px;

src/profile-logic/transforms.ts

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,6 +1589,8 @@ export type BacktraceItem = {
15891589
// library instead.
15901590
// May also be empty.
15911591
origin: string;
1592+
// The inline depth of this frame. Frames with inline depth > 0 are inlined.
1593+
inlineDepth: number;
15921594
};
15931595

15941596
/**
@@ -1616,29 +1618,33 @@ export function getBacktraceItemsForStack(
16161618
funcIndex: frameTable.func[frameIndex],
16171619
frameLine: frameTable.line[frameIndex],
16181620
frameColumn: frameTable.column[frameIndex],
1621+
inlineDepth: frameTable.inlineDepth[frameIndex],
16191622
});
16201623
}
16211624

16221625
const funcMatchesImplementation = FUNC_MATCHES[implementationFilter];
16231626
const path = unfilteredPath.filter(({ funcIndex }) =>
16241627
funcMatchesImplementation(thread, funcIndex)
16251628
);
1626-
return path.map(({ category, funcIndex, frameLine, frameColumn }) => {
1627-
return {
1628-
funcName: stringTable.getString(funcTable.name[funcIndex]),
1629-
category: category,
1630-
isFrameLabel: funcTable.resource[funcIndex] === -1,
1631-
origin: getOriginAnnotationForFunc(
1632-
funcIndex,
1633-
funcTable,
1634-
resourceTable,
1635-
stringTable,
1636-
sources,
1637-
frameLine,
1638-
frameColumn
1639-
),
1640-
};
1641-
});
1629+
return path.map(
1630+
({ category, funcIndex, frameLine, frameColumn, inlineDepth }) => {
1631+
return {
1632+
funcName: stringTable.getString(funcTable.name[funcIndex]),
1633+
category,
1634+
isFrameLabel: funcTable.resource[funcIndex] === -1,
1635+
origin: getOriginAnnotationForFunc(
1636+
funcIndex,
1637+
funcTable,
1638+
resourceTable,
1639+
stringTable,
1640+
sources,
1641+
frameLine,
1642+
frameColumn
1643+
),
1644+
inlineDepth,
1645+
};
1646+
}
1647+
);
16421648
}
16431649

16441650
/**

0 commit comments

Comments
 (0)