xtask bench: Add support for overriding the profiling target

This commit is contained in:
Louis Dureuil 2024-07-02 12:13:52 +02:00
parent 0df84bbba7
commit 14d10923d8
No known key found for this signature in database

View File

@ -23,6 +23,8 @@ pub struct Workload {
pub extra_cli_args: Vec<String>, pub extra_cli_args: Vec<String>,
pub assets: BTreeMap<String, Asset>, pub assets: BTreeMap<String, Asset>,
#[serde(default)] #[serde(default)]
pub target: String,
#[serde(default)]
pub precommands: Vec<super::command::Command>, pub precommands: Vec<super::command::Command>,
pub commands: Vec<super::command::Command>, pub commands: Vec<super::command::Command>,
} }
@ -54,7 +56,7 @@ async fn run_commands(
let trace_filename = format!("{report_folder}/{workload_name}-{run_number}-trace.json"); 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_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 for batch in workload
.commands .commands
@ -160,7 +162,11 @@ async fn execute_run(
async fn start_report( async fn start_report(
logs_client: &Client, logs_client: &Client,
filename: String, filename: String,
target: &str,
) -> anyhow::Result<tokio::task::JoinHandle<anyhow::Result<std::fs::File>>> { ) -> anyhow::Result<tokio::task::JoinHandle<anyhow::Result<std::fs::File>>> {
const DEFAULT_TARGET: &str = "indexing::=trace";
let target = if target.is_empty() { DEFAULT_TARGET } else { target };
let report_file = std::fs::File::options() let report_file = std::fs::File::options()
.create(true) .create(true)
.truncate(true) .truncate(true)
@ -174,7 +180,7 @@ async fn start_report(
.post("") .post("")
.json(&json!({ .json(&json!({
"mode": "profile", "mode": "profile",
"target": "indexing::=trace" "target": target,
})) }))
.send() .send()
.await .await