Skip to content

Commit 3c23e2d

Browse files
committed
feat(log): track unblocked units in unit-started event
1 parent 239697a commit 3c23e2d

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,13 @@ impl<'gctx> Timings<'gctx> {
318318
crate::drop_println!(self.gctx, "{}", msg);
319319
}
320320
if let Some(logger) = build_runner.bcx.logger {
321+
let unblocked = unblocked.iter().map(|u| self.unit_to_index[u]).collect();
321322
logger.log(LogMessage::UnitFinished {
322323
index: self.unit_to_index[&unit_time.unit],
323324
duration: unit_time.duration,
324325
rmeta_time: unit_time.rmeta_time,
325326
sections: unit_time.sections.clone().into_iter().collect(),
327+
unblocked,
326328
});
327329
}
328330
self.unit_times.push(unit_time);

src/cargo/util/log_message.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ pub enum LogMessage {
4444
rmeta_time: Option<f64>,
4545
#[serde(skip_serializing_if = "Vec::is_empty")]
4646
sections: Vec<(String, CompilationSection)>,
47+
#[serde(skip_serializing_if = "Vec::is_empty")]
48+
unblocked: Vec<u64>,
4749
},
4850
/// Emitted when a unit needs to be rebuilt.
4951
Rebuild {

tests/testsuite/build_analysis.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ fn log_msg_timing_info() {
149149
"reason": "unit-finished",
150150
"rmeta_time": "{...}",
151151
"run_id": "[..]T[..]Z-[..]",
152-
"timestamp": "[..]T[..]Z"
152+
"timestamp": "[..]T[..]Z",
153+
"unblocked": [
154+
1
155+
]
153156
},
154157
{
155158
"elapsed": "{...}",

0 commit comments

Comments
 (0)