pub struct Runner { /* private fields */ }Expand description
Times targets against one context.
Implementations§
Source§impl Runner
impl Runner
Sourcepub fn new(ctx: Arc<Context>, profile: Profile, repo_root: &Path) -> Self
pub fn new(ctx: Arc<Context>, profile: Profile, repo_root: &Path) -> Self
A runner over a context; the HTTP socket and the MCP child are started on first use.
Sourcepub fn with_executable(self, path: PathBuf) -> Self
pub fn with_executable(self, path: PathBuf) -> Self
Spawn this executable for the MCP transport instead of the running one.
The share directory the MCP child reads (MAJORDOMUS_SHARE); the parent’s.
Sourcepub fn with_repo_args(self, args: RepoArgs) -> Self
pub fn with_repo_args(self, args: RepoArgs) -> Self
How the live view reloads the repository: the arguments the process read it with, so that a reload discovers the same root, distribution and discovery mode.
use majordomus_cli::bench::{BenchmarkProjection, Profile, Runner};
use majordomus_cli::cli::RepoArgs;
use majordomus_cli::synthetic::SyntheticRepository;
let repo = SyntheticRepository::small().unwrap();
let ctx = repo.context().unwrap();
let projection = BenchmarkProjection::from_context(&ctx);
let live = projection
.targets
.iter()
.find(|t| t.key == "system.http.live.index")
.unwrap();
let tiny = Profile { name: "doc", warmup: 0, samples: 2, cold_spawns: 1, deferred: false };
let args = RepoArgs {
repo: Some(repo.root().to_path_buf()),
..RepoArgs::default()
};
let mut runner = Runner::new(ctx, tiny, repo.root()).with_repo_args(args);
// the live socket is served over a view started from these arguments
assert_eq!(runner.run(live).unwrap()[0].stats.samples, 2);
runner.finish();Sourcepub fn with_child_args(self, args: Vec<String>) -> Self
pub fn with_child_args(self, args: Vec<String>) -> Self
Arguments the MCP child gets after mcp --standalone, so that it reads the
repository the way the parent did (--discovery filesystem, --strict).
Sourcepub fn run(
&mut self,
target: &BenchmarkTarget,
) -> Result<Vec<BenchmarkResult>, Error>
pub fn run( &mut self, target: &BenchmarkTarget, ) -> Result<Vec<BenchmarkResult>, Error>
Time one target: one result per cache mode it has.
Auto Trait Implementations§
impl !RefUnwindSafe for Runner
impl !UnwindSafe for Runner
impl Freeze for Runner
impl Send for Runner
impl Sync for Runner
impl Unpin for Runner
impl UnsafeUnpin for Runner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more