Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions collector/collect.sh

This file was deleted.

20 changes: 0 additions & 20 deletions collector/src/api.rs

This file was deleted.

189 changes: 0 additions & 189 deletions collector/src/bin/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use tabled::settings::style::Border;
use tabled::settings::{Alignment, Color, Modify, Width};
use tokio::runtime::Runtime;

use collector::api::next_artifact::NextArtifact;
use collector::artifact_stats::{
compile_and_get_stats, ArtifactStats, ArtifactWithStats, CargoProfile,
};
Expand Down Expand Up @@ -601,21 +600,6 @@ enum Commands {
purge: PurgeOption,
},

/// Benchmarks the next commit or release for perf.rust-lang.org
BenchNext {
/// Site URL
site_url: String,

#[command(flatten)]
db: DbOption,

#[command(flatten)]
bench_rustc: BenchRustcOption,

#[command(flatten)]
self_profile: SelfProfileOption,
},

/// Benchmarks a published toolchain for perf.rust-lang.org's dashboard
BenchPublished {
/// Toolchain (e.g. stable, beta, 1.26.0)
Expand Down Expand Up @@ -822,7 +806,6 @@ fn main_result() -> anyhow::Result<i32> {
mode: BinaryStatsMode::Local(_),
..
}
| Commands::BenchNext { .. }
| Commands::BenchPublished { .. }
| Commands::InstallNext { .. }
| Commands::Download(_)
Expand Down Expand Up @@ -1064,169 +1047,6 @@ fn main_result() -> anyhow::Result<i32> {
Ok(0)
}

Commands::BenchNext {
site_url,
db,
bench_rustc,
self_profile,
} => {
log_db(&db);
println!("processing artifacts");
let client = reqwest::blocking::Client::new();
let response: collector::api::next_artifact::Response = client
.get(format!("{site_url}/perf/next_artifact"))
.send()?
.json()?;
let next = if let Some(c) = response.artifact {
c
} else {
println!("no artifact to benchmark");

// Sleep for a bit to avoid spamming the perf server too much
// This sleep serves to remove a needless sleep in `collector/collect.sh` when
// a benchmark was actually executed.
std::thread::sleep(Duration::from_secs(60 * 2));

// no missing artifacts
return Ok(0);
};

let res = std::panic::catch_unwind(|| {
let pool = database::Pool::open(&db.db);
let rt = build_async_runtime();

match next {
NextArtifact::Release(tag) => {
let toolchain = create_toolchain_from_published_version(
&tag,
&require_host_target_tuple(),
)?;
let conn = rt.block_on(pool.connection());
rt.block_on(bench_published_artifact(
conn,
toolchain,
&benchmark_dirs,
None,
))
}
NextArtifact::Commit {
commit,
include,
exclude,
runs,
backends: requested_backends,
} => {
// Parse the requested backends, with LLVM as a fallback if none or no valid
// ones were explicitly specified, which will be the case for the vast
// majority of cases.
let mut backends = vec![];
if let Some(requested_backends) = requested_backends {
let requested_backends = requested_backends.to_lowercase();
if requested_backends.contains("llvm") {
backends.push(CodegenBackend::Llvm);
}
if requested_backends.contains("cranelift") {
backends.push(CodegenBackend::Cranelift);
}
}

if backends.is_empty() {
backends.push(CodegenBackend::Llvm);
}

// FIXME: remove this when/if NextArtifact::Commit's include/exclude
// changed from Option<String> to Vec<String>
// to not to manually parse args
let split_args = |l: Option<String>| -> Vec<String> {
if let Some(l) = l {
l.split(',').map(|arg| arg.trim().to_owned()).collect()
} else {
vec![]
}
};
let sha = commit.sha.to_string();
let sysroot = rt
.block_on(Sysroot::install(
Path::new(TOOLCHAIN_CACHE_DIRECTORY),
sha.clone(),
&require_host_target_tuple(),
&backends,
))
.map_err(SysrootDownloadError::as_anyhow_error)
.with_context(|| format!("failed to install sysroot for {commit:?}"))?;

let mut benchmarks = get_compile_benchmarks(
&compile_benchmark_dir,
CompileBenchmarkFilter::Fuzzy {
include: &split_args(include),
exclude: &split_args(exclude),
exclude_suffix: &[],
},
)?;
benchmarks.retain(|b| b.category().is_primary_or_secondary());

let artifact_id = ArtifactId::Commit(commit);
let mut conn = rt.block_on(pool.connection());
let toolchain = Toolchain::from_sysroot(&sysroot, sha);

let compile_config = CompileBenchmarkConfig {
benchmarks,
profiles: vec![
Profile::Check,
Profile::Debug,
Profile::Doc,
Profile::Opt,
],
scenarios: Scenario::all(),
backends,
iterations: runs.map(|v| v as usize),
is_self_profile: self_profile.self_profile,
bench_rustc: bench_rustc.bench_rustc,
targets: vec![Target::default()],
};
let runtime_suite = rt.block_on(load_runtime_benchmarks(
conn.as_mut(),
&runtime_benchmark_dir,
CargoIsolationMode::Isolated,
None,
&toolchain,
&artifact_id,
None,
))?;

let runtime_config = RuntimeBenchmarkConfig {
runtime_suite,
filter: RuntimeBenchmarkFilter::keep_all(),
iterations: DEFAULT_RUNTIME_ITERATIONS,
target: Target::default(),
};
let shared = SharedBenchmarkConfig {
artifact_id,
toolchain,
job_id: None,
};

rt.block_on(run_benchmarks(
conn.as_mut(),
shared,
Some(compile_config),
Some(runtime_config),
))
}
}
});
// We need to send a message to this endpoint even if the collector panics
client.post(format!("{site_url}/perf/onpush")).send()?;

match res {
Ok(res) => res?,
Err(error) => {
log::error!("The collector has crashed\n{error:?}");
}
}
Ok(0)
}

Commands::BenchPublished { toolchain, db } => {
log_db(&db);
let pool = database::Pool::open(&db.db);
Expand Down Expand Up @@ -2267,8 +2087,6 @@ async fn run_benchmarks(

let collector = init_collection(connection, &shared, compile.as_ref(), runtime.as_ref()).await;

let start = Instant::now();

// Compile benchmarks
let compile_result = if let Some(compile) = compile {
let errors = bench_compile(connection, &shared, compile, &collector).await;
Expand All @@ -2295,13 +2113,6 @@ async fn run_benchmarks(
Ok(())
};

if shared.job_id.is_none() {
let end = start.elapsed();
connection
.record_duration(collector.artifact_row_id, end)
.await;
}

compile_result.and(runtime_result)
}

Expand Down
5 changes: 0 additions & 5 deletions collector/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use chrono::NaiveDate;
pub use database::{Commit, PatchName, QueryLabel};
use serde::Deserialize;
use std::cmp::PartialOrd;
use std::fmt;
use std::process::{self, Command};

pub mod api;
pub mod artifact_stats;
pub mod benchmark_set;
pub mod cargo;
Expand All @@ -24,9 +22,6 @@ use hashbrown::HashSet;
use process::Stdio;
use std::time::{Duration, Instant};

#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Deserialize)]
pub struct DeltaTime(#[serde(with = "round_float")] pub f64);

/// The bound for finding an artifact
///
/// This can either be the upper or lower bound.
Expand Down
39 changes: 0 additions & 39 deletions database/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,6 @@ Columns:
* **id** (`integer`): Unique identifier
* **perf_commit** (`text`): Commit sha / tag

### collector_progress

Keeps track of the collector's start and finish time as well as which step it's currently on.

Columns:

* **aid** (`integer`): Artifact id, references the id in the artifact table
* **step** (`text`): The step the collector is currently benchmarking
* **start** (`timestamptz`): When the collector started
* **end** (`timestamptz`): When the collector finished

### artifact_collection_duration

Records how long benchmarking takes in seconds.

Columns:

* **aid** (`integer`): Artifact id, references the id in the artifact table
* **date_recorded** (`timestamptz`): When this was recorded
* **duration** (`integer`): How long the benchmarking took in seconds

### benchmark

The different types of compile-time benchmarks that are run.
Expand Down Expand Up @@ -202,24 +181,6 @@ Columns:
* **profile** (`text`): What type of compilation is happening - check build, optimized build (a.k.a. release build), debug build, or doc build.
* **cache** (`text`): The incremental scenario used for the benchmark

### pull_request_build

Records a pull request commit that is waiting in a queue to be benchmarked.

First a merge commit is queued, then its artifacts are built by bors, and once the commit
is attached to the entry in this table, it can be benchmarked.

* **bors_sha** (`text`): SHA of the commit that should be benchmarked
* **pr** (`integer`): number of the PR
* **parent_sha** (`text`): SHA of the parent commit, to which will the PR be compared
* **complete** (`boolean`): Specifies whether this commit has been already benchmarked or not
* **requested** (`timestamptz`): When was the commit queued
* **include** (`text`): Which benchmarks should be included (corresponds to the `--include` benchmark parameter), comma separated strings
* **exclude** (`text`): Which benchmarks should be excluded (corresponds to the `--exclude` benchmark parameter), comma separated strings
* **runs** (`integer`): How many iterations should be used by default for the benchmark run
* **commit_date** (`timestamptz`): When was the commit created
* **backends** (`text`): The codegen backends to use for the benchmarks (corresponds to the `--backends` benchmark parameter)

### error

Records an error within the application namely a;
Expand Down
Loading
Loading