Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
795f075
Compute new selection earlier when inverting.
mstange Oct 22, 2023
bd97b75
Store both the inverted and the non-inverted selected call path / exp…
mstange Nov 21, 2023
6dd845e
Only respect the invertCallstack state in the call tree tab.
mstange Nov 21, 2023
ac4a1ac
Add a test which checks that selection is tracked independently for i…
mstange Nov 21, 2023
f259c8c
Remove non-functional "Invert call stack" checkbox from the stack cha…
mstange Nov 21, 2023
8bf6a05
Cache the inverted thread separately with a separate selector.
mstange Nov 23, 2023
3c0c07c
Add a comment to MaybeFlameGraph saying it's not needed any more.
mstange Nov 23, 2023
efbe020
Make the flame graph and stack chart always non-inverted (Merge PR #4…
mstange Nov 23, 2023
1cf6a1c
Simplify heightFunction.
mstange Oct 23, 2023
8814cda
Use a call node path to make the stack copy string.
mstange Oct 22, 2023
0cee302
Only set fillStyle once in drawSamples.
mstange Nov 26, 2023
e1efde6
Make traced durations honor the preview selection.
mstange Nov 27, 2023
22e80e7
Only set fillStyle once in drawSamples. (Merge PR #4816)
mstange Nov 27, 2023
5fc4a4b
Stop using sampleCallNodes in ThreadSampleGraph.
mstange Oct 23, 2023
7b888cd
Stop using sampleCallNodes in ThreadSampleGraph. (Merge PR #4809)
mstange Nov 27, 2023
13393be
Merge branch 'main' into simplify-height-function
mstange Nov 27, 2023
cfc40b5
Simplify heightFunction. (Merge PR #4810)
mstange Nov 27, 2023
ce52d95
Merge branch 'main' into simplify-copied-stack
mstange Nov 27, 2023
fba3b58
Use a call node path to make the stack copy string. (Merge PR #4811)
mstange Nov 27, 2023
c9b23ab
Merge branch 'main' into preview-filtered-traced-timing
mstange Nov 27, 2023
3e646c7
Make traced durations honor the preview selection. (Merge PR #4817)
mstange Nov 27, 2023
866595d
Only look up windowID when it's used.
mstange Oct 7, 2023
80f3d60
Add firstChild and nextSibling columns to the call node table.
mstange Oct 7, 2023
e0edc96
Use firstChild/nextSibling to speed up getChildren().
mstange Nov 24, 2023
7b4247e
Make CallNodeTable sorted in depth-first traversal order.
mstange Oct 7, 2023
f512007
Replace firstChild with nextAfterDescendants.
mstange Oct 20, 2023
1b4aba2
Take advantage of sorted call nodes in getSamplesSelectedStates.
mstange Oct 20, 2023
32cbefe
Take advantage of sorted call nodes in getTimingsForCallNodeIndex.
mstange Oct 20, 2023
2e21b23
Take advantage of nextSibling in getCallNodeIndexFromParentAndFunc.
mstange Oct 8, 2023
9d2c18d
Take advantage of sorted call node table in getTreeOrderComparator.
mstange Oct 8, 2023
5219fe2
Do sorting in one pass.
mstange Nov 24, 2023
1ad0db3
Address review comments for firstChild / nextSibling.
mstange Nov 28, 2023
bc1fa4f
Use the prefix column instead of currentStackOld/New.
mstange Nov 28, 2023
7ea904a
Expand the comment above mapCallNodeSelectedStatesToSamples.
mstange Nov 28, 2023
71f54aa
Expand the comment above getTreeOrderComparator.
mstange Nov 28, 2023
868e6c6
Rename nextAfterDescendants to subtreeRangeEnd.
mstange Nov 28, 2023
5610835
Optimize call node table traversals (Merge PR #4807)
mstange Nov 28, 2023
d8a1a67
Update all Yarn dependencies (2023-11-27)
depfu[bot] Nov 27, 2023
880a77a
Only match js files for prettier and fix style changes
canova Nov 27, 2023
1f9191e
Update all Yarn dependencies (2023-11-27) (#4799)
julienw Nov 28, 2023
a774f34
Don't call getChildren in findHeavyPathToSameFunctionAfterInversion.
mstange Nov 24, 2023
e850ec4
Compute a correct func names dict for merged threads.
mstange Nov 27, 2023
17931f1
Add a test for heavy paths in diff profiles.
mstange Nov 27, 2023
5270c86
Improve findHeavyPathToSameFunctionAfterInversion. (Merge PR #4813)
mstange Nov 28, 2023
d22246c
Don't ignore all of the fixtures directory, just the upgrades directory
julienw Nov 28, 2023
2ea4245
Run prettier on these files
julienw Nov 28, 2023
7e2bb74
Don't ignore all of the fixtures directory, just the upgrades directo…
julienw Nov 28, 2023
0b537cb
Work around Math.abs being slow in Firefox in React development envir…
mstange Nov 28, 2023
30ae592
Improve flame graph performance by caching rows.
mstange Oct 10, 2023
469a598
Improve flame graph performance. (Merge PR #4820)
mstange Nov 30, 2023
cb21da5
Apply missed fixes for PR #4820.
mstange Oct 10, 2023
625135b
Apply missed fixes for PR #4820. (Merge PR #4824)
mstange Dec 1, 2023
ebabce7
Speed up getCallNodeInfo by using firstChild / nextSibling / currentL…
mstange Dec 1, 2023
77840bf
Speed up getCallNodeInfo (#4826)
mstange Dec 1, 2023
17306c4
Rename maxDepth to maxDepthPlusOne in many places.
mstange Nov 30, 2023
cf964a1
Add a maxLength field to the call node table, and pre-allocate the pe…
mstange Nov 30, 2023
b21b421
Speed up getStackTimingByDepth by taking advantage of the call node t…
mstange Dec 1, 2023
358a1c7
Reduce the time of switching to the stack chart tab for the first tim…
mstange Dec 2, 2023
9fd444c
Bump @adobe/css-tools from 4.3.1 to 4.3.2 (#4827)
dependabot[bot] Dec 4, 2023
41fcaac
Change callNodeChildCount to callNodeHasChildren.
mstange Dec 2, 2023
d3e0420
Rename CallTreeCountsAndSummary to CallTreeTimings.
mstange Dec 2, 2023
64d6cc8
Use _callNodeHasChildren in hasChildren().
mstange Dec 2, 2023
1b08327
Replace child count with "has children" (Merge PR #4829)
mstange Dec 4, 2023
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
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
src/types/libdef/npm
docs-user
src/test/fixtures/
src/test/fixtures/upgrades
res/zee-worker.js
dist
coverage
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
},
},
{
files: 'bin/*',
files: 'bin/*.js',
options: {
// Files in bin/ are javascript files that may use Flow comments. We
// don't want the content of these Flow comments to be output outside of
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@
"@codemirror/lang-rust": "^6.0.1",
"@codemirror/language": "^6.9.2",
"@codemirror/state": "^6.3.1",
"@codemirror/view": "^6.21.3",
"@codemirror/view": "^6.22.0",
"@firefox-devtools/react-contextmenu": "^5.1.1",
"@fluent/bundle": "^0.18.0",
"@fluent/langneg": "^0.7.0",
"@fluent/react": "^0.15.2",
"@lezer/highlight": "^1.1.6",
"@tgwf/co2": "^0.13.8",
"@lezer/highlight": "^1.2.0",
"@tgwf/co2": "^0.13.9",
"array-move": "^3.0.1",
"array-range": "^1.0.1",
"clamp": "^1.0.1",
"classnames": "^2.3.2",
"common-tags": "^1.8.2",
"copy-to-clipboard": "^3.3.3",
"core-js": "^3.33.1",
"core-js": "^3.33.2",
"escape-string-regexp": "^4.0.0",
"gecko-profiler-demangle": "^0.3.3",
"idb": "^7.1.1",
Expand All @@ -84,7 +84,7 @@
"query-string": "^8.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-intersection-observer": "^9.5.2",
"react-intersection-observer": "^9.5.3",
"react-redux": "^8.1.3",
"react-splitter-layout": "^4.0.0",
"react-transition-group": "^4.4.5",
Expand All @@ -98,16 +98,16 @@
},
"devDependencies": {
"@babel/cli": "^7.23.0",
"@babel/core": "^7.23.2",
"@babel/eslint-parser": "^7.22.15",
"@babel/core": "^7.23.3",
"@babel/eslint-parser": "^7.23.3",
"@babel/eslint-plugin": "^7.22.10",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.23.2",
"@babel/preset-flow": "^7.22.15",
"@babel/preset-react": "^7.22.15",
"@babel/preset-env": "^7.23.3",
"@babel/preset-flow": "^7.23.3",
"@babel/preset-react": "^7.23.3",
"@testing-library/dom": "^9.3.3",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.0.0",
"@testing-library/react": "^14.1.2",
"alex": "^11.0.1",
"autoprefixer": "^10.4.16",
"babel-jest": "^29.7.0",
Expand All @@ -122,7 +122,7 @@
"css-loader": "^6.8.1",
"cssnano": "^6.0.1",
"devtools-license-check": "^0.9.0",
"eslint": "^8.52.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-flowtype": "^8.0.3",
Expand All @@ -131,7 +131,7 @@
"eslint-plugin-jest-dom": "^5.1.0",
"eslint-plugin-jest-formatting": "^3.1.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-testing-library": "^6.1.0",
"eslint-plugin-testing-library": "^6.1.2",
"espree": "^9.6.1",
"fake-indexeddb": "^4.0.2",
"fetch-mock-jest": "^1.5.1",
Expand All @@ -154,7 +154,7 @@
"open": "^9.1.0",
"postcss": "^8.4.31",
"postcss-loader": "^7.3.3",
"prettier": "^3.0.3",
"prettier": "^3.1.0",
"raw-loader": "^4.0.2",
"rimraf": "^5.0.5",
"style-loader": "^3.3.3",
Expand Down
64 changes: 37 additions & 27 deletions src/actions/profile-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,30 @@ export function changeSelectedCallNode(
selectedCallNodePath: CallNodePath,
context: SelectionContext = { source: 'auto' },
optionalExpandedToCallNodePath?: CallNodePath
): Action {
if (optionalExpandedToCallNodePath) {
for (let i = 0; i < selectedCallNodePath.length; i++) {
if (selectedCallNodePath[i] !== optionalExpandedToCallNodePath[i]) {
// This assertion ensures that the selectedCallNode will be correctly expanded.
throw new Error(
oneLine`
The optional expanded call node path provided to the changeSelectedCallNode
must contain the selected call node path.
`
);
): ThunkAction<void> {
return (dispatch, getState) => {
if (optionalExpandedToCallNodePath) {
for (let i = 0; i < selectedCallNodePath.length; i++) {
if (selectedCallNodePath[i] !== optionalExpandedToCallNodePath[i]) {
// This assertion ensures that the selectedCallNode will be correctly expanded.
throw new Error(
oneLine`
The optional expanded call node path provided to the changeSelectedCallNode
must contain the selected call node path.
`
);
}
}
}
}
return {
type: 'CHANGE_SELECTED_CALL_NODE',
selectedCallNodePath,
optionalExpandedToCallNodePath,
threadsKey,
context,
const isInverted = getInvertCallstack(getState());
dispatch({
type: 'CHANGE_SELECTED_CALL_NODE',
isInverted,
selectedCallNodePath,
optionalExpandedToCallNodePath,
threadsKey,
context,
});
};
}

Expand Down Expand Up @@ -1637,14 +1641,17 @@ export function expandAllCallNodeDescendants(
export function changeExpandedCallNodes(
threadsKey: ThreadsKey,
expandedCallNodePaths: Array<CallNodePath>
): Action {
return {
type: 'CHANGE_EXPANDED_CALL_NODES',
threadsKey,
expandedCallNodePaths,
): ThunkAction<void> {
return (dispatch, getState) => {
const isInverted = getInvertCallstack(getState());
dispatch({
type: 'CHANGE_EXPANDED_CALL_NODES',
isInverted,
threadsKey,
expandedCallNodePaths,
});
};
}

export function changeSelectedMarker(
threadsKey: ThreadsKey,
selectedMarker: MarkerIndex | null,
Expand Down Expand Up @@ -1772,13 +1779,16 @@ export function changeInvertCallstack(
eventCategory: 'profile',
eventAction: 'change invert callstack',
});
const callTree = selectedThreadSelectors.getCallTree(getState());
const selectedCallNode =
selectedThreadSelectors.getSelectedCallNodeIndex(getState());
const newSelectedCallNodePath =
callTree.findHeavyPathToSameFunctionAfterInversion(selectedCallNode);
dispatch({
type: 'CHANGE_INVERT_CALLSTACK',
invertCallstack,
selectedThreadIndexes: getSelectedThreadIndexes(getState()),
callTree: selectedThreadSelectors.getCallTree(getState()),
callNodeTable: selectedThreadSelectors.getCallNodeInfo(getState())
.callNodeTable,
newSelectedCallNodePath,
});
};
}
Expand Down
10 changes: 5 additions & 5 deletions src/components/calltree/CallTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type StateProps = {|
+disableOverscan: boolean,
+invertCallstack: boolean,
+implementationFilter: ImplementationFilter,
+callNodeMaxDepth: number,
+callNodeMaxDepthPlusOne: number,
+weightType: WeightType,
+tableViewOptions: TableViewOptions,
|};
Expand Down Expand Up @@ -359,7 +359,7 @@ class CallTreeImpl extends PureComponent<Props> {
expandedCallNodeIndexes,
searchStringsRegExp,
disableOverscan,
callNodeMaxDepth,
callNodeMaxDepthPlusOne,
weightType,
tableViewOptions,
onTableViewOptionsChange,
Expand All @@ -383,7 +383,7 @@ class CallTreeImpl extends PureComponent<Props> {
disableOverscan={disableOverscan}
ref={this._takeTreeViewRef}
contextMenuId="CallNodeContextMenu"
maxNodeDepth={callNodeMaxDepth}
maxNodeDepth={callNodeMaxDepthPlusOne}
rowHeight={16}
indentWidth={10}
onKeyDown={this._onKeyDown}
Expand Down Expand Up @@ -417,8 +417,8 @@ export const CallTree = explicitConnect<{||}, StateProps, DispatchProps>({
// Use the filtered call node max depth, rather than the preview filtered call node
// max depth so that the width of the TreeView component is stable across preview
// selections.
callNodeMaxDepth:
selectedThreadSelectors.getFilteredCallNodeMaxDepth(state),
callNodeMaxDepthPlusOne:
selectedThreadSelectors.getFilteredCallNodeMaxDepthPlusOne(state),
weightType: selectedThreadSelectors.getWeightTypeForCallTree(state),
tableViewOptions: getCurrentTableViewOptions(state),
}),
Expand Down
29 changes: 17 additions & 12 deletions src/components/flame-graph/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export type OwnProps = {|
+innerWindowIDToPageMap: Map<InnerWindowID, Page> | null,
+unfilteredThread: Thread,
+sampleIndexOffset: number,
+maxStackDepth: number,
+maxStackDepthPlusOne: number,
+flameGraphTiming: FlameGraphTiming,
+callNodeInfo: CallNodeInfo,
+callTree: CallTree,
Expand Down Expand Up @@ -128,10 +128,11 @@ class FlameGraphCanvasImpl extends React.PureComponent<Props> {
// selection or applying a transform), move the viewport
// vertically so that its offset from the base of the flame graph
// is maintained.
if (prevProps.maxStackDepth !== this.props.maxStackDepth) {
if (prevProps.maxStackDepthPlusOne !== this.props.maxStackDepthPlusOne) {
this.props.viewport.moveViewport(
0,
(prevProps.maxStackDepth - this.props.maxStackDepth) * ROW_HEIGHT
(prevProps.maxStackDepthPlusOne - this.props.maxStackDepthPlusOne) *
ROW_HEIGHT
);
}

Expand All @@ -155,7 +156,7 @@ class FlameGraphCanvasImpl extends React.PureComponent<Props> {
_scrollSelectionIntoView = () => {
const {
selectedCallNodeIndex,
maxStackDepth,
maxStackDepthPlusOne,
callNodeInfo: { callNodeTable },
} = this.props;

Expand All @@ -164,7 +165,7 @@ class FlameGraphCanvasImpl extends React.PureComponent<Props> {
}

const depth = callNodeTable.depth[selectedCallNodeIndex];
const y = (maxStackDepth - depth - 1) * ROW_HEIGHT;
const y = (maxStackDepthPlusOne - depth - 1) * ROW_HEIGHT;

if (y < this.props.viewport.viewportTop) {
this.props.viewport.moveViewport(0, this.props.viewport.viewportTop - y);
Expand All @@ -186,7 +187,7 @@ class FlameGraphCanvasImpl extends React.PureComponent<Props> {
flameGraphTiming,
callNodeInfo: { callNodeTable },
stackFrameHeight,
maxStackDepth,
maxStackDepthPlusOne,
rightClickedCallNodeIndex,
selectedCallNodeIndex,
categories,
Expand Down Expand Up @@ -237,9 +238,11 @@ class FlameGraphCanvasImpl extends React.PureComponent<Props> {
ctx.fillRect(0, 0, deviceContainerWidth, deviceContainerHeight);

const startDepth = Math.floor(
maxStackDepth - viewportBottom / stackFrameHeight
maxStackDepthPlusOne - viewportBottom / stackFrameHeight
);
const endDepth = Math.ceil(
maxStackDepthPlusOne - viewportTop / stackFrameHeight
);
const endDepth = Math.ceil(maxStackDepth - viewportTop / stackFrameHeight);

// Only draw the stack frames that are vertically within view.
// The graph is drawn from bottom to top, in order of increasing depth.
Expand All @@ -252,9 +255,9 @@ class FlameGraphCanvasImpl extends React.PureComponent<Props> {
}

const cssRowTop: CssPixels =
(maxStackDepth - depth - 1) * ROW_HEIGHT - viewportTop;
(maxStackDepthPlusOne - depth - 1) * ROW_HEIGHT - viewportTop;
const cssRowBottom: CssPixels =
(maxStackDepth - depth) * ROW_HEIGHT - viewportTop;
(maxStackDepthPlusOne - depth) * ROW_HEIGHT - viewportTop;
const deviceRowTop: DevicePixels = snap(cssRowTop * cssToDeviceScale);
const deviceRowBottom: DevicePixels =
snap(cssRowBottom * cssToDeviceScale) - 1;
Expand Down Expand Up @@ -473,11 +476,13 @@ class FlameGraphCanvasImpl extends React.PureComponent<Props> {
_hitTest = (x: CssPixels, y: CssPixels): HoveredStackTiming | null => {
const {
flameGraphTiming,
maxStackDepth,
maxStackDepthPlusOne,
viewport: { viewportTop, containerWidth },
} = this.props;
const pos = x / containerWidth;
const depth = Math.floor(maxStackDepth - (y + viewportTop) / ROW_HEIGHT);
const depth = Math.floor(
maxStackDepthPlusOne - (y + viewportTop) / ROW_HEIGHT
);
const stackTiming = flameGraphTiming[depth];

if (!stackTiming) {
Expand Down
11 changes: 6 additions & 5 deletions src/components/flame-graph/FlameGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type StateProps = {|
+innerWindowIDToPageMap: Map<InnerWindowID, Page> | null,
+unfilteredThread: Thread,
+sampleIndexOffset: number,
+maxStackDepth: number,
+maxStackDepthPlusOne: number,
+timeRange: StartEndRange,
+previewSelection: PreviewSelection,
+flameGraphTiming: FlameGraphTiming,
Expand Down Expand Up @@ -327,7 +327,7 @@ class FlameGraphImpl extends React.PureComponent<Props> {
unfilteredThread,
sampleIndexOffset,
threadsKey,
maxStackDepth,
maxStackDepthPlusOne,
flameGraphTiming,
callTree,
callNodeInfo,
Expand All @@ -349,7 +349,7 @@ class FlameGraphImpl extends React.PureComponent<Props> {
displayStackType,
} = this.props;

const maxViewportHeight = maxStackDepth * STACK_FRAME_HEIGHT;
const maxViewportHeight = maxStackDepthPlusOne * STACK_FRAME_HEIGHT;

return (
<div className="flameGraphContent" onKeyDown={this._handleKeyDown}>
Expand Down Expand Up @@ -381,7 +381,7 @@ class FlameGraphImpl extends React.PureComponent<Props> {
weightType,
unfilteredThread,
sampleIndexOffset,
maxStackDepth,
maxStackDepthPlusOne,
flameGraphTiming,
callTree,
callNodeInfo,
Expand Down Expand Up @@ -427,7 +427,8 @@ export const FlameGraph = explicitConnect<{||}, StateProps, DispatchProps>({
selectedThreadSelectors.getSampleIndexOffsetFromCommittedRange(state),
// Use the filtered call node max depth, rather than the preview filtered one, so
// that the viewport height is stable across preview selections.
maxStackDepth: selectedThreadSelectors.getFilteredCallNodeMaxDepth(state),
maxStackDepthPlusOne:
selectedThreadSelectors.getFilteredCallNodeMaxDepthPlusOne(state),
flameGraphTiming: selectedThreadSelectors.getFlameGraphTiming(state),
callTree: selectedThreadSelectors.getCallTree(state),
timeRange: getCommittedRange(state),
Expand Down
9 changes: 7 additions & 2 deletions src/components/flame-graph/MaybeFlameGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import type { ConnectedProps } from 'firefox-profiler/utils/connect';

import './MaybeFlameGraph.css';

// TODO: This component isn't needed any more. Whenever the selected tab
// is "flame-graph", `invertCallstack` will be `false`. <MaybeFlameGraph /> is
// only used in the "flame-graph" tab.

type StateProps = {|
+isPreviewSelectionEmpty: boolean,
+invertCallstack: boolean,
Expand Down Expand Up @@ -72,8 +76,9 @@ export const MaybeFlameGraph = explicitConnect<{||}, StateProps, DispatchProps>(
return {
invertCallstack: getInvertCallstack(state),
isPreviewSelectionEmpty:
selectedThreadSelectors.getPreviewFilteredCallNodeMaxDepth(state) ===
0,
selectedThreadSelectors.getPreviewFilteredCallNodeMaxDepthPlusOne(
state
) === 0,
};
},
mapDispatchToProps: {
Expand Down
Loading