Skip to content

Commit

Permalink
refactor: add program name and input name to the output
Browse files Browse the repository at this point in the history
  • Loading branch information
Fumuran committed Oct 10, 2023
1 parent 26eed21 commit 81667b4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion miden/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ escargot = "0.5.7"
num-bigint = "0.4"
predicates = "3.0"
test-utils = { package = "miden-test-utils", path = "../test-utils" }
vm-core = { package = "miden-core", path = "../core", version = "0.7" }
winter-fri = { package = "winter-fri", version = "0.6" }
vm-core = { package = "miden-core", path = "../core", version = "0.7" }
23 changes: 20 additions & 3 deletions miden/src/tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ impl Analyze {

let execution_details: ExecutionDetails = analyze(program.as_str(), stack_inputs, host)
.expect("Could not retrieve execution details");
let program_name = self
.assembly_file
.file_name()
.expect("provided file path is incorrect")
.to_str()
.unwrap();
print!("\nAnalyzed {} program", program_name);
if let Some(input_path) = &self.input_file {
let input_name = input_path
.file_name()
.expect("provided input path is incorrect")
.to_str()
.unwrap();
println!(" with {}", input_name);
}

println!("{}", execution_details);

Expand Down Expand Up @@ -134,7 +149,7 @@ impl fmt::Display for ExecutionDetails {
├── Hash chiplet rows: {}
├── Bitwise chiplet rows: {}
├── Memory chiplet rows: {}
└── Kernel ROM rows: {}",
└── Kernel ROM rows: {}\n",
self.trace_len_summary().trace_len(),
self.trace_len_summary().padded_trace_len(),
padding_percentage,
Expand All @@ -148,7 +163,6 @@ impl fmt::Display for ExecutionDetails {
)?;
let total_noops = self.total_noops();
let asm_op_stats = self.asm_op_stats();
writeln!(f, "Total Number of NOOPs executed: {}\n", total_noops)?;

// calculate the total length of pading for the `AsmOp` column
let padding =
Expand All @@ -157,7 +171,7 @@ impl fmt::Display for ExecutionDetails {
writeln!(
f,
"{0: <width$} | {1: <20} | {2: <20} | {3:}",
"AsmOp",
"Assembly instruction",
"Frequency",
"Total Cycles",
"Avg Instruction Cycles",
Expand All @@ -178,6 +192,9 @@ impl fmt::Display for ExecutionDetails {
width = padding,
)?;
}

writeln!(f, "\nTotal number of NOOPs executed: {}", total_noops)?;

Ok(())
}
}
Expand Down

0 comments on commit 81667b4

Please sign in to comment.