-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathexecutor.rs
More file actions
60 lines (48 loc) · 1.87 KB
/
executor.rs
File metadata and controls
60 lines (48 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use async_trait::async_trait;
use std::path::Path;
use crate::executor::Executor;
use crate::executor::{ExecutionContext, ExecutorName};
use crate::instruments::mongo_tracer::MongoTracer;
use crate::prelude::*;
use crate::run::check_system::SystemInfo;
use super::setup::install_valgrind;
use super::{helpers::perf_maps::harvest_perf_maps, helpers::venv_compat, measure};
pub struct ValgrindExecutor;
#[async_trait(?Send)]
impl Executor for ValgrindExecutor {
fn name(&self) -> ExecutorName {
ExecutorName::Valgrind
}
async fn setup(&self, system_info: &SystemInfo, setup_cache_dir: Option<&Path>) -> Result<()> {
install_valgrind(system_info, setup_cache_dir).await?;
if let Err(error) = venv_compat::symlink_libpython(None) {
warn!("Failed to symlink libpython");
debug!("Script error: {error}");
}
Ok(())
}
async fn run(
&self,
execution_context: &ExecutionContext,
mongo_tracer: &Option<MongoTracer>,
) -> Result<()> {
//TODO: add valgrind version check
measure::measure(
&execution_context.config,
&execution_context.profile_folder,
mongo_tracer,
)
.await?;
Ok(())
}
async fn teardown(&self, execution_context: &ExecutionContext) -> Result<()> {
harvest_perf_maps(&execution_context.profile_folder).await?;
// No matter the command in input, at this point valgrind will have been run and have produced output files.
//
// Contrary to walltime, checking that benchmarks have been detected here would require
// parsing the valgrind output files, which is not ideal at this stage.
// A comprehensive message will be sent to the user if no benchmarks are detected,
// even if it's later in the process than technically possible.
Ok(())
}
}