Skip to content

Store artifact sizes into the database #1348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion collector/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,11 @@ impl<'a> Processor for BenchProcessor<'a> {
output: process::Output,
) -> anyhow::Result<Retry> {
match process_stat_output(output) {
Ok(res) => {
Ok(mut res) => {
if let Some(ref profile) = res.1 {
store_artifact_sizes_into_stats(&mut res.0, profile);
}

match data.scenario {
Scenario::Full => {
self.insert_stats(database::Scenario::Empty, data.profile, res);
Expand Down Expand Up @@ -881,6 +885,14 @@ impl<'a> Processor for BenchProcessor<'a> {
}
}

fn store_artifact_sizes_into_stats(stats: &mut Stats, profile: &SelfProfile) {
for artifact in profile.artifact_sizes.iter() {
stats
.stats
.insert(format!("size:{}", artifact.label), artifact.size as f64);
}
}

pub struct ProfileProcessor<'a> {
profiler: Profiler,
output_dir: &'a Path,
Expand Down Expand Up @@ -1709,6 +1721,14 @@ impl Patch {
#[derive(serde::Deserialize, Clone)]
pub struct SelfProfile {
pub query_data: Vec<QueryData>,
pub artifact_sizes: Vec<ArtifactSize>,
}

#[derive(serde::Deserialize, Clone)]
pub struct ArtifactSize {
pub label: QueryLabel,
#[serde(rename = "value")]
pub size: u64,
}

#[derive(serde::Deserialize, Clone)]
Expand Down
18 changes: 18 additions & 0 deletions site/src/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,18 @@ pub enum Metric {
TaskClockUser,
#[serde(rename = "wall-time")]
WallTime,
#[serde(rename = "size:codegen_unit_size_estimate")]
CodegenUnitSize,
#[serde(rename = "size:dep_graph")]
DepGraphSize,
#[serde(rename = "size:linked_artifact")]
LinkedArtifactSize,
#[serde(rename = "size:object_file")]
ObjectFileSize,
#[serde(rename = "size:query_cache")]
QueryCacheSize,
#[serde(rename = "size:work_product_index")]
WorkProductIndexSize,
}

impl Metric {
Expand All @@ -222,6 +234,12 @@ impl Metric {
Metric::TaskClock => "task-clock",
Metric::TaskClockUser => "task-clock:u",
Metric::WallTime => "wall-time",
Metric::CodegenUnitSize => "size:codegen_unit_size_estimate",
Metric::DepGraphSize => "size:dep_graph",
Metric::LinkedArtifactSize => "size:linked_artifact",
Metric::ObjectFileSize => "size:object_file",
Metric::QueryCacheSize => "size:query_cache",
Metric::WorkProductIndexSize => "size:work_product_index",
}
}

Expand Down