adds metric tracking wasted data buffer in shreds (#25972)
This commit is contained in:
parent
a9c9acfe80
commit
31b3e0e15a
|
@ -23,6 +23,7 @@ pub struct ProcessShredsStats {
|
|||
num_residual_data_shreds: [usize; 4],
|
||||
// If the blockstore already has shreds for the broadcast slot.
|
||||
pub num_extant_slots: u64,
|
||||
pub(crate) data_buffer_residual: usize,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Eq, PartialEq)]
|
||||
|
@ -70,6 +71,7 @@ impl ProcessShredsStats {
|
|||
("sign_coding_time", self.sign_coding_elapsed, i64),
|
||||
("coding_send_time", self.coding_send_elapsed, i64),
|
||||
("num_extant_slots", self.num_extant_slots, i64),
|
||||
("data_buffer_residual", self.data_buffer_residual, i64),
|
||||
(
|
||||
"residual_data_shreds_08",
|
||||
self.num_residual_data_shreds[0],
|
||||
|
@ -137,6 +139,7 @@ impl AddAssign<ProcessShredsStats> for ProcessShredsStats {
|
|||
get_leader_schedule_elapsed,
|
||||
num_residual_data_shreds,
|
||||
num_extant_slots,
|
||||
data_buffer_residual,
|
||||
} = rhs;
|
||||
self.shredding_elapsed += shredding_elapsed;
|
||||
self.receive_elapsed += receive_elapsed;
|
||||
|
@ -147,6 +150,7 @@ impl AddAssign<ProcessShredsStats> for ProcessShredsStats {
|
|||
self.coding_send_elapsed += coding_send_elapsed;
|
||||
self.get_leader_schedule_elapsed += get_leader_schedule_elapsed;
|
||||
self.num_extant_slots += num_extant_slots;
|
||||
self.data_buffer_residual += data_buffer_residual;
|
||||
for (i, bucket) in self.num_residual_data_shreds.iter_mut().enumerate() {
|
||||
*bucket += num_residual_data_shreds[i];
|
||||
}
|
||||
|
|
|
@ -112,6 +112,8 @@ impl Shredder {
|
|||
|
||||
let mut gen_data_time = Measure::start("shred_gen_data_time");
|
||||
let data_buffer_size = ShredData::capacity(/*merkle_proof_size:*/ None).unwrap();
|
||||
process_stats.data_buffer_residual +=
|
||||
(data_buffer_size - serialized_shreds.len() % data_buffer_size) % data_buffer_size;
|
||||
// Integer division to ensure we have enough shreds to fit all the data
|
||||
let num_shreds = (serialized_shreds.len() + data_buffer_size - 1) / data_buffer_size;
|
||||
let last_shred_index = next_shred_index + num_shreds as u32 - 1;
|
||||
|
|
Loading…
Reference in New Issue