Skip to content

Commit f6a6a44

Browse files
committed
Add a flow panel.
1 parent c383ce0 commit f6a6a44

File tree

19 files changed

+1679
-129
lines changed

19 files changed

+1679
-129
lines changed

src/actions/profile-view.js

+38
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ import {
2525
getThreadSelectorsFromThreadsKey,
2626
selectedThreadSelectors,
2727
} from 'firefox-profiler/selectors/per-thread';
28+
import {
29+
getProfileFlowInfo,
30+
getStringTablePerThread,
31+
getFullMarkerListPerThread,
32+
} from 'firefox-profiler/selectors/flow';
2833
import {
2934
getAllCommittedRanges,
3035
getImplementationFilter,
@@ -79,11 +84,13 @@ import type {
7984
TableViewOptions,
8085
SelectionContext,
8186
BottomBoxInfo,
87+
IndexIntoFlowTable,
8288
} from 'firefox-profiler/types';
8389
import {
8490
funcHasDirectRecursiveCall,
8591
funcHasRecursiveCall,
8692
} from '../profile-logic/transforms';
93+
import { computeMarkerFlows } from '../profile-logic/marker-data';
8794
import { changeStoredProfileNameInDb } from 'firefox-profiler/app-logic/uploaded-profiles-db';
8895
import type { TabSlug } from '../app-logic/tabs-handling';
8996
import { intersectSets } from 'firefox-profiler/utils/set';
@@ -1727,6 +1734,37 @@ export function changeHoveredMarker(
17271734
};
17281735
}
17291736

1737+
export function changeActiveFlows(activeFlows: IndexIntoFlowTable[]): Action {
1738+
return {
1739+
type: 'CHANGE_ACTIVE_FLOWS',
1740+
activeFlows,
1741+
};
1742+
}
1743+
1744+
export function activateFlowsForMarker(
1745+
threadIndex: ThreadIndex,
1746+
markerIndex: MarkerIndex
1747+
): ThunkAction<void> {
1748+
console.log('yo');
1749+
return (dispatch, getState) => {
1750+
console.log('aha');
1751+
const profileFlowInfo = getProfileFlowInfo(getState());
1752+
const stringTablePerThread = getStringTablePerThread(getState());
1753+
const fullMarkerListPerThread = getFullMarkerListPerThread(getState());
1754+
console.log('aha2');
1755+
const flows =
1756+
computeMarkerFlows(
1757+
threadIndex,
1758+
markerIndex,
1759+
profileFlowInfo,
1760+
stringTablePerThread,
1761+
fullMarkerListPerThread
1762+
) ?? [];
1763+
console.log({ flows });
1764+
dispatch(changeActiveFlows(flows));
1765+
};
1766+
}
1767+
17301768
/**
17311769
* This action is used when the user right clicks a marker, and is especially
17321770
* used to display its context menu.

src/app-logic/url-handling.js

+7
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ type BaseQuery = {|
186186
timelineType: string,
187187
sourceView: string,
188188
assemblyView: string,
189+
activeFlows: string,
189190
...FullProfileSpecificBaseQuery,
190191
...ActiveTabProfileSpecificBaseQuery,
191192
...OriginsProfileSpecificBaseQuery,
@@ -436,6 +437,9 @@ export function getQueryStringFromUrlState(urlState: UrlState): string {
436437
query = (baseQuery: MarkersQueryShape);
437438
query.markerSearch =
438439
urlState.profileSpecific.markersSearchString || undefined;
440+
query.activeFlows =
441+
encodeUintArrayForUrlComponent(urlState.profileSpecific.activeFlows) ||
442+
undefined;
439443
break;
440444
case 'network-chart':
441445
query = (baseQuery: NetworkQueryShape);
@@ -578,6 +582,8 @@ export function stateFromLocation(
578582
implementation = query.implementation;
579583
}
580584

585+
const activeFlows = decodeUintArrayFromUrlComponent(query.activeFlows ?? '');
586+
581587
const transforms = {};
582588
if (selectedThreadsKey !== null) {
583589
transforms[selectedThreadsKey] = parseTransforms(query.transforms);
@@ -658,6 +664,7 @@ export function stateFromLocation(
658664
transforms,
659665
sourceView,
660666
assemblyView,
667+
activeFlows,
661668
isBottomBoxOpenPerPanel,
662669
timelineType: validateTimelineType(query.timelineType),
663670
full: {

src/components/app/Details.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { LocalizedErrorBoundary } from './ErrorBoundary';
1414
import { ProfileCallTreeView } from 'firefox-profiler/components/calltree/ProfileCallTreeView';
1515
import { MarkerTable } from 'firefox-profiler/components/marker-table';
1616
import { StackChart } from 'firefox-profiler/components/stack-chart/';
17-
import { MarkerChart } from 'firefox-profiler/components/marker-chart/';
17+
import { MarkerChartTab } from 'firefox-profiler/components/marker-chart-tab';
1818
import { NetworkChart } from 'firefox-profiler/components/network-chart/';
1919
import { FlameGraph } from 'firefox-profiler/components/flame-graph/';
2020
import { JsTracer } from 'firefox-profiler/components/js-tracer/';
@@ -115,7 +115,7 @@ class ProfileViewerImpl extends PureComponent<Props> {
115115
calltree: <ProfileCallTreeView />,
116116
'flame-graph': <FlameGraph />,
117117
'stack-chart': <StackChart />,
118-
'marker-chart': <MarkerChart />,
118+
'marker-chart': <MarkerChartTab />,
119119
'marker-table': <MarkerTable />,
120120
'network-chart': <NetworkChart />,
121121
'js-tracer': <JsTracer />,
+4-4
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)