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

Profiler tooltip shows self duration #18510

Merged
merged 1 commit into from Apr 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -27,7 +27,7 @@
}

.CurrentCommit {
margin-top: 0.25rem;
margin: 0.25rem 0;
display: block;
width: 100%;
text-align: left;
Expand Down
Expand Up @@ -10,7 +10,7 @@
import * as React from 'react';
import {Fragment, useContext} from 'react';
import {ProfilerContext} from './ProfilerContext';
import {formatDuration, formatTime} from './utils';
import {formatDuration} from './utils';
import WhatChanged from './WhatChanged';
import {StoreContext} from '../context';

Expand Down Expand Up @@ -44,18 +44,17 @@ export default function HoveredFiberInfo({fiberData}: Props) {
for (i = 0; i < commitIndices.length; i++) {
const commitIndex = commitIndices[i];
if (selectedCommitIndex === commitIndex) {
const {duration, timestamp} = profilerStore.getCommitData(
((rootID: any): number),
commitIndex,
);
const {
fiberActualDurations,
fiberSelfDurations,
} = profilerStore.getCommitData(((rootID: any): number), commitIndex);
const actualDuration = fiberActualDurations.get(id) || 0;
const selfDuration = fiberSelfDurations.get(id) || 0;

renderDurationInfo = (
<Fragment>
<label className={styles.Label}>Rendered at:</label>
<div key={commitIndex} className={styles.CurrentCommit}>
{formatTime(timestamp)}s for {formatDuration(duration)}ms
</div>
</Fragment>
<div key={commitIndex} className={styles.CurrentCommit}>
{formatDuration(selfDuration)}ms of {formatDuration(actualDuration)}ms
</div>
);

break;
Expand All @@ -68,10 +67,10 @@ export default function HoveredFiberInfo({fiberData}: Props) {
<div className={styles.Component}>{name}</div>
</div>
<div className={styles.Content}>
<WhatChanged fiberID={((id: any): number)} />
{renderDurationInfo || (
<div>Did not render during this profiling session.</div>
)}
<WhatChanged fiberID={((id: any): number)} />
</div>
</Fragment>
);
Expand Down