mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
mononoke: rename backfill_derived_data benchmark.rs
Summary: I'd like to use it in the next diffs to add a way to validate that derived data is the same after rederivation. A lot of the code in `benchmark.rs` is useful for doing this validation, so let's rename `benchmark.rs` so that it's ok to use it from two different subcommands. Reviewed By: mitrandir77 Differential Revision: D31115981 fbshipit-source-id: 86439534d8e49a4022086cb27918b7bcd7befc5c
This commit is contained in:
parent
4c9b9cd835
commit
7a96e7cc63
@ -57,7 +57,7 @@ use time_ext::DurationExt;
|
||||
use topo_sort::sort_topological;
|
||||
use tunables::tunables;
|
||||
|
||||
mod benchmark;
|
||||
mod regenerate;
|
||||
mod slice;
|
||||
mod warmup;
|
||||
|
||||
@ -644,15 +644,15 @@ async fn run_subcmd<'a>(
|
||||
if sub_m.is_present(ARG_PARALLEL) {
|
||||
let batch_size = args::get_u64_opt(&sub_m, ARG_BATCH_SIZE);
|
||||
|
||||
benchmark::BenchmarkOptions::BackfillParallel { batch_size }
|
||||
regenerate::DeriveOptions::BackfillParallel { batch_size }
|
||||
} else {
|
||||
benchmark::BenchmarkOptions::Backfill
|
||||
regenerate::DeriveOptions::Backfill
|
||||
}
|
||||
} else {
|
||||
benchmark::BenchmarkOptions::Simple
|
||||
regenerate::DeriveOptions::Simple
|
||||
};
|
||||
|
||||
let res = benchmark::benchmark_derived_data(
|
||||
let res = regenerate::regenerate_derived_data(
|
||||
&ctx,
|
||||
&repo,
|
||||
csids,
|
||||
@ -661,7 +661,7 @@ async fn run_subcmd<'a>(
|
||||
)
|
||||
.await?;
|
||||
|
||||
benchmark::print_benchmark_result(&res, sub_m.is_present(ARG_JSON))?;
|
||||
regenerate::print_benchmark_result(&res, sub_m.is_present(ARG_JSON))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ use serde::ser::SerializeStruct;
|
||||
use slog::debug;
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
pub enum BenchmarkOptions {
|
||||
pub enum DeriveOptions {
|
||||
// Simple case - derive commits one by one
|
||||
Simple,
|
||||
// Derive commits one by one, but send all writes
|
||||
@ -53,12 +53,12 @@ pub enum BenchmarkResult {
|
||||
},
|
||||
}
|
||||
|
||||
pub async fn benchmark_derived_data(
|
||||
pub async fn regenerate_derived_data(
|
||||
ctx: &CoreContext,
|
||||
repo: &BlobRepo,
|
||||
csids: Vec<ChangesetId>,
|
||||
derived_data_type: String,
|
||||
opts: BenchmarkOptions,
|
||||
opts: DeriveOptions,
|
||||
) -> Result<BenchmarkResult, Error> {
|
||||
let repo = repo.dangerous_override(|_| Arc::new(DummyLease {}) as Arc<dyn LeaseOps>);
|
||||
|
||||
@ -72,7 +72,7 @@ pub async fn benchmark_derived_data(
|
||||
if !pending.is_empty() {
|
||||
return Err(anyhow!(
|
||||
"{} commits are not derived yet. \
|
||||
Benchmarking requires all commits to be derived. List of underived commits: {:?}",
|
||||
Regenerating requires all commits to be derived. List of underived commits: {:?}",
|
||||
pending.len(),
|
||||
pending
|
||||
));
|
||||
@ -81,9 +81,9 @@ pub async fn benchmark_derived_data(
|
||||
derived_utils.regenerate(&csids);
|
||||
|
||||
match opts {
|
||||
BenchmarkOptions::Simple => derive_simple(&ctx, &repo, csids, derived_utils).await,
|
||||
BenchmarkOptions::Backfill => derive_with_backfill(&ctx, &repo, csids, derived_utils).await,
|
||||
BenchmarkOptions::BackfillParallel { batch_size } => {
|
||||
DeriveOptions::Simple => derive_simple(&ctx, &repo, csids, derived_utils).await,
|
||||
DeriveOptions::Backfill => derive_with_backfill(&ctx, &repo, csids, derived_utils).await,
|
||||
DeriveOptions::BackfillParallel { batch_size } => {
|
||||
derive_with_parallel_backfill(&ctx, &repo, csids, derived_utils, batch_size).await
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user