Skip to content

Commit f31d9ba

Browse files
committed
Add a flow panel.
1 parent f3c2e8f commit f31d9ba

File tree

19 files changed

+1957
-133
lines changed

19 files changed

+1957
-133
lines changed

src/actions/profile-view.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@ import {
1414
getPreviewSelection,
1515
getLocalTracksByPid,
1616
getThreads,
17+
getStringTable,
1718
getLastNonShiftClick,
1819
} from 'firefox-profiler/selectors/profile';
1920
import {
2021
getThreadSelectors,
2122
getThreadSelectorsFromThreadsKey,
2223
selectedThreadSelectors,
2324
} from 'firefox-profiler/selectors/per-thread';
25+
import {
26+
getProfileFlowInfo,
27+
getFullMarkerListPerThread,
28+
} from 'firefox-profiler/selectors/flow';
2429
import {
2530
getAllCommittedRanges,
2631
getImplementationFilter,
@@ -73,11 +78,13 @@ import type {
7378
TableViewOptions,
7479
SelectionContext,
7580
BottomBoxInfo,
81+
IndexIntoFlowTable,
7682
} from 'firefox-profiler/types';
7783
import {
7884
funcHasDirectRecursiveCall,
7985
funcHasRecursiveCall,
8086
} from '../profile-logic/transforms';
87+
import { computeMarkerFlows } from '../profile-logic/marker-data';
8188
import { changeStoredProfileNameInDb } from 'firefox-profiler/app-logic/uploaded-profiles-db';
8289
import type { TabSlug } from '../app-logic/tabs-handling';
8390
import type { CallNodeInfo } from '../profile-logic/call-node-info';
@@ -1641,6 +1648,37 @@ export function changeHoveredMarker(
16411648
};
16421649
}
16431650

1651+
export function changeActiveFlows(activeFlows: IndexIntoFlowTable[]): Action {
1652+
return {
1653+
type: 'CHANGE_ACTIVE_FLOWS',
1654+
activeFlows,
1655+
};
1656+
}
1657+
1658+
export function activateFlowsForMarker(
1659+
threadIndex: ThreadIndex,
1660+
markerIndex: MarkerIndex
1661+
): ThunkAction<void> {
1662+
console.log('yo');
1663+
return (dispatch, getState) => {
1664+
console.log('aha');
1665+
const profileFlowInfo = getProfileFlowInfo(getState());
1666+
const fullMarkerListPerThread = getFullMarkerListPerThread(getState());
1667+
const stringTable = getStringTable(getState());
1668+
console.log('aha2');
1669+
const flows =
1670+
computeMarkerFlows(
1671+
threadIndex,
1672+
markerIndex,
1673+
profileFlowInfo,
1674+
fullMarkerListPerThread,
1675+
stringTable
1676+
) ?? [];
1677+
console.log({ flows });
1678+
dispatch(changeActiveFlows(flows));
1679+
};
1680+
}
1681+
16441682
/**
16451683
* This action is used when the user right clicks a marker, and is especially
16461684
* used to display its context menu.

src/app-logic/url-handling.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ type BaseQuery = {
173173
timelineType: string;
174174
sourceView: string;
175175
assemblyView: string;
176+
activeFlows: string;
176177
};
177178

178179
type CallTreeQuery = BaseQuery & {
@@ -365,6 +366,9 @@ export function getQueryStringFromUrlState(urlState: UrlState): string {
365366
query = baseQuery as MarkersQueryShape;
366367
query.markerSearch =
367368
urlState.profileSpecific.markersSearchString || undefined;
369+
query.activeFlows =
370+
encodeUintArrayForUrlComponent(urlState.profileSpecific.activeFlows) ||
371+
undefined;
368372
break;
369373
case 'network-chart':
370374
query = baseQuery as NetworkQueryShape;
@@ -492,6 +496,8 @@ export function stateFromLocation(
492496
implementation = query.implementation;
493497
}
494498

499+
const activeFlows = decodeUintArrayFromUrlComponent(query.activeFlows ?? '');
500+
495501
const transforms: { [key: string]: Transform[] } = {};
496502
if (selectedThreadsKey !== null) {
497503
transforms[selectedThreadsKey] = parseTransforms(query.transforms);
@@ -562,6 +568,7 @@ export function stateFromLocation(
562568
transforms,
563569
sourceView,
564570
assemblyView,
571+
activeFlows,
565572
isBottomBoxOpenPerPanel,
566573
timelineType: validateTimelineType(query.timelineType),
567574
showJsTracerSummary: query.summary === undefined ? false : true,

src/components/app/Details.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { LocalizedErrorBoundary } from './ErrorBoundary';
1212
import { ProfileCallTreeView } from 'firefox-profiler/components/calltree/ProfileCallTreeView';
1313
import { MarkerTable } from 'firefox-profiler/components/marker-table';
1414
import { StackChart } from 'firefox-profiler/components/stack-chart/';
15-
import { MarkerChart } from 'firefox-profiler/components/marker-chart/';
15+
import { MarkerChartTab } from 'firefox-profiler/components/marker-chart-tab/';
1616
import { NetworkChart } from 'firefox-profiler/components/network-chart/';
1717
import { FlameGraph } from 'firefox-profiler/components/flame-graph/';
1818
import { JsTracer } from 'firefox-profiler/components/js-tracer/';
@@ -124,7 +124,7 @@ class ProfileViewerImpl extends PureComponent<Props> {
124124
calltree: <ProfileCallTreeView />,
125125
'flame-graph': <FlameGraph />,
126126
'stack-chart': <StackChart />,
127-
'marker-chart': <MarkerChart />,
127+
'marker-chart': <MarkerChartTab />,
128128
'marker-table': <MarkerTable />,
129129
'network-chart': <NetworkChart />,
130130
'js-tracer': <JsTracer />,
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
.DetailsContainer .layout-pane > * {
1+
.DetailsContainer > .layout-pane > * {
22
width: 100%;
33
height: 100%;
44
box-sizing: border-box;
55
}
66

7-
.DetailsContainer .layout-pane:not(.layout-pane-primary) {
7+
.DetailsContainer > .layout-pane:not(.layout-pane-primary) {
88
max-width: 600px;
99
}
1010

@@ -15,12 +15,12 @@
1515
position: unset;
1616
}
1717

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

24-
.DetailsContainer .layout-splitter:hover {
24+
.DetailsContainer > .layout-splitter:hover {
2525
background: var(--grey-30); /* same as the border above */
2626
}

0 commit comments

Comments
 (0)