Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add iai adapter parser" #137

Closed
wants to merge 1 commit into from
Closed
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
130 changes: 0 additions & 130 deletions lib/bencher_adapter/src/adapters/rust/iai.rs

This file was deleted.

3 changes: 0 additions & 3 deletions lib/bencher_adapter/src/adapters/rust/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
pub mod bench;
pub mod criterion;
pub mod iai;

use self::criterion::AdapterRustCriterion;
use self::iai::AdapterRustIai;
use crate::{Adapter, AdapterResults, Settings};
use bench::AdapterRustBench;

Expand All @@ -13,7 +11,6 @@ impl Adapter for AdapterRust {
fn parse(input: &str, settings: Settings) -> Option<AdapterResults> {
AdapterRustBench::parse(input, settings)
.or_else(|| AdapterRustCriterion::parse(input, settings))
.or_else(|| AdapterRustIai::parse(input, settings))
}
}

Expand Down
54 changes: 2 additions & 52 deletions lib/bencher_adapter/src/results/adapter_results.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
use std::{
collections::{HashMap, HashSet},
str::FromStr,
};
use std::{collections::HashMap, str::FromStr};

use bencher_json::{project::metric::Mean, BenchmarkName, JsonMetric};
use literally::hmap;
use serde::{Deserialize, Serialize};

use super::{
adapter_metrics::AdapterMetrics, CombinedKind, CYCLES_RESOURCE_ID, INSTRUCTIONS_RESOURCE_ID,
L1_ACCESSES_RESOURCE_ID, L2_ACCESSES_RESOURCE_ID, LATENCY_RESOURCE_ID,
RAM_ACCESSES_RESOURCE_ID, THROUGHPUT_RESOURCE_ID,
adapter_metrics::AdapterMetrics, CombinedKind, LATENCY_RESOURCE_ID, THROUGHPUT_RESOURCE_ID,
};

#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
Expand All @@ -33,15 +28,6 @@ pub enum AdapterMetricKind {
Throughput(JsonMetric),
}

#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub enum AdapterMultiMetricKind {
Instructions(JsonMetric),
Cycles(JsonMetric),
L1Accesses(JsonMetric),
L2Accesses(JsonMetric),
RamAccesses(JsonMetric),
}

impl AdapterResults {
pub fn new(benchmark_metrics: Vec<(BenchmarkName, AdapterMetricKind)>) -> Option<Self> {
if benchmark_metrics.is_empty() {
Expand Down Expand Up @@ -69,42 +55,6 @@ impl AdapterResults {

Some(results_map.into())
}
pub fn new_multi(
benchmark_metrics: Vec<(BenchmarkName, HashSet<AdapterMultiMetricKind>)>,
) -> Option<Self> {
if benchmark_metrics.is_empty() {
return None;
}

let mut results_map = HashMap::new();
for (benchmark_name, metrics) in benchmark_metrics {
let metrics_value = results_map
.entry(benchmark_name)
.or_insert_with(AdapterMetrics::default);
for metric in metrics {
let (resource_id, metric) = match metric {
AdapterMultiMetricKind::Instructions(json_metric) => {
(INSTRUCTIONS_RESOURCE_ID.clone(), json_metric)
},
AdapterMultiMetricKind::Cycles(json_metric) => {
(CYCLES_RESOURCE_ID.clone(), json_metric)
},
AdapterMultiMetricKind::L1Accesses(json_metric) => {
(L1_ACCESSES_RESOURCE_ID.clone(), json_metric)
},
AdapterMultiMetricKind::L2Accesses(json_metric) => {
(L2_ACCESSES_RESOURCE_ID.clone(), json_metric)
},
AdapterMultiMetricKind::RamAccesses(json_metric) => {
(RAM_ACCESSES_RESOURCE_ID.clone(), json_metric)
},
};
metrics_value.inner.insert(resource_id, metric);
}
}

Some(results_map.into())
}

pub fn new_latency(benchmark_metrics: Vec<(BenchmarkName, JsonMetric)>) -> Option<Self> {
Self::new(
Expand Down
36 changes: 1 addition & 35 deletions lib/bencher_adapter/src/results/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ use std::collections::HashMap;
use bencher_json::{
project::{
metric::Mean,
metric_kind::{
CYCLES_SLUG_STR, INSTRUCTIONS_SLUG_STR, L1_ACCESSES_SLUG_STR, L2_ACCESSES_SLUG_STR,
LATENCY_SLUG_STR, RAM_ACCESSES_SLUG_STR, THROUGHPUT_SLUG_STR,
},
metric_kind::{LATENCY_SLUG_STR, THROUGHPUT_SLUG_STR},
report::{JsonAdapter, JsonFold},
},
ResourceId,
Expand Down Expand Up @@ -36,37 +33,6 @@ pub static THROUGHPUT_RESOURCE_ID: Lazy<ResourceId> = Lazy::new(|| {
.expect("Failed to parse metric kind slug.")
});

#[allow(clippy::expect_used)]
pub static INSTRUCTIONS_RESOURCE_ID: Lazy<ResourceId> = Lazy::new(|| {
INSTRUCTIONS_SLUG_STR
.parse()
.expect("Failed to parse metric kind slug.")
});
#[allow(clippy::expect_used)]
pub static CYCLES_RESOURCE_ID: Lazy<ResourceId> = Lazy::new(|| {
CYCLES_SLUG_STR
.parse()
.expect("Failed to parse metric kind slug.")
});
#[allow(clippy::expect_used)]
pub static L1_ACCESSES_RESOURCE_ID: Lazy<ResourceId> = Lazy::new(|| {
L1_ACCESSES_SLUG_STR
.parse()
.expect("Failed to parse metric kind slug.")
});
#[allow(clippy::expect_used)]
pub static L2_ACCESSES_RESOURCE_ID: Lazy<ResourceId> = Lazy::new(|| {
L2_ACCESSES_SLUG_STR
.parse()
.expect("Failed to parse metric kind slug.")
});
#[allow(clippy::expect_used)]
pub static RAM_ACCESSES_RESOURCE_ID: Lazy<ResourceId> = Lazy::new(|| {
RAM_ACCESSES_SLUG_STR
.parse()
.expect("Failed to parse metric kind slug.")
});

pub type MetricKind = ResourceId;

#[derive(Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion lib/bencher_json/src/project/metric/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod median;
pub use mean::Mean;
pub use median::Median;

#[derive(Debug, Copy, Clone, Hash, Default, Eq, Serialize, Deserialize)]
#[derive(Debug, Copy, Clone, Default, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
pub struct JsonMetric {
pub value: OrderedFloat<f64>,
Expand Down
Loading