Skip to content

Commit 7e66902

Browse files
stepanchegfacebook-github-bot
authored andcommitted
Default for AggregateHeapProfileInfo
Summary: Empty. Can be used in smoke tests. Reviewed By: milend Differential Revision: D38647316 fbshipit-source-id: 2b6c1b6e1c9fa2560c19a9b8f7cffd260cabc8ab
1 parent 5c76acf commit 7e66902

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

starlark/src/values/layout/heap/profile/aggregated.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl<'v> ArenaVisitor<'v> for StackCollector {
196196
}
197197

198198
/// Aggregated stack frame data.
199-
#[derive(Clone)]
199+
#[derive(Clone, Default)]
200200
pub(crate) struct StackFrame {
201201
/// Aggregated callees.
202202
pub(crate) callees: SmallMap<StringId, StackFrame>,
@@ -310,6 +310,22 @@ impl Debug for AggregateHeapProfileInfo {
310310
}
311311
}
312312

313+
impl Default for AggregateHeapProfileInfo {
314+
fn default() -> AggregateHeapProfileInfo {
315+
let mut strings = StringIndex::default();
316+
let totals_id = strings.index(AggregateHeapProfileInfo::TOTALS_STR);
317+
let root_id = strings.index(AggregateHeapProfileInfo::ROOT_STR);
318+
let blank_id = strings.index(AggregateHeapProfileInfo::BLANK_STR);
319+
AggregateHeapProfileInfo {
320+
root: StackFrame::default(),
321+
strings,
322+
totals_id,
323+
root_id,
324+
blank_id,
325+
}
326+
}
327+
}
328+
313329
impl AggregateHeapProfileInfo {
314330
const TOTALS_STR: &'static str = "TOTALS";
315331
const ROOT_STR: &'static str = "(root)";

0 commit comments

Comments
 (0)