Skip to content

Commit 6562d03

Browse files
committed
refactor(timings): clarify unblocked units
Unblocked is a better term than unlocked
1 parent 12958ef commit 6562d03

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

src/cargo/core/compiler/job_queue/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,10 +1122,10 @@ impl<'gctx> DrainState<'gctx> {
11221122
unit.show_warnings(build_runner.bcx.gctx),
11231123
)?;
11241124
}
1125-
let unlocked = self.queue.finish(unit, &artifact);
1125+
let unblocked = self.queue.finish(unit, &artifact);
11261126
match artifact {
1127-
Artifact::All => self.timings.unit_finished(build_runner, id, unlocked),
1128-
Artifact::Metadata => self.timings.unit_rmeta_finished(id, unlocked),
1127+
Artifact::All => self.timings.unit_finished(build_runner, id, unblocked),
1128+
Artifact::Metadata => self.timings.unit_rmeta_finished(id, unblocked),
11291129
}
11301130
Ok(())
11311131
}

src/cargo/core/compiler/timings/mod.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ struct UnitTime {
8989
/// The time when the `.rmeta` file was generated, an offset in seconds
9090
/// from `start`.
9191
rmeta_time: Option<f64>,
92-
/// Reverse deps that are freed to run after this unit finished.
93-
unlocked_units: Vec<Unit>,
94-
/// Same as `unlocked_units`, but unlocked by rmeta.
95-
unlocked_rmeta_units: Vec<Unit>,
92+
/// Reverse deps that are unblocked and ready to run after this unit finishes.
93+
unblocked_units: Vec<Unit>,
94+
/// Same as `unblocked_units`, but unblocked by rmeta.
95+
unblocked_rmeta_units: Vec<Unit>,
9696
/// Individual compilation section durations, gathered from `--json=timings`.
9797
///
9898
/// IndexMap is used to keep original insertion order, we want to be able to tell which
@@ -127,8 +127,8 @@ struct UnitData {
127127
start: f64,
128128
duration: f64,
129129
rmeta_time: Option<f64>,
130-
unlocked_units: Vec<usize>,
131-
unlocked_rmeta_units: Vec<usize>,
130+
unblocked_units: Vec<usize>,
131+
unblocked_rmeta_units: Vec<usize>,
132132
sections: Option<Vec<(String, report::SectionData)>>,
133133
}
134134

@@ -216,15 +216,15 @@ impl<'gctx> Timings<'gctx> {
216216
start: self.start.elapsed().as_secs_f64(),
217217
duration: 0.0,
218218
rmeta_time: None,
219-
unlocked_units: Vec::new(),
220-
unlocked_rmeta_units: Vec::new(),
219+
unblocked_units: Vec::new(),
220+
unblocked_rmeta_units: Vec::new(),
221221
sections: Default::default(),
222222
};
223223
assert!(self.active.insert(id, unit_time).is_none());
224224
}
225225

226226
/// Mark that the `.rmeta` file as generated.
227-
pub fn unit_rmeta_finished(&mut self, id: JobId, unlocked: Vec<&Unit>) {
227+
pub fn unit_rmeta_finished(&mut self, id: JobId, unblocked: Vec<&Unit>) {
228228
if !self.enabled {
229229
return;
230230
}
@@ -236,18 +236,18 @@ impl<'gctx> Timings<'gctx> {
236236
};
237237
let t = self.start.elapsed().as_secs_f64();
238238
unit_time.rmeta_time = Some(t - unit_time.start);
239-
assert!(unit_time.unlocked_rmeta_units.is_empty());
239+
assert!(unit_time.unblocked_rmeta_units.is_empty());
240240
unit_time
241-
.unlocked_rmeta_units
242-
.extend(unlocked.iter().cloned().cloned());
241+
.unblocked_rmeta_units
242+
.extend(unblocked.iter().cloned().cloned());
243243
}
244244

245245
/// Mark that a unit has finished running.
246246
pub fn unit_finished(
247247
&mut self,
248248
build_runner: &BuildRunner<'_, '_>,
249249
id: JobId,
250-
unlocked: Vec<&Unit>,
250+
unblocked: Vec<&Unit>,
251251
) {
252252
if !self.enabled {
253253
return;
@@ -258,10 +258,10 @@ impl<'gctx> Timings<'gctx> {
258258
};
259259
let t = self.start.elapsed().as_secs_f64();
260260
unit_time.duration = t - unit_time.start;
261-
assert!(unit_time.unlocked_units.is_empty());
261+
assert!(unit_time.unblocked_units.is_empty());
262262
unit_time
263-
.unlocked_units
264-
.extend(unlocked.iter().cloned().cloned());
263+
.unblocked_units
264+
.extend(unblocked.iter().cloned().cloned());
265265
if self.report_json {
266266
let msg = machine_message::TimingInfo {
267267
package_id: unit_time.unit.pkg.package_id().to_spec(),

src/cargo/core/compiler/timings/report.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,13 @@ fn to_unit_data(unit_times: &[UnitTime]) -> Vec<UnitData> {
373373
// These filter on the unlocked units because not all unlocked
374374
// units are actually "built". For example, Doctest mode units
375375
// don't actually generate artifacts.
376-
let unlocked_units: Vec<usize> = ut
377-
.unlocked_units
376+
let unblocked_units: Vec<usize> = ut
377+
.unblocked_units
378378
.iter()
379379
.filter_map(|unit| unit_map.get(unit).copied())
380380
.collect();
381-
let unlocked_rmeta_units: Vec<usize> = ut
382-
.unlocked_rmeta_units
381+
let unblocked_rmeta_units: Vec<usize> = ut
382+
.unblocked_rmeta_units
383383
.iter()
384384
.filter_map(|unit| unit_map.get(unit).copied())
385385
.collect();
@@ -419,8 +419,8 @@ fn to_unit_data(unit_times: &[UnitTime]) -> Vec<UnitData> {
419419
start: round(ut.start),
420420
duration: round(ut.duration),
421421
rmeta_time: ut.rmeta_time.map(round),
422-
unlocked_units,
423-
unlocked_rmeta_units,
422+
unblocked_units,
423+
unblocked_rmeta_units,
424424
sections,
425425
}
426426
})

src/doc/src/reference/timings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ version information of the currently used compiler.
2222

2323
The "unit" graph shows the duration of each unit over time.
2424
A "unit" is a single compiler invocation.
25-
There are lines that show which additional units are "unlocked" when a unit finishes.
25+
There are lines that show which additional units are "unblocked" when a unit finishes.
2626
That is, it shows the new units that are now allowed to run because their dependencies are all finished.
2727
Hover the mouse over a unit to highlight the lines.
2828
This can help visualize the critical path of dependencies.

0 commit comments

Comments
 (0)