From 14d10923d8b96781fb783fe0fd6e6cc95e3a9281 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 2 Jul 2024 12:13:52 +0200 Subject: [PATCH] xtask bench: Add support for overriding the profiling target --- xtask/src/bench/workload.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xtask/src/bench/workload.rs b/xtask/src/bench/workload.rs index db44b5a8f..19c8bfae8 100644 --- a/xtask/src/bench/workload.rs +++ b/xtask/src/bench/workload.rs @@ -23,6 +23,8 @@ pub struct Workload { pub extra_cli_args: Vec, pub assets: BTreeMap, #[serde(default)] + pub target: String, + #[serde(default)] pub precommands: Vec, pub commands: Vec, } @@ -54,7 +56,7 @@ async fn run_commands( let trace_filename = format!("{report_folder}/{workload_name}-{run_number}-trace.json"); let report_filename = format!("{report_folder}/{workload_name}-{run_number}-report.json"); - let report_handle = start_report(logs_client, trace_filename).await?; + let report_handle = start_report(logs_client, trace_filename, &workload.target).await?; for batch in workload .commands @@ -160,7 +162,11 @@ async fn execute_run( async fn start_report( logs_client: &Client, filename: String, + target: &str, ) -> anyhow::Result>> { + const DEFAULT_TARGET: &str = "indexing::=trace"; + let target = if target.is_empty() { DEFAULT_TARGET } else { target }; + let report_file = std::fs::File::options() .create(true) .truncate(true) @@ -174,7 +180,7 @@ async fn start_report( .post("") .json(&json!({ "mode": "profile", - "target": "indexing::=trace" + "target": target, })) .send() .await