add dump_stats so we can see pmmr sizes after compaction (#785)
* add dump_stats so we can see pmmr sizes after compaction * rustfmt * fix tests with dump_stats()
This commit is contained in:
@@ -622,6 +622,8 @@ impl<'a> Extension<'a> {
|
||||
pub fn dump_output_pmmr(&self) {
|
||||
debug!(LOGGER, "-- outputs --");
|
||||
self.output_pmmr.dump_from_file(false);
|
||||
debug!(LOGGER, "--");
|
||||
self.output_pmmr.dump_stats();
|
||||
debug!(LOGGER, "-- end of outputs --");
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,9 @@ where
|
||||
/// sit well with the design, but TxKernels have to be summed and the
|
||||
/// fastest way to to be able to allow direct access to the file
|
||||
fn get_data_file_path(&self) -> String;
|
||||
|
||||
/// For debugging purposes so we can see how compaction is doing.
|
||||
fn dump_stats(&self);
|
||||
}
|
||||
|
||||
/// A Merkle proof.
|
||||
@@ -566,6 +569,11 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dump_stats(&self) {
|
||||
debug!(LOGGER, "pmmr: unpruned - {}", self.unpruned_size());
|
||||
self.backend.dump_stats();
|
||||
}
|
||||
|
||||
/// Debugging utility to print information about the MMRs. Short version
|
||||
/// only prints the last 8 nodes.
|
||||
/// Looks in the underlying hash file and so ignores the remove log.
|
||||
@@ -1034,6 +1042,8 @@ mod test {
|
||||
fn get_data_file_path(&self) -> String {
|
||||
"".to_string()
|
||||
}
|
||||
|
||||
fn dump_stats(&self) {}
|
||||
}
|
||||
|
||||
impl<T> VecBackend<T>
|
||||
|
||||
+11
-1
@@ -97,7 +97,7 @@ where
|
||||
|
||||
impl<T> Backend<T> for PMMRBackend<T>
|
||||
where
|
||||
T: PMMRable,
|
||||
T: PMMRable + ::std::fmt::Debug,
|
||||
{
|
||||
/// Append the provided Hashes to the backend storage.
|
||||
#[allow(unused_variables)]
|
||||
@@ -210,6 +210,16 @@ where
|
||||
fn get_data_file_path(&self) -> String {
|
||||
self.data_file.path()
|
||||
}
|
||||
|
||||
fn dump_stats(&self) {
|
||||
debug!(
|
||||
LOGGER,
|
||||
"pmmr backend: unpruned - {}, hashes - {}, data - {}",
|
||||
self.unpruned_size().unwrap_or(0),
|
||||
self.hash_size().unwrap_or(0),
|
||||
self.data_size().unwrap_or(0)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> PMMRBackend<T>
|
||||
|
||||
Reference in New Issue
Block a user