Skip to content

Commit 6c653ff

Browse files
Merge pull request #1348 from rust-lang/artifact-sizes
Store artifact sizes into the database
2 parents f3acd04 + 21ac4f2 commit 6c653ff

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

collector/src/execute.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,11 @@ impl<'a> Processor for BenchProcessor<'a> {
839839
output: process::Output,
840840
) -> anyhow::Result<Retry> {
841841
match process_stat_output(output) {
842-
Ok(res) => {
842+
Ok(mut res) => {
843+
if let Some(ref profile) = res.1 {
844+
store_artifact_sizes_into_stats(&mut res.0, profile);
845+
}
846+
843847
match data.scenario {
844848
Scenario::Full => {
845849
self.insert_stats(database::Scenario::Empty, data.profile, res);
@@ -885,6 +889,14 @@ impl<'a> Processor for BenchProcessor<'a> {
885889
}
886890
}
887891

892+
fn store_artifact_sizes_into_stats(stats: &mut Stats, profile: &SelfProfile) {
893+
for artifact in profile.artifact_sizes.iter() {
894+
stats
895+
.stats
896+
.insert(format!("size:{}", artifact.label), artifact.size as f64);
897+
}
898+
}
899+
888900
pub struct ProfileProcessor<'a> {
889901
profiler: Profiler,
890902
output_dir: &'a Path,
@@ -1713,6 +1725,14 @@ impl Patch {
17131725
#[derive(serde::Deserialize, Clone)]
17141726
pub struct SelfProfile {
17151727
pub query_data: Vec<QueryData>,
1728+
pub artifact_sizes: Vec<ArtifactSize>,
1729+
}
1730+
1731+
#[derive(serde::Deserialize, Clone)]
1732+
pub struct ArtifactSize {
1733+
pub label: QueryLabel,
1734+
#[serde(rename = "value")]
1735+
pub size: u64,
17161736
}
17171737

17181738
#[derive(serde::Deserialize, Clone)]

site/src/comparison.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,18 @@ pub enum Metric {
206206
TaskClockUser,
207207
#[serde(rename = "wall-time")]
208208
WallTime,
209+
#[serde(rename = "size:codegen_unit_size_estimate")]
210+
CodegenUnitSize,
211+
#[serde(rename = "size:dep_graph")]
212+
DepGraphSize,
213+
#[serde(rename = "size:linked_artifact")]
214+
LinkedArtifactSize,
215+
#[serde(rename = "size:object_file")]
216+
ObjectFileSize,
217+
#[serde(rename = "size:query_cache")]
218+
QueryCacheSize,
219+
#[serde(rename = "size:work_product_index")]
220+
WorkProductIndexSize,
209221
}
210222

211223
impl Metric {
@@ -222,6 +234,12 @@ impl Metric {
222234
Metric::TaskClock => "task-clock",
223235
Metric::TaskClockUser => "task-clock:u",
224236
Metric::WallTime => "wall-time",
237+
Metric::CodegenUnitSize => "size:codegen_unit_size_estimate",
238+
Metric::DepGraphSize => "size:dep_graph",
239+
Metric::LinkedArtifactSize => "size:linked_artifact",
240+
Metric::ObjectFileSize => "size:object_file",
241+
Metric::QueryCacheSize => "size:query_cache",
242+
Metric::WorkProductIndexSize => "size:work_product_index",
225243
}
226244
}
227245

0 commit comments

Comments
 (0)