mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Render link time in pipeline graph
This commit is contained in:
parent
18915936bd
commit
69171b7e81
@ -67,6 +67,7 @@ const CANVAS_BG = getCssColor('--canvas-background');
|
|||||||
const AXES_COLOR = getCssColor('--canvas-axes');
|
const AXES_COLOR = getCssColor('--canvas-axes');
|
||||||
const GRID_COLOR = getCssColor('--canvas-grid');
|
const GRID_COLOR = getCssColor('--canvas-grid');
|
||||||
const CODEGEN_COLOR = getCssColor('--canvas-codegen');
|
const CODEGEN_COLOR = getCssColor('--canvas-codegen');
|
||||||
|
const LINK_COLOR = getCssColor('--canvas-link');
|
||||||
const CUSTOM_BUILD_COLOR = getCssColor('--canvas-custom-build');
|
const CUSTOM_BUILD_COLOR = getCssColor('--canvas-custom-build');
|
||||||
const NOT_CUSTOM_BUILD_COLOR = getCssColor('--canvas-not-custom-build');
|
const NOT_CUSTOM_BUILD_COLOR = getCssColor('--canvas-not-custom-build');
|
||||||
const DEP_LINE_COLOR = getCssColor('--canvas-dep-line');
|
const DEP_LINE_COLOR = getCssColor('--canvas-dep-line');
|
||||||
@ -136,7 +137,19 @@ function render_pipeline_graph() {
|
|||||||
let x = px_per_sec * unit.start;
|
let x = px_per_sec * unit.start;
|
||||||
|
|
||||||
const sections = [];
|
const sections = [];
|
||||||
if (unit.rmeta_time != null) {
|
if (unit.sections !== null) {
|
||||||
|
// We have access to compilation sections
|
||||||
|
for (const section of unit.sections) {
|
||||||
|
const [name, {start, end}] = section;
|
||||||
|
sections.push({
|
||||||
|
name,
|
||||||
|
start: x + px_per_sec * start,
|
||||||
|
width: (end - start) * px_per_sec
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (unit.rmeta_time != null) {
|
||||||
|
// We only know the rmeta time
|
||||||
sections.push({
|
sections.push({
|
||||||
name: "codegen",
|
name: "codegen",
|
||||||
start: x + px_per_sec * unit.rmeta_time,
|
start: x + px_per_sec * unit.rmeta_time,
|
||||||
@ -188,6 +201,8 @@ function render_pipeline_graph() {
|
|||||||
function get_section_color(name) {
|
function get_section_color(name) {
|
||||||
if (name === "codegen") {
|
if (name === "codegen") {
|
||||||
return CODEGEN_COLOR;
|
return CODEGEN_COLOR;
|
||||||
|
} else if (name === "link") {
|
||||||
|
return LINK_COLOR;
|
||||||
} else {
|
} else {
|
||||||
// We do not know what section this is, so just use the default color
|
// We do not know what section this is, so just use the default color
|
||||||
return NOT_CUSTOM_BUILD_COLOR;
|
return NOT_CUSTOM_BUILD_COLOR;
|
||||||
|
@ -586,6 +586,7 @@ impl<'gctx> Timings<'gctx> {
|
|||||||
rmeta_time: Option<f64>,
|
rmeta_time: Option<f64>,
|
||||||
unlocked_units: Vec<usize>,
|
unlocked_units: Vec<usize>,
|
||||||
unlocked_rmeta_units: Vec<usize>,
|
unlocked_rmeta_units: Vec<usize>,
|
||||||
|
sections: Option<Vec<(String, SectionData)>>,
|
||||||
}
|
}
|
||||||
let round = |x: f64| (x * 100.0).round() / 100.0;
|
let round = |x: f64| (x * 100.0).round() / 100.0;
|
||||||
let unit_data: Vec<UnitData> = self
|
let unit_data: Vec<UnitData> = self
|
||||||
@ -599,7 +600,6 @@ impl<'gctx> Timings<'gctx> {
|
|||||||
"todo"
|
"todo"
|
||||||
}
|
}
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
// These filter on the unlocked units because not all unlocked
|
// These filter on the unlocked units because not all unlocked
|
||||||
// units are actually "built". For example, Doctest mode units
|
// units are actually "built". For example, Doctest mode units
|
||||||
// don't actually generate artifacts.
|
// don't actually generate artifacts.
|
||||||
@ -613,6 +613,13 @@ impl<'gctx> Timings<'gctx> {
|
|||||||
.iter()
|
.iter()
|
||||||
.filter_map(|unit| unit_map.get(unit).copied())
|
.filter_map(|unit| unit_map.get(unit).copied())
|
||||||
.collect();
|
.collect();
|
||||||
|
let aggregated = ut.aggregate_sections();
|
||||||
|
let sections = match aggregated {
|
||||||
|
AggregatedSections::Sections(sections) => Some(sections),
|
||||||
|
AggregatedSections::OnlyMetadataTime { .. }
|
||||||
|
| AggregatedSections::OnlyTotalDuration => None,
|
||||||
|
};
|
||||||
|
|
||||||
UnitData {
|
UnitData {
|
||||||
i,
|
i,
|
||||||
name: ut.unit.pkg.name().to_string(),
|
name: ut.unit.pkg.name().to_string(),
|
||||||
@ -624,6 +631,7 @@ impl<'gctx> Timings<'gctx> {
|
|||||||
rmeta_time: ut.rmeta_time.map(round),
|
rmeta_time: ut.rmeta_time.map(round),
|
||||||
unlocked_units,
|
unlocked_units,
|
||||||
unlocked_rmeta_units,
|
unlocked_rmeta_units,
|
||||||
|
sections,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
@ -871,6 +879,7 @@ static HTML_TMPL: &str = r#"
|
|||||||
--canvas-axes: #303030;
|
--canvas-axes: #303030;
|
||||||
--canvas-grid: #e6e6e6;
|
--canvas-grid: #e6e6e6;
|
||||||
--canvas-codegen: #aa95e8;
|
--canvas-codegen: #aa95e8;
|
||||||
|
--canvas-link: #95e8aa;
|
||||||
--canvas-custom-build: #f0b165;
|
--canvas-custom-build: #f0b165;
|
||||||
--canvas-not-custom-build: #95cce8;
|
--canvas-not-custom-build: #95cce8;
|
||||||
--canvas-dep-line: #ddd;
|
--canvas-dep-line: #ddd;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user