Skip to content

Commit 0f767ae

Browse files
committed
Clean up
1 parent e5d5cec commit 0f767ae

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

analyzeme/src/stack_collapse.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ mod test {
121121
b.interval("Query", "e2", 0, 3, 9, |b| {
122122
b.interval("Query", "e1", 0, 4, 8, |b| {
123123
b.interval("Query", "e3", 0, 5, 7, |_| {});
124+
b.integer("ArtifactSize", "e3", 0, 100);
124125
});
125126
});
126127

@@ -156,9 +157,12 @@ mod test {
156157

157158
b.interval("Query", "e1", 1, 1, 2, |_| {});
158159
b.interval("Query", "e1", 1, 3, 4, |_| {});
159-
b.interval("Query", "e1", 2, 1, 2, |_| {});
160+
b.interval("Query", "e1", 2, 1, 2, |b| {
161+
b.instant("Instant", "e4", 2, 100);
162+
});
160163
b.interval("Query", "e2", 2, 2, 5, |b| {
161164
b.interval("Query", "e3", 2, 3, 4, |_| {});
165+
b.integer("ArtifactSize", "e4", 2, 1);
162166
});
163167

164168
let profiling_data = b.into_profiling_data();

summarize/src/diff.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ pub fn calculate_diff(base: Results, change: Results) -> DiffResults {
8080

8181
match (b, c) {
8282
(Some(b), Some(c)) => c.clone() - b.clone(),
83-
(Some(_b), None) => todo!(),
84-
(None, Some(_c)) => todo!(),
83+
(Some(b), None) => b.invert(),
84+
(None, Some(c)) => c.as_artifact_size_diff(),
8585
(None, None) => unreachable!(),
8686
}
8787
})

summarize/src/query_data.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@ impl ArtifactSize {
147147
pub fn new(label: String, value: u64) -> Self {
148148
Self { label, value }
149149
}
150+
151+
pub fn invert(&self) -> ArtifactSizeDiff {
152+
ArtifactSizeDiff {
153+
label: self.label.clone(),
154+
size_change: -(self.value as i64),
155+
}
156+
}
157+
158+
pub fn as_artifact_size_diff(&self) -> ArtifactSizeDiff {
159+
ArtifactSizeDiff {
160+
label: self.label.clone(),
161+
size_change: self.value as i64,
162+
}
163+
}
150164
}
151165

152166
#[derive(Serialize, Deserialize, Debug)]

0 commit comments

Comments
 (0)