Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
85 changes: 85 additions & 0 deletions src/actions/profile-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ import {
getPreviewSelection,
getLocalTracksByPid,
getThreads,
getStringTable,
getLastNonShiftClick,
} from 'firefox-profiler/selectors/profile';
import {
getThreadSelectors,
getThreadSelectorsFromThreadsKey,
selectedThreadSelectors,
} from 'firefox-profiler/selectors/per-thread';
import {
getProfileFlowInfo,
getFullMarkerListPerThread,
} from 'firefox-profiler/selectors/flow';
import {
getAllCommittedRanges,
getImplementationFilter,
Expand Down Expand Up @@ -73,11 +78,13 @@ import type {
TableViewOptions,
SelectionContext,
BottomBoxInfo,
IndexIntoFlowTable,
} from 'firefox-profiler/types';
import {
funcHasDirectRecursiveCall,
funcHasRecursiveCall,
} from '../profile-logic/transforms';
import { computeMarkerFlows } from '../profile-logic/marker-data';
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';
Expand Down Expand Up @@ -903,6 +910,53 @@ export function showProvidedTracks(
};
}

export function showProvidedThreads(
threadsToShow: Set<ThreadIndex>
): ThunkAction<void> {
return (dispatch, getState) => {
const globalTracks = getGlobalTracks(getState());
const localTracksByPid = getLocalTracksByPid(getState());

const globalTracksToShow: Set<TrackIndex> = new Set();
const localTracksByPidToShow: Map<Pid, Set<TrackIndex>> = new Map();

for (const [globalTrackIndex, globalTrack] of globalTracks.entries()) {
if (globalTrack.type !== 'process') {
continue;
}
const { mainThreadIndex, pid } = globalTrack;
if (mainThreadIndex !== null && threadsToShow.has(mainThreadIndex)) {
globalTracksToShow.add(globalTrackIndex);
}
const localTracks = localTracksByPid.get(pid);
if (localTracks === undefined) {
continue;
}

for (const [localTrackIndex, localTrack] of localTracks.entries()) {
if (localTrack.type !== 'thread') {
continue;
}
if (threadsToShow.has(localTrack.threadIndex)) {
const localTracksToShow = localTracksByPidToShow.get(pid);
if (localTracksToShow === undefined) {
localTracksByPidToShow.set(pid, new Set([localTrackIndex]));
} else {
localTracksToShow.add(localTrackIndex);
}
globalTracksToShow.add(globalTrackIndex);
}
}
}

dispatch({
type: 'SHOW_PROVIDED_TRACKS',
globalTracksToShow,
localTracksByPidToShow,
});
};
}

/**
* This action makes the tracks that are provided hidden.
*/
Expand Down Expand Up @@ -1594,6 +1648,37 @@ export function changeHoveredMarker(
};
}

export function changeActiveFlows(activeFlows: IndexIntoFlowTable[]): Action {
return {
type: 'CHANGE_ACTIVE_FLOWS',
activeFlows,
};
}

export function activateFlowsForMarker(
threadIndex: ThreadIndex,
markerIndex: MarkerIndex
): ThunkAction<void> {
console.log('yo');
return (dispatch, getState) => {
console.log('aha');
const profileFlowInfo = getProfileFlowInfo(getState());
const fullMarkerListPerThread = getFullMarkerListPerThread(getState());
const stringTable = getStringTable(getState());
console.log('aha2');
const flows =
computeMarkerFlows(
threadIndex,
markerIndex,
profileFlowInfo,
fullMarkerListPerThread,
stringTable
) ?? [];
console.log({ flows });
dispatch(changeActiveFlows(flows));
};
}

/**
* This action is used when the user right clicks a marker, and is especially
* used to display its context menu.
Expand Down
2 changes: 1 addition & 1 deletion src/app-logic/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const PROFILER_SERVER_ORIGIN = 'https://api.profiler.firefox.com';
// [1] https://github.com/mstange/profiler-symbol-server/

// This is the default server.
export const SYMBOL_SERVER_URL = 'https://symbolication.services.mozilla.com';
export const SYMBOL_SERVER_URL = 'https://mozilla.symbols.samplyprofiler.com';

// See the MarkerPhase type for more information.
export const INSTANT: MarkerPhase = 0;
Expand Down
7 changes: 7 additions & 0 deletions src/app-logic/url-handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ type BaseQuery = {
timelineType: string;
sourceViewIndex: number;
assemblyView: string;
activeFlows: string;
};

type CallTreeQuery = BaseQuery & {
Expand Down Expand Up @@ -366,6 +367,9 @@ export function getQueryStringFromUrlState(urlState: UrlState): string {
query = baseQuery as MarkersQueryShape;
query.markerSearch =
urlState.profileSpecific.markersSearchString || undefined;
query.activeFlows =
encodeUintArrayForUrlComponent(urlState.profileSpecific.activeFlows) ||
undefined;
break;
case 'network-chart':
query = baseQuery as NetworkQueryShape;
Expand Down Expand Up @@ -493,6 +497,8 @@ export function stateFromLocation(
implementation = query.implementation;
}

const activeFlows = decodeUintArrayFromUrlComponent(query.activeFlows ?? '');

const transforms: { [key: string]: Transform[] } = {};
if (selectedThreadsKey !== null) {
transforms[selectedThreadsKey] = parseTransforms(query.transforms);
Expand Down Expand Up @@ -563,6 +569,7 @@ export function stateFromLocation(
transforms,
sourceView,
assemblyView,
activeFlows,
isBottomBoxOpenPerPanel,
timelineType: validateTimelineType(query.timelineType),
showJsTracerSummary: query.summary === undefined ? false : true,
Expand Down
4 changes: 2 additions & 2 deletions src/components/app/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { LocalizedErrorBoundary } from './ErrorBoundary';
import { ProfileCallTreeView } from 'firefox-profiler/components/calltree/ProfileCallTreeView';
import { MarkerTable } from 'firefox-profiler/components/marker-table';
import { StackChart } from 'firefox-profiler/components/stack-chart/';
import { MarkerChart } from 'firefox-profiler/components/marker-chart/';
import { MarkerChartTab } from 'firefox-profiler/components/marker-chart-tab/';
import { NetworkChart } from 'firefox-profiler/components/network-chart/';
import { FlameGraph } from 'firefox-profiler/components/flame-graph/';
import { JsTracer } from 'firefox-profiler/components/js-tracer/';
Expand Down Expand Up @@ -124,7 +124,7 @@ class ProfileViewerImpl extends PureComponent<Props> {
calltree: <ProfileCallTreeView />,
'flame-graph': <FlameGraph />,
'stack-chart': <StackChart />,
'marker-chart': <MarkerChart />,
'marker-chart': <MarkerChartTab />,
'marker-table': <MarkerTable />,
'network-chart': <NetworkChart />,
'js-tracer': <JsTracer />,
Expand Down
8 changes: 4 additions & 4 deletions src/components/app/DetailsContainer.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.DetailsContainer .layout-pane > * {
.DetailsContainer > .layout-pane > * {
width: 100%;
height: 100%;
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 */
}
Loading
Loading