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

Various preparations in call tree code for fast inverted tree #4897

Merged
merged 8 commits into from
Jan 23, 2024
10 changes: 6 additions & 4 deletions src/components/flame-graph/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import type {
CallTreeSummaryStrategy,
WeightType,
SamplesLikeTable,
TracedTiming,
InnerWindowID,
Page,
} from 'firefox-profiler/types';
Expand All @@ -49,7 +48,10 @@ import type {
ChartCanvasHoverInfo,
} from '../shared/chart/Canvas';

import type { CallTree } from 'firefox-profiler/profile-logic/call-tree';
import type {
CallTree,
CallTreeTimings,
} from 'firefox-profiler/profile-logic/call-tree';

export type OwnProps = {|
+thread: Thread,
Expand All @@ -75,7 +77,7 @@ export type OwnProps = {|
+callTreeSummaryStrategy: CallTreeSummaryStrategy,
+samples: SamplesLikeTable,
+unfilteredSamples: SamplesLikeTable,
+tracedTiming: TracedTiming | null,
+tracedTiming: CallTreeTimings | null,
+displayImplementation: boolean,
+displayStackType: boolean,
|};
Expand Down Expand Up @@ -391,7 +393,7 @@ class FlameGraphCanvasImpl extends React.PureComponent<Props> {
const time = formatCallNodeNumberWithUnit(
'tracing-ms',
false,
tracedTiming.running[callNodeIndex]
tracedTiming.total[callNodeIndex]
);
percentage = `${time} (${percentage})`;
}
Expand Down
8 changes: 5 additions & 3 deletions src/components/flame-graph/FlameGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,17 @@ import type {
CallTreeSummaryStrategy,
CallNodeInfo,
IndexIntoCallNodeTable,
TracedTiming,
ThreadsKey,
InnerWindowID,
Page,
} from 'firefox-profiler/types';

import type { FlameGraphTiming } from 'firefox-profiler/profile-logic/flame-graph';

import type { CallTree } from 'firefox-profiler/profile-logic/call-tree';
import type {
CallTree,
CallTreeTimings,
} from 'firefox-profiler/profile-logic/call-tree';

import type { ConnectedProps } from 'firefox-profiler/utils/connect';

Expand Down Expand Up @@ -87,7 +89,7 @@ type StateProps = {|
+callTreeSummaryStrategy: CallTreeSummaryStrategy,
+samples: SamplesLikeTable,
+unfilteredSamples: SamplesLikeTable,
+tracedTiming: TracedTiming | null,
+tracedTiming: CallTreeTimings | null,
+displayImplementation: boolean,
+displayStackType: boolean,
|};
Expand Down
19 changes: 10 additions & 9 deletions src/components/sidebar/CallTreeSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import type {
ThreadsKey,
CategoryList,
IndexIntoCallNodeTable,
TracedTiming,
SelfAndTotal,
Milliseconds,
WeightType,
IndexIntoCategoryList,
Expand Down Expand Up @@ -291,7 +291,7 @@ type StateProps = {|
+timings: TimingsForPath,
+categoryList: CategoryList,
+weightType: WeightType,
+tracedTiming: TracedTiming | null,
+selectedNodeTracedSelfAndTotal: SelfAndTotal | null,
|};

type Props = ConnectedProps<{||}, StateProps, {||}>;
Expand Down Expand Up @@ -352,7 +352,7 @@ class CallTreeSidebarImpl extends React.PureComponent<Props> {
timings,
categoryList,
weightType,
tracedTiming,
selectedNodeTracedSelfAndTotal,
} = this.props;
const {
forPath: { selfTime, totalTime },
Expand Down Expand Up @@ -402,24 +402,24 @@ class CallTreeSidebarImpl extends React.PureComponent<Props> {
<h4 className="sidebar-title3">
<div>Call node details</div>
</h4>
{tracedTiming ? (
{selectedNodeTracedSelfAndTotal ? (
<SidebarDetail
label="Traced running time"
value={formatMilliseconds(
tracedTiming.running[selectedNodeIndex],
selectedNodeTracedSelfAndTotal.total,
3,
1
)}
></SidebarDetail>
) : null}
{tracedTiming ? (
{selectedNodeTracedSelfAndTotal ? (
<SidebarDetail
label="Traced self time"
value={
tracedTiming.self[selectedNodeIndex] === 0
selectedNodeTracedSelfAndTotal.self === 0
? '—'
: formatMilliseconds(
tracedTiming.self[selectedNodeIndex],
selectedNodeTracedSelfAndTotal.self,
3,
1
)
Expand Down Expand Up @@ -507,7 +507,8 @@ export const CallTreeSidebar = explicitConnect<{||}, StateProps, {||}>({
timings: selectedNodeSelectors.getTimingsForSidebar(state),
categoryList: getCategories(state),
weightType: selectedThreadSelectors.getWeightTypeForCallTree(state),
tracedTiming: selectedThreadSelectors.getTracedTiming(state),
selectedNodeTracedSelfAndTotal:
selectedThreadSelectors.getTracedSelfAndTotalForSelectedCallNode(state),
}),
component: CallTreeSidebarImpl,
});
Loading