Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/exec-harness/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
13 changes: 5 additions & 8 deletions src/exec/poll_results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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(())
Expand Down
2 changes: 1 addition & 1 deletion src/executor/helpers/apt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ where
Fut: std::future::Future<Output = Result<Vec<String>>>,
{
if is_installed() {
info!("Tool already installed, skipping installation");
debug!("Tool already installed, skipping installation");
return Ok(());
}

Expand Down
4 changes: 1 addition & 3 deletions src/executor/memory/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ impl Executor for MemoryExecutor {
MEMTRACK_CODSPEED_VERSION,
get_memtrack_installer_url,
)
.await?;

Ok(())
.await
}

async fn run(
Expand Down
15 changes: 7 additions & 8 deletions src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -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");
};
Expand All @@ -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");
}
Expand Down
4 changes: 1 addition & 3 deletions src/executor/valgrind/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ pub async fn install_valgrind(
Ok(vec!["valgrind".to_string()])
},
)
.await?;

Ok(())
.await
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion src/executor/wall_time/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
6 changes: 3 additions & 3 deletions src/executor/wall_time/perf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32, Vec<ModuleDebugInfo>> = symbols_by_pid
.par_iter()
.map(|(pid, proc_sym)| (*pid, ProcessDebugInfo::new(proc_sym).modules()))
Expand All @@ -393,7 +393,7 @@ impl BenchmarkData {
});
});

info!("Saving metadata");
debug!("Saving metadata");
#[allow(deprecated)]
let metadata = PerfMetadata {
version: PERF_METADATA_CURRENT_VERSION,
Expand Down
3 changes: 2 additions & 1 deletion src/executor/wall_time/perf/perf_executable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ pub fn get_event_flags(perf_executable: &OsString) -> anyhow::Result<Option<Stri
.collect();

if !missing_events.is_empty() {
warn!(
// TODO(COD-2011) Move this back to a warning once we handle x86 events
debug!(
"Not all required perf events available. Missing: [{}], disabling detailed event sampling.",
missing_events.into_iter().join(", ")
);
Expand Down
4 changes: 1 addition & 3 deletions src/executor/wall_time/perf/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,5 @@ pub async fn install_perf(system_info: &SystemInfo, setup_cache_dir: Option<&Pat
// Return package names for caching
Ok(packages)
})
.await?;

Ok(())
.await
}
7 changes: 5 additions & 2 deletions src/project_config/interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,23 @@ pub struct Target {
}

#[derive(Debug, Deserialize, Serialize, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub struct TargetOptions {
#[serde(flatten)]
pub walltime: Option<WalltimeOptions>,
}

/// Root-level options that apply to all benchmark runs unless overridden by CLI
#[derive(Debug, Deserialize, Serialize, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub struct ProjectOptions {
/// Walltime execution configuration
pub walltime: Option<WalltimeOptions>,
/// Working directory where commands will be executed (relative to config file)
pub working_directory: Option<String>,
/// Runner mode (walltime, memory, or simulation)
pub mode: Option<RunnerMode>,
/// Walltime execution configuration (flattened)
#[serde(flatten)]
pub walltime: Option<WalltimeOptions>,
}

/// Walltime execution options matching WalltimeExecutionArgs structure
Expand Down
29 changes: 11 additions & 18 deletions src/project_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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
"#;
Expand Down Expand Up @@ -309,8 +307,7 @@ options:
&config_path,
r#"
options:
walltime:
warmup-time: 5s
warmup-time: 5s
"#,
)
.unwrap();
Expand Down Expand Up @@ -339,8 +336,7 @@ options:
&config_path,
r#"
options:
walltime:
warmup-time: 3s
warmup-time: 3s
"#,
)
.unwrap();
Expand Down Expand Up @@ -370,8 +366,7 @@ options:
&config_path,
r#"
options:
walltime:
warmup-time: 2s
warmup-time: 2s
"#,
)
.unwrap();
Expand All @@ -390,8 +385,7 @@ options:
temp_dir.path().join("codspeed.yaml"),
r#"
options:
walltime:
warmup-time: 1s
warmup-time: 1s
"#,
)
.unwrap();
Expand All @@ -400,8 +394,7 @@ options:
temp_dir.path().join("codspeed.yml"),
r#"
options:
walltime:
warmup-time: 2s
warmup-time: 2s
"#,
)
.unwrap();
Expand Down
14 changes: 5 additions & 9 deletions src/run/poll_results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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(())
Expand Down
5 changes: 2 additions & 3 deletions src/run/uploader/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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?
Expand Down
Loading