Commit aa8ceee1 authored by Marco Perronet's avatar Marco Perronet
Browse files

Fix imports and cleanup warnings

parent de9a75e7
[package]
name = "main"
name = "rbf-trace"
version = "0.1.0"
authors = ["perronet <perronet.marco@gmail.com>"]
authors = ["perronet <perronet@mpi-sws.org>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
......
......@@ -71,12 +71,18 @@ mod testing {
use std::process;
use std::thread;
use std::sync::mpsc::channel;
//use crate::sync::*;
//use crate::util::export;
//use crate::args::Opt;
use structopt::StructOpt;
use cpu_time::ThreadTime;
use rbf_trace::{sync::{EventUpdate, ModelUpdate},
feature_detection,
util::export,
args::Opt,
params,
real_time,
rbftrace,
};
fn main() {
let sys_conf: feature_detection::features::SysConf;
let wc_start = std::time::Instant::now(); // Wall-clock time
......
use crate::util::helpers::*;
use crate::events_generation::evg::*;
use crate::feature_detection::system::*;
use crate::feature_detection::features::*;
use std::fs;
use std::fs::File;
use std::io::Write;
use std::io::{prelude::*, BufReader};
use std::str::FromStr;
use std::string::String;
use psutil::process::pid_exists;
/* C bindings */
......@@ -17,7 +10,6 @@ use crate::events_generation::wrappers;
pub struct FTraceEVG {
target_pids: Vec<Pid>,
rt_pids: Vec<Pid>,
target_pids_are_dead: bool,
exit_cnt: u64,
processed_events: u64, // Only useful events
processed_events_all: u64,
......@@ -143,7 +135,6 @@ impl FTraceEVG {
FTraceEVG {
target_pids: target_pids.clone(),
rt_pids: rt_pids.clone(),
target_pids_are_dead: false,
exit_cnt: 0,
processed_events: 0,
processed_events_all: 0,
......@@ -183,9 +174,9 @@ impl FTraceEVG {
None
}
fn flush_stream(&mut self) {
while wrappers::read_stream_raw(self.recorders, self.cpu_cnt).is_some() { }
}
// fn flush_stream(&mut self) {
// while wrappers::read_stream_raw(self.recorders, self.cpu_cnt).is_some() { }
// }
fn disable_tracing_stop_recorders(&mut self) {
wrappers::stop_tracing(self.tracefs);
......@@ -223,7 +214,7 @@ impl FTraceEVG {
TraceEventTypeRaw::Switch => {
let prev_pid = raw_event.pid as u32;
let next_pid = raw_event.next_pid as u32;
let mut event_type: TraceEventType;
let event_type: TraceEventType;
// Either Preemption or Deactivation
if is_preemption(raw_event) {
......@@ -285,10 +276,6 @@ fn is_preemption(raw_event: &bindings::rbftrace_event_raw) -> bool {
return raw_event.prev_state == 0 || raw_event.prev_state == 256;
}
fn is_deactivation(raw_event: &bindings::rbftrace_event_raw) -> bool {
return !is_preemption(raw_event);
}
/* Cleanup on ctrl+C */
// TODO this is very ugly, but rust won't let the use the EVG instance because of the presence of raw pointers
fn sigint_handle() {
......
pub mod bindings;
pub mod dummy;
pub mod evg;
pub mod ftrace;
pub mod replay;
pub mod wrappers;
\ No newline at end of file
pub mod wrappers;
// This is useful because of c conventions
#[allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
pub mod bindings;
\ No newline at end of file
use crate::util::helpers::*;
use crate::events_generation::evg::*;
use std::fs;
......
use std::collections::HashMap;
use std::sync::mpsc::*;
use std::time::{Instant};
use crate::sync::*;
use crate::util::helpers::*;
......
......@@ -7,8 +7,8 @@ use crate::feature_detection::features::*;
use crate::util::helpers::*;
const CGROUP_PATH_CPU: &str = "/sys/fs/cgroup/cpu"; // Cpu controller of cgroup v1
const CGROUPV2_PATH: &str = "/sys/fs/cgroup/unified"; // Unified hierarchy with all controllers (cgroup v2)
const CPUSET_PATH: &str = "/sys/fs/cgroup/cpuset";
// const CGROUPV2_PATH: &str = "/sys/fs/cgroup/unified"; // Unified hierarchy with all controllers (cgroup v2)
// const CPUSET_PATH: &str = "/sys/fs/cgroup/cpuset";
pub fn get_cpu_topology() -> Vec<Core> {
let to_parse = run_cmd("lscpu -p=core,cpu | sed '1,4d' | sort".to_string());
......
......@@ -32,11 +32,11 @@ fn rbf_trace(evg: &mut dyn EventsGenerator, target_pids: &Vec<Pid>, tx_evp: Send
crate::util::profile::stop();
}
fn run_dummy(tx_evp: Sender<EventUpdate>, sys_conf: &SysConf) {
// fn run_dummy(tx_evp: Sender<EventUpdate>, sys_conf: &SysConf) {
// let mut evg = events_generation::dummy::DummyEVG::new();
// rbf_trace(&mut evg, &sys_conf.target_pids, tx_evp);
}
// }
fn run_replay(tx_evp: Sender<EventUpdate>, sys_conf: &SysConf) {
let mut evg = events_generation::replay::ReplayEVG::from_file(&crate::params::replay_file().unwrap());
......
......@@ -6,7 +6,6 @@ use crate::real_time::arrival::*;
use crate::real_time::rbf_curve::*;
use crate::real_time::arrival_sequence::*;
use crate::util::helpers::*;
use crate::util::export::*;
use crate::testing::unit_test_matching::*;
use crate::sync::*;
......@@ -27,10 +26,6 @@ pub fn matching_loop(rx_matcher: Receiver<EventUpdate>, tx_matcher: Sender<Model
/* Period intervals to choose the period from */
let mut t_intervals: HashMap<Pid, PeriodRange> = HashMap::new();
/* Debug */
let mut period_convergence: Vec<Duration> = Vec::new();
let mut jitter_convergence: Vec<Duration> = Vec::new();
if crate::params::unit_test_matcher() {
unit_test_matching();
}
......@@ -92,13 +87,6 @@ pub fn matching_loop(rx_matcher: Receiver<EventUpdate>, tx_matcher: Sender<Model
/* Not enough observations to match a model */
*chosen_model_of_pid = Model::NoMatch;
}
/* Debug */
// if models_of_pid.pjitter.is_some() {
// let (p, j, _c, _o) = match models_of_pid.pjitter.unwrap() { Model::PJitterOffset(p, j, c, o) => (p, j, c, o), _ => panic!()};
// period_convergence.push(p);
// jitter_convergence.push(j);
// }
}
/* Send update with matched models and rbfs */
......@@ -115,7 +103,6 @@ pub fn matching_loop(rx_matcher: Receiver<EventUpdate>, tx_matcher: Sender<Model
eprintln!("MATCH: Tracing thread has stopped (on err msg)"); break;
}
}
// show_result(&period_convergence, &jitter_convergence);
}
pub fn match_sporadic(models: &mut HashMap<Pid, MatchedModels>, arrival_seqs: &HashMap<Pid, ArrivalSequence>, rbfs: &HashMap<Pid, RbfCurve>) {
......@@ -435,11 +422,6 @@ fn disambiguate_models(models: &MatchedModels) -> Model {
/**********************************************************/
fn show_result(period_convergence: &Vec<Duration>, jitter_convergence: &Vec<Duration>) {
export_values(&"convergence".to_string(), period_convergence, 0, &"period".to_string());
export_values(&"convergence".to_string(), jitter_convergence, 1, &"jitter".to_string());
}
/* Used in hyperperiod minimization */
#[derive(Debug)]
......
use crate::real_time::arrival::*;
use crate::util::helpers::*;
use crate::feature_detection::system::*;
use crate::real_time::sparse_map::*;
use std::collections::VecDeque;
use std::collections::BTreeMap;
use itertools::merge;
/* The "curve" map maps distance to total cost.
It answers the question: What is the minimum distance to observe AT MOST a total cost of c?
......@@ -77,7 +74,7 @@ impl RbfCurve {
// Add the point with the lowest delta
while let (Some(p_1), Some(p_2)) = (point_1, point_2) {
if p_1.delta == p_2.delta {
let res = self.curve.insert(Point::new(p_1.delta, p_1.cost + p_2.cost));
let _ = self.curve.insert(Point::new(p_1.delta, p_1.cost + p_2.cost));
last_cost_1 = p_1.cost + p_2.cost;
last_cost_2 = p_1.cost + p_2.cost;
......
use crate::real_time::rbf_curve::*;
use crate::util::helpers::*;
use crate::feature_detection::system::*;
/* This curve represents how long it takes in the worst case to receive a certain amount of service. */
#[derive(Debug, Clone)]
......
......@@ -154,7 +154,7 @@ impl SparseMap {
count : 0,
};
for i in 0..capacity {
for _ in 0..capacity {
map.buckets.push(<LinkedList<Point>>::new());
}
......
pub mod unit_test_analysis;
pub mod unit_test_matching;
......@@ -35,7 +35,7 @@ pub fn ns_to_s(s: Time) -> f32 {
}
pub fn get_check_target_pids() -> Vec<Pid> {
let mut target_pids: Vec<Pid> = crate::params::target_pids();
let target_pids: Vec<Pid> = crate::params::target_pids();
let rt_pids = get_rt_pids();
if target_pids.is_empty() {
......
......@@ -7,7 +7,7 @@ const PROFILE_FILE : &'static str = "../testing/profiling/tracer.profile";
pub fn start() {
eprintln!("Profiler started");
let res = fs::create_dir_all(PROFILE_FOLDER);
let _ = fs::create_dir_all(PROFILE_FOLDER);
PROFILER.lock().unwrap().start(PROFILE_FILE).expect("Profiler error: couldn't start.");
}
......
use crate::events_generation::evg::*;
use crate::util::helpers::*;
use std::fs;
pub struct TraceLogger {
......
Supports Markdown
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