Commit 6c632b81 authored by Tobias Koppers's avatar Tobias Koppers

fixup

parent 6a2e6c25
...@@ -110,11 +110,19 @@ impl DynamicStorage { ...@@ -110,11 +110,19 @@ impl DynamicStorage {
} }
pub fn size(&self) -> usize { pub fn size(&self) -> usize {
self.map.iter().map(|m| m.size()).sum() self.map.iter().map(|m| m.size()).sum::<usize>()
+ self.map.len() * size_of::<CachedDataItemStorage>()
}
pub fn size_of_type(&self, ty: CachedDataItemType) -> usize {
self.get_map(ty)
.map(|m| m.size() + size_of::<CachedDataItemStorage>())
.unwrap_or_default()
} }
pub fn capacity_size(&self) -> usize { pub fn capacity_size(&self) -> usize {
self.map.iter().map(|m| m.capacity_size()).sum() self.map.iter().map(|m| m.capacity_size()).sum::<usize>()
+ self.map.capacity() * size_of::<CachedDataItemStorage>()
} }
pub fn iter( pub fn iter(
......
...@@ -827,18 +827,13 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> { ...@@ -827,18 +827,13 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
let size = self.storage.size(); let size = self.storage.size();
let capacity = self.storage.capacity_size(); let capacity = self.storage.capacity_size();
let tasks = self.storage.tasks(); let tasks = self.storage.tasks();
let storages_len = self.storage.storages_len();
let storages_capacity = self.storage.storages_capacity();
let data_len = self.storage.data_len(); let data_len = self.storage.data_len();
let data_capacity = self.storage.data_capacity(); let data_capacity = self.storage.data_capacity();
println!( println!(
"Storage size {}MiB, capactiy {}MiB, {} tasks\nStorages {}M, capacity {}M, Data \ "Storage size {}MiB, capactiy {}MiB, {} tasks\nData entries {}M, capacity {}M",
entries {}M, capacity {}M",
size / 1024 / 1024, size / 1024 / 1024,
capacity / 1024 / 1024, capacity / 1024 / 1024,
tasks, tasks,
storages_len / 1000 / 1000,
storages_capacity / 1000 / 1000,
data_len / 1000 / 1000, data_len / 1000 / 1000,
data_capacity / 1000 / 1000 data_capacity / 1000 / 1000
); );
......
...@@ -150,14 +150,6 @@ impl InnerStorage { ...@@ -150,14 +150,6 @@ impl InnerStorage {
+ self.output_dependent.len() + self.output_dependent.len()
} }
pub fn types(&self) -> usize {
self.map.len()
}
pub fn types_capacity(&self) -> usize {
self.map.capacity()
}
pub fn capacity(&self) -> usize { pub fn capacity(&self) -> usize {
use crate::data_storage::Storage; use crate::data_storage::Storage;
self.dynamic.capacity() self.dynamic.capacity()
...@@ -209,10 +201,18 @@ impl InnerStorage { ...@@ -209,10 +201,18 @@ impl InnerStorage {
} }
pub fn size_by_type(&self, sizes: &mut HashMap<CachedDataItemType, usize>) { pub fn size_by_type(&self, sizes: &mut HashMap<CachedDataItemType, usize>) {
for storage in self.map.iter() { use crate::data_storage::Storage;
*sizes.entry(storage.ty()).or_default() += for ty in self.dynamic.types() {
storage.size() + size_of::<CachedDataItemStorage>(); *sizes.entry(ty).or_default() += self.dynamic.size_of_type(ty);
} }
*sizes
.entry(CachedDataItemType::AggregationNumber)
.or_default() += self.aggregation_number.size();
*sizes.entry(CachedDataItemType::Output).or_default() += self.output.size();
*sizes.entry(CachedDataItemType::Upper).or_default() += self.upper.size();
*sizes
.entry(CachedDataItemType::OutputDependent)
.or_default() += self.output_dependent.size();
} }
pub fn persistance_state(&self) -> &PersistanceState { pub fn persistance_state(&self) -> &PersistanceState {
...@@ -594,26 +594,12 @@ impl Storage { ...@@ -594,26 +594,12 @@ impl Storage {
.sum::<usize>() .sum::<usize>()
} }
pub fn storages_len(&self) -> usize {
self.map
.iter()
.map(|key_value| key_value.value().types())
.sum::<usize>()
}
pub fn storages_capacity(&self) -> usize {
self.map
.iter()
.map(|key_value| key_value.value().types_capacity())
.sum::<usize>()
}
pub fn size(&self) -> usize { pub fn size(&self) -> usize {
self.map self.map
.iter() .iter()
.map(|key_value| key_value.value().size()) .map(|key_value| key_value.value().size())
.sum::<usize>() .sum::<usize>()
+ self.map.len() * size_of::<(TaskId, InnerStorage)>() + self.map.len() * size_of::<(TaskId, Box<InnerStorage>, InnerStorage)>()
} }
pub fn capacity_size(&self) -> usize { pub fn capacity_size(&self) -> usize {
...@@ -621,7 +607,7 @@ impl Storage { ...@@ -621,7 +607,7 @@ impl Storage {
.iter() .iter()
.map(|key_value| key_value.value().capacity_size()) .map(|key_value| key_value.value().capacity_size())
.sum::<usize>() .sum::<usize>()
+ self.map.capacity() * size_of::<(TaskId, InnerStorage)>() + self.map.capacity() * size_of::<(TaskId, Box<InnerStorage>, InnerStorage)>()
} }
pub fn tasks(&self) -> usize { pub fn tasks(&self) -> usize {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment