diff --git a/crates/exec-harness/src/main.rs b/crates/exec-harness/src/main.rs index df5f203b..99cbf7cd 100644 --- a/crates/exec-harness/src/main.rs +++ b/crates/exec-harness/src/main.rs @@ -32,7 +32,10 @@ struct Args { fn main() -> Result<()> { env_logger::builder() .parse_env(env_logger::Env::new().filter_or("CODSPEED_LOG", "info")) - .format_timestamp(None) + .format(|buf, record| { + use std::io::Write; + writeln!(buf, "{}", record.args()) + }) .init(); debug!("Starting exec-harness with pid {}", std::process::id()); diff --git a/src/exec/poll_results.rs b/src/exec/poll_results.rs index 1f865f81..834759be 100644 --- a/src/exec/poll_results.rs +++ b/src/exec/poll_results.rs @@ -22,7 +22,6 @@ pub async fn poll_results( run_id: upload_result.run_id.clone(), }; - start_group!("Fetching the results"); let response; loop { if start.elapsed() > RUN_PROCESSING_MAX_DURATION { @@ -50,13 +49,8 @@ pub async fn poll_results( bail!("Run failed to be processed, try again in a few minutes"); } - info!( - "\nTo see the full report, visit: {}", - style(response.run.url).blue().bold().underlined() - ); - end_group!(); - if !response.run.results.is_empty() { + end_group!(); start_group!("Benchmark results"); if response.run.results.len() == 1 { @@ -67,7 +61,10 @@ pub async fn poll_results( info!("\n{table}"); } - end_group!(); + info!( + "\nTo see the full report, visit: {}", + style(response.run.url).blue().bold().underlined() + ); } Ok(()) diff --git a/src/executor/helpers/apt.rs b/src/executor/helpers/apt.rs index 029f4494..30d6ab98 100644 --- a/src/executor/helpers/apt.rs +++ b/src/executor/helpers/apt.rs @@ -59,7 +59,7 @@ where Fut: std::future::Future>>, { if is_installed() { - info!("Tool already installed, skipping installation"); + debug!("Tool already installed, skipping installation"); return Ok(()); } diff --git a/src/executor/memory/executor.rs b/src/executor/memory/executor.rs index 6927c6c3..3951cca4 100644 --- a/src/executor/memory/executor.rs +++ b/src/executor/memory/executor.rs @@ -82,9 +82,7 @@ impl Executor for MemoryExecutor { MEMTRACK_CODSPEED_VERSION, get_memtrack_installer_url, ) - .await?; - - Ok(()) + .await } async fn run( diff --git a/src/executor/mod.rs b/src/executor/mod.rs index 1204bc9c..c081ab7d 100644 --- a/src/executor/mod.rs +++ b/src/executor/mod.rs @@ -22,6 +22,7 @@ pub use config::Config; pub use execution_context::ExecutionContext; pub use helpers::profile_folder::create_profile_folder; pub use interfaces::ExecutorName; + use memory::executor::MemoryExecutor; use std::path::Path; use valgrind::executor::ValgrindExecutor; @@ -107,16 +108,16 @@ where F: AsyncFn(&UploadResult) -> Result<()>, { if !execution_context.config.skip_setup { - start_group!("Preparing the environment"); executor .setup(&execution_context.system_info, setup_cache_dir) .await?; + // TODO: refactor and move directly in the Instruments struct as a `setup` method if execution_context.config.instruments.is_mongodb_enabled() { install_mongodb_tracer().await?; } - info!("Environment ready"); - end_group!(); + + debug!("Environment ready"); } if !execution_context.config.skip_run { @@ -140,14 +141,12 @@ where mongo_tracer.stop().await?; } end_group!(); - start_opened_group!("Tearing down environment"); + debug!("Tearing down the executor"); executor.teardown(execution_context).await?; execution_context .logger .persist_log_to_profile_folder(execution_context)?; - - end_group!(); } else { debug!("Skipping the run of the benchmarks"); }; @@ -163,14 +162,14 @@ where .await?; } - start_group!("Uploading performance data"); + start_group!("Uploading results"); let upload_result = crate::run::uploader::upload(execution_context, executor.name(), api_client).await?; - end_group!(); if execution_context.is_local() { poll_results(&upload_result).await?; } + end_group!(); } else { debug!("Skipping upload of performance data"); } diff --git a/src/executor/valgrind/setup.rs b/src/executor/valgrind/setup.rs index 21ef20cb..d2d54a96 100644 --- a/src/executor/valgrind/setup.rs +++ b/src/executor/valgrind/setup.rs @@ -135,9 +135,7 @@ pub async fn install_valgrind( Ok(vec!["valgrind".to_string()]) }, ) - .await?; - - Ok(()) + .await } #[cfg(test)] diff --git a/src/executor/wall_time/executor.rs b/src/executor/wall_time/executor.rs index d436f089..6a1814ee 100644 --- a/src/executor/wall_time/executor.rs +++ b/src/executor/wall_time/executor.rs @@ -156,7 +156,7 @@ impl Executor for WallTimeExecutor { async fn setup(&self, system_info: &SystemInfo, setup_cache_dir: Option<&Path>) -> Result<()> { if self.perf.is_some() { - PerfRunner::setup_environment(system_info, setup_cache_dir).await?; + return PerfRunner::setup_environment(system_info, setup_cache_dir).await; } Ok(()) diff --git a/src/executor/wall_time/perf/mod.rs b/src/executor/wall_time/perf/mod.rs index 3ea55d5d..6b2d614c 100644 --- a/src/executor/wall_time/perf/mod.rs +++ b/src/executor/wall_time/perf/mod.rs @@ -375,13 +375,13 @@ impl BenchmarkData { }; let path_ref = path.as_ref(); - info!("Saving symbols addresses"); + debug!("Saving symbols addresses"); symbols_by_pid.par_iter().for_each(|(_, proc_sym)| { proc_sym.save_to(path_ref).unwrap(); }); // Collect debug info for each process by looking up file/line for symbols - info!("Saving debug_info"); + debug!("Saving debug_info"); let debug_info_by_pid: HashMap> = symbols_by_pid .par_iter() .map(|(pid, proc_sym)| (*pid, ProcessDebugInfo::new(proc_sym).modules())) @@ -393,7 +393,7 @@ impl BenchmarkData { }); }); - info!("Saving metadata"); + debug!("Saving metadata"); #[allow(deprecated)] let metadata = PerfMetadata { version: PERF_METADATA_CURRENT_VERSION, diff --git a/src/executor/wall_time/perf/perf_executable.rs b/src/executor/wall_time/perf/perf_executable.rs index b964b5e8..f82c8a5f 100644 --- a/src/executor/wall_time/perf/perf_executable.rs +++ b/src/executor/wall_time/perf/perf_executable.rs @@ -103,7 +103,8 @@ pub fn get_event_flags(perf_executable: &OsString) -> anyhow::Result, } @@ -35,12 +37,13 @@ pub struct TargetOptions { #[derive(Debug, Deserialize, Serialize, PartialEq)] #[serde(rename_all = "kebab-case")] pub struct ProjectOptions { - /// Walltime execution configuration - pub walltime: Option, /// Working directory where commands will be executed (relative to config file) pub working_directory: Option, /// Runner mode (walltime, memory, or simulation) pub mode: Option, + /// Walltime execution configuration (flattened) + #[serde(flatten)] + pub walltime: Option, } /// Walltime execution options matching WalltimeExecutionArgs structure diff --git a/src/project_config/mod.rs b/src/project_config/mod.rs index 93978b50..d5ccc6d6 100644 --- a/src/project_config/mod.rs +++ b/src/project_config/mod.rs @@ -180,8 +180,7 @@ mod tests { fn test_deserialize_minimal_config() { let yaml = r#" options: - walltime: - warmup-time: 1s + warmup-time: 1s "#; let config: ProjectConfig = serde_yaml::from_str(yaml).unwrap(); assert!(config.options.is_some()); @@ -197,12 +196,11 @@ options: fn test_deserialize_full_walltime_config() { let yaml = r#" options: - walltime: - warmup-time: 2s - max-time: 10s - min-time: 1s - max-rounds: 100 - min-rounds: 10 + warmup-time: 2s + max-time: 10s + min-time: 1s + max-rounds: 100 + min-rounds: 10 working-directory: ./bench mode: walltime "#; @@ -309,8 +307,7 @@ options: &config_path, r#" options: - walltime: - warmup-time: 5s + warmup-time: 5s "#, ) .unwrap(); @@ -339,8 +336,7 @@ options: &config_path, r#" options: - walltime: - warmup-time: 3s + warmup-time: 3s "#, ) .unwrap(); @@ -370,8 +366,7 @@ options: &config_path, r#" options: - walltime: - warmup-time: 2s + warmup-time: 2s "#, ) .unwrap(); @@ -390,8 +385,7 @@ options: temp_dir.path().join("codspeed.yaml"), r#" options: - walltime: - warmup-time: 1s + warmup-time: 1s "#, ) .unwrap(); @@ -400,8 +394,7 @@ options: temp_dir.path().join("codspeed.yml"), r#" options: - walltime: - warmup-time: 2s + warmup-time: 2s "#, ) .unwrap(); diff --git a/src/run/poll_results.rs b/src/run/poll_results.rs index 82032608..d5a4fd94 100644 --- a/src/run/poll_results.rs +++ b/src/run/poll_results.rs @@ -23,7 +23,6 @@ pub async fn poll_results( run_id: upload_result.run_id.clone(), }; - start_group!("Fetching the results"); let response; loop { if start.elapsed() > RUN_PROCESSING_MAX_DURATION { @@ -75,11 +74,6 @@ pub async fn poll_results( info!("No impact detected, reason: {}", report.conclusion); } - info!( - "\nTo see the full report, visit: {}", - style(response.run.url).blue().bold().underlined() - ); - if output_json { // TODO: Refactor `log_json` to avoid having to format the json manually // We could make use of structured logging for this https://docs.rs/log/latest/log/#structured-logging @@ -89,9 +83,8 @@ pub async fn poll_results( )); } - end_group!(); - if !response.run.results.is_empty() { + end_group!(); start_group!("Benchmark results"); let table = build_benchmark_table(&response.run.results); @@ -106,7 +99,10 @@ pub async fn poll_results( } } - end_group!(); + info!( + "\nTo see the full report, visit: {}", + style(response.run.url).blue().bold().underlined() + ); } Ok(()) diff --git a/src/run/uploader/upload.rs b/src/run/uploader/upload.rs index ef94260c..7bcf4317 100644 --- a/src/run/uploader/upload.rs +++ b/src/run/uploader/upload.rs @@ -283,7 +283,7 @@ pub async fn upload( .await?; debug!("Upload metadata: {upload_metadata:#?}"); info!( - "Linked repository: {}\n", + "Linked repository: {}", style(format!( "{}/{}", upload_metadata.run_environment_metadata.owner, @@ -296,11 +296,10 @@ pub async fn upload( info!("CodSpeed Run Hash: \"{hash}\""); } - info!("Preparing upload..."); + debug!("Preparing upload..."); let upload_data = retrieve_upload_data(&execution_context.config, &upload_metadata).await?; debug!("runId: {}", upload_data.run_id); - info!("Uploading performance data..."); debug!( "Uploading {} bytes...", profile_archive.content.size().await?