Fix graph output formatting
This commit is contained in:
parent
beee8d8cb7
commit
3817892ff1
@ -45,6 +45,7 @@ use crate::{
|
|||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use csv::Reader;
|
use csv::Reader;
|
||||||
|
use petgraph::dot::{Dot, Config};
|
||||||
|
|
||||||
// Constants ================================================================================
|
// Constants ================================================================================
|
||||||
|
|
||||||
@ -194,8 +195,10 @@ macro_rules! do_dump_graph {
|
|||||||
let dump_path = $cli.dump_name.clone().unwrap().with_extension(if $c=="" {"graph"} else {$c});
|
let dump_path = $cli.dump_name.clone().unwrap().with_extension(if $c=="" {"graph"} else {$c});
|
||||||
println!("Dumping graph to {:?}", &dump_path);
|
println!("Dumping graph to {:?}", &dump_path);
|
||||||
if let Some(md) = $state.named_metadata_map_mut().get_mut::<SysGraphFeedbackState>("SysMap") {
|
if let Some(md) = $state.named_metadata_map_mut().get_mut::<SysGraphFeedbackState>("SysMap") {
|
||||||
let out = md.graph.map(|i,x| x.pretty_print(), |_,_| ());
|
let out = md.graph.map(|i,x| x.pretty_print(), |_,_| "");
|
||||||
fs::write(dump_path,ron::to_string(&out).expect("Failed to serialize graph")).expect("Failed to write graph");
|
let outs = Dot::with_config(&out, &[Config::EdgeNoLabel]).to_string();
|
||||||
|
let outs = outs.replace(';',"\\n");
|
||||||
|
fs::write(dump_path,outs).expect("Failed to write graph");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -115,14 +115,15 @@ impl SysGraphNode {
|
|||||||
pub fn pretty_print(&self) -> String {
|
pub fn pretty_print(&self) -> String {
|
||||||
let mut ret = String::new();
|
let mut ret = String::new();
|
||||||
ret.push_str(&format!("{}#{}",&self.base.current_task.0.task_name,&self.base.current_task.1));
|
ret.push_str(&format!("{}#{}",&self.base.current_task.0.task_name,&self.base.current_task.1));
|
||||||
ret.push_str("\nRl:");
|
ret.push_str(";Rl:");
|
||||||
for i in &self.base.ready_list_after {
|
for i in &self.base.ready_list_after {
|
||||||
ret.push_str(&format!("\n{}#{}",i.0.task_name,i.1));
|
ret.push_str(&format!(";{}#{}",i.0.task_name,i.1));
|
||||||
}
|
}
|
||||||
ret.push_str("\nDl:");
|
ret.push_str(";Dl:");
|
||||||
for i in &self.base.delay_list_after {
|
for i in &self.base.delay_list_after {
|
||||||
ret.push_str(&format!("\n{}#{}",i.0.task_name,i.1));
|
ret.push_str(&format!(";{}#{}",i.0.task_name,i.1));
|
||||||
}
|
}
|
||||||
|
// println!("{}",ret);
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user