Rollup merge of #110442 - ferrocene:pa-build-metrics-dry-run, r=ozkanonur
Avoid including dry run steps in the build metrics Including steps executed during the dry run will result in a duplication of all the steps in the build metrics, which just adds noise.
This commit is contained in:
commit
1e3a38438a
@ -2030,7 +2030,7 @@ pub fn ensure<S: Step>(&'a self, step: S) -> S::Output {
|
||||
}
|
||||
|
||||
#[cfg(feature = "build-metrics")]
|
||||
self.metrics.enter_step(&step);
|
||||
self.metrics.enter_step(&step, self);
|
||||
|
||||
let (out, dur) = {
|
||||
let start = Instant::now();
|
||||
@ -2056,7 +2056,7 @@ pub fn ensure<S: Step>(&'a self, step: S) -> S::Output {
|
||||
}
|
||||
|
||||
#[cfg(feature = "build-metrics")]
|
||||
self.metrics.exit_step();
|
||||
self.metrics.exit_step(self);
|
||||
|
||||
{
|
||||
let mut stack = self.stack.borrow_mut();
|
||||
|
@ -4,7 +4,7 @@
|
||||
//! As this module requires additional dependencies not present during local builds, it's cfg'd
|
||||
//! away whenever the `build.metrics` config option is not set to `true`.
|
||||
|
||||
use crate::builder::Step;
|
||||
use crate::builder::{Builder, Step};
|
||||
use crate::util::t;
|
||||
use crate::Build;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
@ -33,7 +33,12 @@ pub(crate) fn init() -> Self {
|
||||
BuildMetrics { state }
|
||||
}
|
||||
|
||||
pub(crate) fn enter_step<S: Step>(&self, step: &S) {
|
||||
pub(crate) fn enter_step<S: Step>(&self, step: &S, builder: &Builder<'_>) {
|
||||
// Do not record dry runs, as they'd be duplicates of the actual steps.
|
||||
if builder.config.dry_run() {
|
||||
return;
|
||||
}
|
||||
|
||||
let mut state = self.state.borrow_mut();
|
||||
|
||||
// Consider all the stats gathered so far as the parent's.
|
||||
@ -56,7 +61,12 @@ pub(crate) fn enter_step<S: Step>(&self, step: &S) {
|
||||
});
|
||||
}
|
||||
|
||||
pub(crate) fn exit_step(&self) {
|
||||
pub(crate) fn exit_step(&self, builder: &Builder<'_>) {
|
||||
// Do not record dry runs, as they'd be duplicates of the actual steps.
|
||||
if builder.config.dry_run() {
|
||||
return;
|
||||
}
|
||||
|
||||
let mut state = self.state.borrow_mut();
|
||||
|
||||
self.collect_stats(&mut *state);
|
||||
@ -74,7 +84,12 @@ pub(crate) fn exit_step(&self) {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn record_test(&self, name: &str, outcome: TestOutcome) {
|
||||
pub(crate) fn record_test(&self, name: &str, outcome: TestOutcome, builder: &Builder<'_>) {
|
||||
// Do not record dry runs, as they'd be duplicates of the actual steps.
|
||||
if builder.config.dry_run() {
|
||||
return;
|
||||
}
|
||||
|
||||
let mut state = self.state.borrow_mut();
|
||||
state
|
||||
.running_steps
|
||||
|
@ -124,6 +124,7 @@ fn render_test_outcome(&mut self, outcome: Outcome<'_>, test: &TestOutcome) {
|
||||
ignore_reason: reason.map(|s| s.to_string()),
|
||||
},
|
||||
},
|
||||
self.builder,
|
||||
);
|
||||
|
||||
if self.builder.config.verbose_tests {
|
||||
|
Loading…
Reference in New Issue
Block a user