Skip to content

Commit 129593d

Browse files
committed
fix(timings): compute codegen start time to draw dep lines
This was an overlook in 1891593 that forgot to replace other `rmeta_x`.
1 parent 0b3a76f commit 129593d

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/cargo/core/compiler/timings.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Y_TICK_DIST = BOX_HEIGHT + 2;
1717
let HIT_BOXES = [];
1818
// Index into UNIT_DATA of the last unit hovered over by mouse.
1919
let LAST_HOVER = null;
20-
// Key is unit index, value is {x, y, width, rmeta_x} of the box.
20+
// Key is unit index, value is {x, y, width, sections} of the box.
2121
let UNIT_COORDS = {};
2222
// Map of unit index to the index it was unlocked by.
2323
let REVERSE_UNIT_DEPS = {};
@@ -306,16 +306,29 @@ function get_section_color(name) {
306306
}
307307
}
308308

309+
// Gets the x-coordinate of the codegen section of a unit.
310+
//
311+
// This is for drawing rmeta dependency lines.
312+
function get_codegen_section_x(sections) {
313+
const codegen_section = sections.find(s => s.name === "codegen")
314+
if (!codegen_section) {
315+
// This happens only when type-checking (e.g., `cargo check`)
316+
return null;
317+
}
318+
return codegen_section.start;
319+
}
320+
309321
// Draws lines from the given unit to the units it unlocks.
310322
function draw_dep_lines(ctx, unit_idx, highlighted) {
311323
const unit = UNIT_DATA[unit_idx];
312-
const {x, y, rmeta_x} = UNIT_COORDS[unit_idx];
324+
const {x, y, sections} = UNIT_COORDS[unit_idx];
313325
ctx.save();
314326
for (const unlocked of unit.unlocked_units) {
315327
draw_one_dep_line(ctx, x, y, unlocked, highlighted);
316328
}
317329
for (const unlocked of unit.unlocked_rmeta_units) {
318-
draw_one_dep_line(ctx, rmeta_x, y, unlocked, highlighted);
330+
const codegen_x = get_codegen_section_x(sections);
331+
draw_one_dep_line(ctx, codegen_x, y, unlocked, highlighted);
319332
}
320333
ctx.restore();
321334
}
@@ -589,15 +602,16 @@ function pipeline_mousemove(event) {
589602
if (box.i in REVERSE_UNIT_DEPS) {
590603
const dep_unit = REVERSE_UNIT_DEPS[box.i];
591604
if (dep_unit in UNIT_COORDS) {
592-
const {x, y, rmeta_x} = UNIT_COORDS[dep_unit];
605+
const {x, y} = UNIT_COORDS[dep_unit];
593606
draw_one_dep_line(ctx, x, y, box.i, true);
594607
}
595608
}
596609
if (box.i in REVERSE_UNIT_RMETA_DEPS) {
597610
const dep_unit = REVERSE_UNIT_RMETA_DEPS[box.i];
598611
if (dep_unit in UNIT_COORDS) {
599-
const {x, y, rmeta_x} = UNIT_COORDS[dep_unit];
600-
draw_one_dep_line(ctx, rmeta_x, y, box.i, true);
612+
const {y, sections} = UNIT_COORDS[dep_unit];
613+
const codegen_x = get_codegen_section_x(sections);
614+
draw_one_dep_line(ctx, codegen_x, y, box.i, true);
601615
}
602616
}
603617
ctx.restore();

0 commit comments

Comments
 (0)