Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deploy preview] Add a function list #5233

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
db716a5
Add CallNodeInfoInverted.
mstange Jan 23, 2024
68bbf6b
Implement the "suffix order".
mstange Aug 6, 2024
2a3c888
Use the suffix order in getMatchingAncestorStackForInvertedCallNode.
mstange Jan 19, 2024
f5e3ad1
Implement getSamplesSelectedStates for inverted trees with the suffix…
mstange Jan 19, 2024
3ac08b9
Use suffix order in getTimingsForCallNodeIndex.
mstange Jan 20, 2024
9f1c8f3
Implement getTreeOrderComparator for the inverted tree with non-inver…
mstange Jan 20, 2024
cb7a9ce
Use SampleIndexToNonInvertedCallNodeIndex for the stack chart.
mstange Jan 20, 2024
2259f60
Remove now-unused stack-to-inverted-call-node mapping.
mstange Jan 20, 2024
166342c
Call getNonInvertedCallNodeTable() in more stack-chart-related places.
mstange Jan 20, 2024
f2a32cf
Compute inverted call tree timings differently.
mstange Aug 6, 2024
724ed13
Rename leaf to self in many places.
mstange Jan 19, 2024
2da3e88
Use the non-inverted call node table to check for recursion.
mstange Aug 7, 2024
3fc5886
Replace all remaining callers of getCallNodeTable() with xyzForNode()…
mstange Nov 13, 2023
1e9c8ba
Remove now-unused getCallNodeTable().
mstange Jan 20, 2024
a0db0ec
Create inverted call nodes lazily.
mstange Jan 20, 2024
e44ec8f
Optimize handling of roots.
mstange Jan 20, 2024
a891ee2
Make sourceFramesInlinedIntoSymbol an Int32Array.
mstange Jan 20, 2024
b25d6b5
Refine the suffix order incrementally, as new inverted nodes are crea…
mstange Nov 24, 2024
9440725
Fold the CallNodeInfoInverted interface into the implementation class.
mstange Nov 24, 2024
e1a726b
Remove unused methods from CallNodeInfoNonInverted.
mstange Nov 25, 2024
0cd70fa
Add a test for focus-category on an inverted call tree.
mstange Nov 25, 2024
638a800
Implement a function list.
mstange Nov 27, 2024
fb7aa5b
Add inverted butterfly wing.
mstange Dec 1, 2024
adbd19e
Add .jj to various ignore files.
mstange Dec 1, 2024
4d44cf7
Add the upper butterfly wing.
mstange Dec 1, 2024
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ src/profile-logic/import/proto
src/types/libdef/npm
docs-user
coverage
.jj
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dist
coverage
taskcluster/
.taskcluster.yml
.jj
1 change: 1 addition & 0 deletions locales/en-US/app.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ StackSettings--panel-search =
## Tab Bar for the bottom half of the analysis UI.

TabBar--calltree-tab = Call Tree
TabBar--function-list-tab = Function Table
TabBar--flame-graph-tab = Flame Graph
TabBar--stack-chart-tab = Stack Chart
TabBar--marker-chart-tab = Marker Chart
Expand Down
3 changes: 2 additions & 1 deletion res/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ body {
flex-shrink: 1;
}

