Skip to content

Commit 03c3dfb

Browse files
Adam RaineDevtools-frontend LUCI CQ
authored andcommitted
[LCPPhases] Use duration instead of percent
Lighthouse, the RPP landing page, and CrUX all use ms instead of %. Bug: None Change-Id: I2b1938ba5908cf3a485146df9398d482c7d12cd8 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6270376 Commit-Queue: Adriana Ixba <[email protected]> Reviewed-by: Adriana Ixba <[email protected]> Auto-Submit: Adam Raine <[email protected]>
1 parent 902b7ad commit 03c3dfb

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

front_end/models/trace/insights/LCPPhases.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ export const UIStrings = {
4848
*/
4949
phase: 'Phase',
5050
/**
51-
*@description Label used for the percentage a single phase/component/stage/section takes up of a larger duration.
51+
* @description Label used for the duration a single phase/component/stage/section takes up of a larger duration.
5252
*/
53-
percentLCP: '% of LCP',
53+
duration: 'Duration',
5454
/**
5555
* @description Text status indicating that the the Largest Contentful Paint (LCP) metric timing was not found. "LCP" is an acronym and should not be translated.
5656
*/

front_end/panels/timeline/components/insights/LCPPhases.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import './Table.js';
66

7+
import * as i18n from '../../../../core/i18n/i18n.js';
78
import type {LCPPhasesInsightModel} from '../../../../models/trace/insights/LCPPhases.js';
89
import * as Trace from '../../../../models/trace/trace.js';
910
import * as Lit from '../../../../ui/lit/lit.js';
@@ -19,7 +20,6 @@ const {html} = Lit;
1920
interface PhaseData {
2021
phase: string;
2122
timing: number|Trace.Types.Timing.Milli;
22-
percent: string;
2323
}
2424

2525
export class LCPPhases extends BaseInsightComponent<LCPPhasesInsightModel> {
@@ -43,33 +43,29 @@ export class LCPPhases extends BaseInsightComponent<LCPPhasesInsightModel> {
4343

4444
if (loadDelay && loadTime) {
4545
const phaseData = [
46-
{phase: i18nString(UIStrings.timeToFirstByte), timing: ttfb, percent: `${(100 * ttfb / timing).toFixed(0)}%`},
46+
{phase: i18nString(UIStrings.timeToFirstByte), timing: ttfb},
4747
{
4848
phase: i18nString(UIStrings.resourceLoadDelay),
4949
timing: loadDelay,
50-
percent: `${(100 * loadDelay / timing).toFixed(0)}%`,
5150
},
5251
{
5352
phase: i18nString(UIStrings.resourceLoadDuration),
5453
timing: loadTime,
55-
percent: `${(100 * loadTime / timing).toFixed(0)}%`,
5654
},
5755
{
5856
phase: i18nString(UIStrings.elementRenderDelay),
5957
timing: renderDelay,
60-
percent: `${(100 * renderDelay / timing).toFixed(0)}%`,
6158
},
6259
];
6360
return phaseData;
6461
}
6562

6663
// If the lcp is text, we only have ttfb and render delay.
6764
const phaseData = [
68-
{phase: i18nString(UIStrings.timeToFirstByte), timing: ttfb, percent: `${(100 * ttfb / timing).toFixed(0)}%`},
65+
{phase: i18nString(UIStrings.timeToFirstByte), timing: ttfb},
6966
{
7067
phase: i18nString(UIStrings.elementRenderDelay),
7168
timing: renderDelay,
72-
percent: `${(100 * renderDelay / timing).toFixed(0)}%`,
7369
},
7470
];
7571
return phaseData;
@@ -164,10 +160,10 @@ export class LCPPhases extends BaseInsightComponent<LCPPhasesInsightModel> {
164160
return html`<div class="insight-section">${i18nString(UIStrings.noLcp)}</div>`;
165161
}
166162

167-
const rows = phaseData.map(({phase, percent}) => {
163+
const rows = phaseData.map(({phase, timing}) => {
168164
const section = this.#overlay?.sections.find(section => phase === section.label);
169165
return {
170-
values: [phase, percent],
166+
values: [phase, i18n.TimeUtilities.preciseMillisToString(timing)],
171167
overlays: section && [{
172168
type: 'TIMESPAN_BREAKDOWN',
173169
sections: [section],
@@ -181,7 +177,7 @@ export class LCPPhases extends BaseInsightComponent<LCPPhasesInsightModel> {
181177
${html`<devtools-performance-table
182178
.data=${{
183179
insight: this,
184-
headers: [i18nString(UIStrings.phase), i18nString(UIStrings.percentLCP)],
180+
headers: [i18nString(UIStrings.phase), i18nString(UIStrings.duration)],
185181
rows,
186182
} as TableData}>
187183
</devtools-performance-table>`}

0 commit comments

Comments
 (0)