Skip to content

Commit

Permalink
fix: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
nhtyy committed Nov 25, 2024
1 parent 8991870 commit bb14e17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions crates/core/executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,16 @@ impl<'a> Executor<'a> {

#[cfg(not(feature = "profiling"))]
return Self::with_context(program, opts, context);

#[cfg(feature = "profiling")]
{
let mut this = Self::with_context(program, opts, context);

let trace_buf = std::env::var("TRACE_FILE").ok().map(|file| {
let file = File::create(file).unwrap();
BufWriter::new(file)
});

if let Some(trace_buf) = trace_buf {
println!("Profiling enabled");

Expand All @@ -228,7 +228,8 @@ impl<'a> Executor<'a> {
.unwrap_or(1);

this.profiler = Some((
Profiler::new(elf_bytes, sample_rate as u64).expect("Failed to create profiler"),
Profiler::new(elf_bytes, sample_rate as u64)
.expect("Failed to create profiler"),
trace_buf,
));
}
Expand Down Expand Up @@ -1521,7 +1522,7 @@ impl<'a> Executor<'a> {
self.executor_mode = ExecutorMode::Trace;
self.print_report = true;
while !self.execute()? {}

#[cfg(feature = "profiling")]
if let Some((profiler, writer)) = self.profiler.take() {
profiler.write(writer).expect("Failed to write profile to output file");
Expand Down
2 changes: 1 addition & 1 deletion crates/core/executor/src/profiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl Profiler {
Ok(())
}

/// Simple check to makes sure we have valid main function that lasts
/// Simple check to makes sure we have valid main function that lasts
/// for most of the exeuction time.
fn check_samples(&self) {
let Some(main_idx) = self.main_idx else {
Expand Down

0 comments on commit bb14e17

Please sign in to comment.