.treeAndSidebarWrapper {
.treeAndSidebarWrapper,
.functionTableAndSidebarWrapper {
display: flex;
flex: 1;
flex-flow: column nowrap;
Expand Down
128 changes: 120 additions & 8 deletions src/actions/profile-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ import type {
Pid,
IndexIntoSamplesTable,
CallNodePath,
CallNodeInfo,
IndexIntoCallNodeTable,
IndexIntoResourceTable,
IndexIntoFuncTable,
TrackIndex,
MarkerIndex,
Transform,
Expand All @@ -86,6 +86,7 @@ import {
} from '../profile-logic/transforms';
import { changeStoredProfileNameInDb } from 'firefox-profiler/app-logic/uploaded-profiles-db';
import type { TabSlug } from '../app-logic/tabs-handling';
import type { CallNodeInfo } from '../profile-logic/call-node-info';
import { intersectSets } from 'firefox-profiler/utils/set';

/**
Expand Down Expand Up @@ -124,7 +125,7 @@ export function changeSelectedCallNode(
const isInverted = getInvertCallstack(getState());
dispatch({
type: 'CHANGE_SELECTED_CALL_NODE',
isInverted,
area: isInverted ? 'INVERTED_TREE' : 'NON_INVERTED_TREE',
selectedCallNodePath,
optionalExpandedToCallNodePath,
threadsKey,
Expand All @@ -133,6 +134,52 @@ export function changeSelectedCallNode(
};
}

export function changeLowerWingSelectedCallNode(
threadsKey: ThreadsKey,
selectedCallNodePath: CallNodePath,
context: SelectionContext = { source: 'auto' }
): Action {
return {
type: 'CHANGE_SELECTED_CALL_NODE',
area: 'LOWER_WING',
selectedCallNodePath,
optionalExpandedToCallNodePath: [],
threadsKey,
context,
};
}

export function changeUpperWingSelectedCallNode(
threadsKey: ThreadsKey,
selectedCallNodePath: CallNodePath,
context: SelectionContext = { source: 'auto' }
): Action {
return {
type: 'CHANGE_SELECTED_CALL_NODE',
area: 'UPPER_WING',
selectedCallNodePath,
optionalExpandedToCallNodePath: [],
threadsKey,
context,
};
}

/**
* Select a function for a given thread in the function list.
*/
export function changeSelectedFunctionIndex(
threadsKey: ThreadsKey,
selectedFunctionIndex: IndexIntoFuncTable | null,
context: SelectionContext = { source: 'auto' }
): Action {
return {
type: 'CHANGE_SELECTED_FUNCTION',
selectedFunctionIndex,
threadsKey,
context,
};
}

/**
* This action is used when the user right clicks on a call node (in panels such
* as the call tree, the flame chart, or the stack chart). It's especially used
Expand All @@ -141,10 +188,49 @@ export function changeSelectedCallNode(
export function changeRightClickedCallNode(
threadsKey: ThreadsKey,
callNodePath: CallNodePath | null
): ThunkAction<void> {
return (dispatch, getState) => {
const isInverted = getInvertCallstack(getState());
dispatch({
type: 'CHANGE_RIGHT_CLICKED_CALL_NODE',
threadsKey,
area: isInverted ? 'INVERTED_TREE' : 'NON_INVERTED_TREE',
callNodePath,
});
};
}

export function changeRightClickedFunctionIndex(
threadsKey: ThreadsKey,
functionIndex: IndexIntoFuncTable | null
) {
return {
type: 'CHANGE_RIGHT_CLICKED_FUNCTION',
threadsKey,
functionIndex,
};
}

export function changeLowerWingRightClickedCallNode(
threadsKey: ThreadsKey,
callNodePath: CallNodePath | null
) {
return {
type: 'CHANGE_RIGHT_CLICKED_CALL_NODE',
threadsKey,
area: 'LOWER_WING',
callNodePath,
};
}

export function changeUpperWingRightClickedCallNode(
threadsKey: ThreadsKey,
callNodePath: CallNodePath | null
) {
return {
type: 'CHANGE_RIGHT_CLICKED_CALL_NODE',
threadsKey,
area: 'UPPER_WING',
callNodePath,
};
}
Expand Down Expand Up @@ -1632,12 +1718,37 @@ export function changeExpandedCallNodes(
const isInverted = getInvertCallstack(getState());
dispatch({
type: 'CHANGE_EXPANDED_CALL_NODES',
isInverted,
area: isInverted ? 'INVERTED_TREE' : 'NON_INVERTED_TREE',
threadsKey,
expandedCallNodePaths,
});
};
}

export function changeLowerWingExpandedCallNodes(
threadsKey: ThreadsKey,
expandedCallNodePaths: Array<CallNodePath>
): Action {
return {
type: 'CHANGE_EXPANDED_CALL_NODES',
area: 'LOWER_WING',
threadsKey,
expandedCallNodePaths,
};
}

export function changeUpperWingExpandedCallNodes(
threadsKey: ThreadsKey,
expandedCallNodePaths: Array<CallNodePath>
): Action {
return {
type: 'CHANGE_EXPANDED_CALL_NODES',
area: 'UPPER_WING',
threadsKey,
expandedCallNodePaths,
};
}

export function changeSelectedMarker(
threadsKey: ThreadsKey,
selectedMarker: MarkerIndex | null,
Expand Down Expand Up @@ -2035,12 +2146,13 @@ export function handleCallNodeTransformShortcut(
const threadSelectors = getThreadSelectorsFromThreadsKey(threadsKey);
const unfilteredThread = threadSelectors.getThread(getState());
const callNodeInfo = threadSelectors.getCallNodeInfo(getState());
const callNodeTable = callNodeInfo.getCallNodeTable();
const implementation = getImplementationFilter(getState());
const inverted = getInvertCallstack(getState());
const callNodePath = callNodeInfo.getCallNodePathFromIndex(callNodeIndex);
const funcIndex = callNodeTable.func[callNodeIndex];
const category = callNodeTable.category[callNodeIndex];
const funcIndex = callNodeInfo.funcForNode(callNodeIndex);
const category = callNodeInfo.categoryForNode(callNodeIndex);

const nonInvertedCallNodeTable = callNodeInfo.getNonInvertedCallNodeTable();

switch (event.key) {
case 'F':
Expand Down Expand Up @@ -2099,7 +2211,7 @@ export function handleCallNodeTransformShortcut(
break;
}
case 'r': {
if (funcHasRecursiveCall(callNodeTable, funcIndex)) {
if (funcHasRecursiveCall(nonInvertedCallNodeTable, funcIndex)) {
dispatch(
addTransformToStack(threadsKey, {
type: 'collapse-recursion',
Expand All @@ -2110,7 +2222,7 @@ export function handleCallNodeTransformShortcut(
break;
}
case 'R': {
if (funcHasDirectRecursiveCall(callNodeTable, funcIndex)) {
if (funcHasDirectRecursiveCall(nonInvertedCallNodeTable, funcIndex)) {
dispatch(
addTransformToStack(threadsKey, {
type: 'collapse-direct-recursion',
Expand Down
2 changes: 2 additions & 0 deletions src/app-logic/tabs-handling.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
export const tabsWithTitleL10nId = {
calltree: 'TabBar--calltree-tab',
'function-list': 'TabBar--function-list-tab',
'flame-graph': 'TabBar--flame-graph-tab',
'stack-chart': 'TabBar--stack-chart-tab',
'marker-chart': 'TabBar--marker-chart-tab',
Expand Down Expand Up @@ -43,6 +44,7 @@ export const tabsWithTitleL10nIdArray: $ReadOnlyArray<TabsWithTitleL10nId> =

export const tabsShowingSampleData: $ReadOnlyArray<TabSlug> = [
'calltree',
'function-list',
'flame-graph',
'stack-chart',
];
1 change: 1 addition & 0 deletions src/app-logic/url-handling.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ export function getQueryStringFromUrlState(urlState: UrlState): string {
switch (selectedTab) {
case 'stack-chart':
case 'flame-graph':
case 'function-list':
case 'calltree': {
if (selectedTab === 'stack-chart') {
// Stack chart uses all of the CallTree's query strings but also has an
Expand Down
7 changes: 6 additions & 1 deletion src/components/app/BottomBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ import {
getAssemblyViewIsOpen,
getAssemblyViewNativeSymbol,
getAssemblyViewScrollGeneration,
// getSelectedTab,
} from 'firefox-profiler/selectors/url-state';
import {
selectedThreadSelectors,
selectedNodeSelectors,
// selectedFunctionTableNodeSelectors,
} from 'firefox-profiler/selectors/per-thread';
import { closeBottomBox } from 'firefox-profiler/actions/profile-view';
import { parseFileNameFromSymbolication } from 'firefox-profiler/utils/special-paths';
Expand Down Expand Up @@ -284,7 +286,10 @@ export const BottomBox = explicitConnect<{||}, StateProps, DispatchProps>({
mapStateToProps: (state) => ({
sourceViewFile: getSourceViewFile(state),
sourceViewCode: getSourceViewCode(state),
globalLineTimings: selectedThreadSelectors.getSourceViewLineTimings(state),
globalLineTimings:
// getSelectedTab(state) === 'function-list'
// ? selectedFunctionTableNodeSelectors.getSourceViewLineTimings(state) :
selectedNodeSelectors.getSourceViewLineTimings(state),
selectedCallNodeLineTimings:
selectedNodeSelectors.getSourceViewLineTimings(state),
sourceViewScrollGeneration: getSourceViewScrollGeneration(state),
Expand Down
2 changes: 2 additions & 0 deletions src/components/app/Details.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import explicitConnect from 'firefox-profiler/utils/connect';
import { TabBar } from './TabBar';
import { LocalizedErrorBoundary } from './ErrorBoundary';
import { ProfileCallTreeView } from 'firefox-profiler/components/calltree/ProfileCallTreeView';
import { ProfileFunctionListView } from 'firefox-profiler/components/calltree/ProfileFunctionListView';
import { MarkerTable } from 'firefox-profiler/components/marker-table';
import { StackChart } from 'firefox-profiler/components/stack-chart/';
import { MarkerChart } from 'firefox-profiler/components/marker-chart/';
Expand Down Expand Up @@ -113,6 +114,7 @@ class ProfileViewerImpl extends PureComponent<Props> {
{
{
calltree: <ProfileCallTreeView />,
'function-list': <ProfileFunctionListView />,
'flame-graph': <FlameGraph />,
'stack-chart': <StackChart />,
'marker-chart': <MarkerChart />,
Expand Down
6 changes: 3 additions & 3 deletions src/components/app/DetailsContainer.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
box-sizing: border-box;
}

.DetailsContainer .layout-pane:not(.layout-pane-primary) {
.DetailsContainer > .layout-pane:not(.layout-pane-primary) {
max-width: 600px;
}

Expand All @@ -15,12 +15,12 @@
position: unset;
}

.DetailsContainer .layout-splitter {
.DetailsContainer > .layout-splitter {
border-top: 1px solid var(--grey-30);
border-left: 1px solid var(--grey-30);
background: var(--grey-10); /* Same background as sidebars */
}

.DetailsContainer .layout-splitter:hover {
.DetailsContainer > .layout-splitter:hover {
background: var(--grey-30); /* same as the border above */
}
9 changes: 9 additions & 0 deletions src/components/calltree/Butterfly.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

.butterflyWrapper {
position: relative;
min-height: 0;
flex: 1;
}
Loading