fn clean_old_stats(&mut self) {
        let stat_ptr = &self.stat_buffer[0];
        let size_of_stat = size_of_val(stat_ptr);
        let curr_size = size_of_stat * self.stat_buffer.len();
        trace!("current_size of stats in topo: {}", curr_size);
        if curr_size > (self.buffer_max_kbytes * 1000) as usize {
            let size_diff = curr_size - (self.buffer_max_kbytes * 1000) as usize;
            if size_diff > size_of_stat {
                let nb_stats_to_delete = size_diff as f32 / size_of_stat as f32;
                trace!(
                    "nb_stats_to_delete: {} size_diff: {} size of: {}",
                    nb_stats_to_delete,
                    size_diff,
                    size_of_stat
                );
                for _ in 1..nb_stats_to_delete as u32 {
                    if !self.stat_buffer.is_empty() {
                        let res = self.stat_buffer.pop();
                        debug!("Cleaning topology stat buffer, removing: {:?}", res);
                    }
                }
            }
        }
    }
/// Checks the size in memory of stats_buffer and deletes as many CPUStat
/// instances from the buffer to make it smaller in memory than buffer_max_kbytes.
Checks the size in memory of stats_buffer and deletes as many CPUStat
instances from the buffer to make it smaller in memory than buffer_max_kbytes.
Checks the size in memory of stats_buffer and deletes as many CPUStat instances from the buffer to make it smaller in memory than buffer_max_kbytes .
fn clean_old_stats(&mut self) {
        let stat_ptr = &self.stat_buffer[0];
        let size_of_stat = size_of_val(stat_ptr);
        let curr_size = size_of_stat * self.stat_buffer.len();
        trace!("current_size of stats in topo: {}", curr_size);
        if curr_size > (self.buffer_max_kbytes * 1000) as usize {
            let size_diff = curr_size - (self.buffer_max_kbytes * 1000) as usize;
            if size_diff > size_of_stat {
                let nb_stats_to_delete = size_diff as f32 / size_of_stat as f32;
                trace!(
                    "nb_stats_to_delete: {} size_diff: {} size of: {}",
                    nb_stats_to_delete,
                    size_diff,
                    size_of_stat
                );
                for _ in 1..nb_stats_to_delete as u32 {
                    if !self.stat_buffer.is_empty() {
                        let res = self.stat_buffer.pop();
                        debug!("Cleaning topology stat buffer, removing: {:?}", res);
                    }
                }
            }
        }
    }
fn clean_old_stats ( & mut self ) { let stat_ptr = & self . stat_buffer [ 0 ] ; let size_of_stat = size_of_val ( stat_ptr ) ; let curr_size = size_of_stat * self . stat_buffer . len ( ) ; trace ! ( " " curr_size ) ; if curr_size > ( self . buffer_max_kbytes * 1000 ) as usize { let size_diff = curr_size - ( self . buffer_max_kbytes * 1000 ) as usize ; if size_diff > size_of_stat { let nb_stats_to_delete = size_diff as f32 / size_of_stat as f32 ; trace ! ( " " nb_stats_to_delete size_diff size_of_stat ) ; for _ in 1 .. nb_stats_to_delete as u32 { if ! self . stat_buffer . is_empty ( ) { let res = self . stat_buffer . pop ( ) ; debug ! ( " " res ) ; } } } } }
Checks the size in memory of stats_buffer and deletes as many CPUStat
instances from the buffer to make it smaller in memory than buffer_max_kbytes.
Checks the size in memory of stats_buffer and deletes as many CPUStat instances from the buffer to make it smaller in memory than buffer_max_kbytes .
&mut self
&mut self