-
Notifications
You must be signed in to change notification settings - Fork 467
Expand file tree
/
Copy pathTrackSamplingInterval.tsx
More file actions
78 lines (67 loc) · 2.03 KB
/
TrackSamplingInterval.tsx
File metadata and controls
78 lines (67 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* 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/. */
import * as React from 'react';
import explicitConnect from 'firefox-profiler/utils/connect';
import { getCommittedRange } from 'firefox-profiler/selectors/profile';
import { updatePreviewSelection } from 'firefox-profiler/actions/profile-view';
import { TrackSamplingIntervalGraph } from './TrackSamplingIntervalGraph';
import {
TRACK_PROCESS_CPU_HEIGHT,
TRACK_PROCESS_CPU_LINE_WIDTH,
} from 'firefox-profiler/app-logic/constants';
import type { Pid, Milliseconds } from 'firefox-profiler/types';
import type { ConnectedProps } from 'firefox-profiler/utils/connect';
import './TrackSamplingInterval.css';
type OwnProps = {
readonly pid: Pid;
};
type StateProps = {
readonly rangeStart: Milliseconds;
readonly rangeEnd: Milliseconds;
};
type DispatchProps = {
updatePreviewSelection: typeof updatePreviewSelection;
};
type Props = ConnectedProps<OwnProps, StateProps, DispatchProps>;
type State = {};
export class TrackSamplingIntervalImpl extends React.PureComponent<
Props,
State
> {
override render() {
const { pid } = this.props;
return (
<div
className="timelineTrackSamplingInterval"
style={
{
height: TRACK_PROCESS_CPU_HEIGHT,
'--graph-height': `${TRACK_PROCESS_CPU_HEIGHT}px`,
} as React.CSSProperties
}
>
<TrackSamplingIntervalGraph
pid={pid}
lineWidth={TRACK_PROCESS_CPU_LINE_WIDTH}
graphHeight={TRACK_PROCESS_CPU_HEIGHT}
/>
</div>
);
}
}
export const TrackSamplingInterval = explicitConnect<
OwnProps,
StateProps,
DispatchProps
>({
mapStateToProps: (state) => {
const { start, end } = getCommittedRange(state);
return {
rangeStart: start,
rangeEnd: end,
};
},
mapDispatchToProps: { updatePreviewSelection },
component: TrackSamplingIntervalImpl,
});