pub fn iteration(&mut self, path: String) {
        trace!("path: {}", path);
        self.topology.refresh();
        let topo_uj_diff = self.topology.get_records_diff();
        let topo_stat_diff = self.topology.get_stats_diff();
        if let Some(topo_rec_uj) = topo_uj_diff {
            debug!("Got topo uj diff: {:?}", topo_rec_uj);
            let proc_tracker = self.topology.get_proc_tracker();
            let processes = proc_tracker.get_alive_processes();
            let qemu_processes = QemuExporter::filter_qemu_vm_processes(&processes);
            debug!(
                "Number of filtered qemu processes: {}",
                qemu_processes.len()
            );
            for qp in qemu_processes {
                info!("Working on {:?}", qp);
                if qp.len() > 2 {
                    let last = qp.first().unwrap();
                    let previous = qp.get(1).unwrap();
                    let vm_name =
                        QemuExporter::get_vm_name_from_cmdline(&last.process.cmdline().unwrap());
                    let time_pdiff = last.total_time_jiffies() - previous.total_time_jiffies();
                    if let Some(time_tdiff) = &topo_stat_diff {
                        let first_domain_path = format!("{}/{}/intel-rapl:0:0", path, vm_name);
                        if fs::read_dir(&first_domain_path).is_err() {
                            match fs::create_dir_all(&first_domain_path) {
                                Ok(_) => info!("Created {} folder.", &path),
                                Err(error) => panic!("Couldn't create {}. Got: {}", &path, error),
                            }
                        }
                        let tdiff = time_tdiff.total_time_jiffies()
                            * procfs::ticks_per_second().unwrap() as f32;
                        trace!("Time_pdiff={} time_tdiff={}", time_pdiff.to_string(), tdiff);
                        let ratio = time_pdiff as f32 / tdiff;
                        trace!("Ratio is {}", ratio.to_string());
                        let uj_to_add = ratio * topo_rec_uj.value.parse::<f32>().unwrap();
                        trace!("Adding {} uJ", uj_to_add);
                        let complete_path = format!("{}/{}/intel-rapl:0", path, vm_name);
                        if let Ok(result) =
                            QemuExporter::add_or_create(&complete_path, uj_to_add as u64)
                        {
                            trace!("{:?}", result);
                            debug!("Updated {}", complete_path);
                        }
                    }
                }
            }
        }
    }
/// Performs processing of metrics, using self.topology
Performs processing of metrics, using self.topology
Performs processing of metrics using self . topology
pub fn iteration(&mut self, path: String) {
        trace!("path: {}", path);
        self.topology.refresh();
        let topo_uj_diff = self.topology.get_records_diff();
        let topo_stat_diff = self.topology.get_stats_diff();
        if let Some(topo_rec_uj) = topo_uj_diff {
            debug!("Got topo uj diff: {:?}", topo_rec_uj);
            let proc_tracker = self.topology.get_proc_tracker();
            let processes = proc_tracker.get_alive_processes();
            let qemu_processes = QemuExporter::filter_qemu_vm_processes(&processes);
            debug!(
                "Number of filtered qemu processes: {}",
                qemu_processes.len()
            );
            for qp in qemu_processes {
                info!("Working on {:?}", qp);
                if qp.len() > 2 {
                    let last = qp.first().unwrap();
                    let previous = qp.get(1).unwrap();
                    let vm_name =
                        QemuExporter::get_vm_name_from_cmdline(&last.process.cmdline().unwrap());
                    let time_pdiff = last.total_time_jiffies() - previous.total_time_jiffies();
                    if let Some(time_tdiff) = &topo_stat_diff {
                        let first_domain_path = format!("{}/{}/intel-rapl:0:0", path, vm_name);
                        if fs::read_dir(&first_domain_path).is_err() {
                            match fs::create_dir_all(&first_domain_path) {
                                Ok(_) => info!("Created {} folder.", &path),
                                Err(error) => panic!("Couldn't create {}. Got: {}", &path, error),
                            }
                        }
                        let tdiff = time_tdiff.total_time_jiffies()
                            * procfs::ticks_per_second().unwrap() as f32;
                        trace!("Time_pdiff={} time_tdiff={}", time_pdiff.to_string(), tdiff);
                        let ratio = time_pdiff as f32 / tdiff;
                        trace!("Ratio is {}", ratio.to_string());
                        let uj_to_add = ratio * topo_rec_uj.value.parse::<f32>().unwrap();
                        trace!("Adding {} uJ", uj_to_add);
                        let complete_path = format!("{}/{}/intel-rapl:0", path, vm_name);
                        if let Ok(result) =
                            QemuExporter::add_or_create(&complete_path, uj_to_add as u64)
                        {
                            trace!("{:?}", result);
                            debug!("Updated {}", complete_path);
                        }
                    }
                }
            }
        }
    }
pub fn iteration ( & mut self , path : String ) { trace ! ( " " path ) ; self . topology . refresh ( ) ; let topo_uj_diff = self . topology . get_records_diff ( ) ; let topo_stat_diff = self . topology . get_stats_diff ( ) ; if let Some ( topo_rec_uj ) = topo_uj_diff { debug ! ( " " topo_rec_uj ) ; let proc_tracker = self . topology . get_proc_tracker ( ) ; let processes = proc_tracker . get_alive_processes ( ) ; let qemu_processes = QemuExporter :: filter_qemu_vm_processes ( & processes ) ; debug ! ( " " qemu_processes len ( ) ) ; for qp in qemu_processes { info ! ( " " qp ) ; if qp . len ( ) > 2 { let last = qp . first ( ) . unwrap ( ) ; let previous = qp . get ( 1 ) . unwrap ( ) ; let vm_name = QemuExporter :: get_vm_name_from_cmdline ( & last . process . cmdline ( ) . unwrap ( ) ) ; let time_pdiff = last . total_time_jiffies ( ) - previous . total_time_jiffies ( ) ; if let Some ( time_tdiff ) = & topo_stat_diff { let first_domain_path = format ! ( " " path vm_name ) ; if fs :: read_dir ( & first_domain_path ) . is_err ( ) { match fs :: create_dir_all ( & first_domain_path ) { Ok ( _ ) => info ! ( " " path ) , Err ( error ) => panic ! ( " " path error ) , } } let tdiff = time_tdiff . total_time_jiffies ( ) * procfs :: ticks_per_second ( ) . unwrap ( ) as f32 ; trace ! ( " " time_pdiff to_string ( ) tdiff ) ; let ratio = time_pdiff as f32 / tdiff ; trace ! ( " " ratio to_string ( ) ) ; let uj_to_add = ratio * topo_rec_uj . value . parse :: < f32 > ( ) . unwrap ( ) ; trace ! ( " " uj_to_add ) ; let complete_path = format ! ( " " path vm_name ) ; if let Ok ( result ) = QemuExporter :: add_or_create ( & complete_path , uj_to_add as u64 ) { trace ! ( " " result ) ; debug ! ( " " complete_path ) ; } } } } } }
Performs processing of metrics, using self.topology
Performs processing of metrics using self . topology
&mut self
path
String
&mut self
path
String