diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml deleted file mode 100644 index a21a557..0000000 --- a/.github/workflows/c.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Everything C -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] -jobs: - static_analysis: - name: Run gcc with warnings - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install Dependencies - run: sudo apt-get install gcc cppcheck - - name: Compile Library with Warnings - run: gcc -Wall -Wextra -Wpedantic -Werror -std=c11 -c -o /dev/null ./blackheap-benchmarker/src/c_code/benchmarker_internal.c - - name: Run cppcheck - # This is everything but `unusedFunction` enabled - run: cppcheck --enable=warning,style,performance,portability,information,missingInclude --error-exitcode=1 ./blackheap-benchmarker/src/c_code/benchmarker.c diff --git a/blackheap-benchmarker/src/c_code/benchmarker_internal.c b/blackheap-benchmarker/src/c_code/benchmarker_internal.c index 4c7618e..95c0a2e 100644 --- a/blackheap-benchmarker/src/c_code/benchmarker_internal.c +++ b/blackheap-benchmarker/src/c_code/benchmarker_internal.c @@ -358,6 +358,9 @@ enum error_codes do_benchmark(const struct benchmark_config *config, struct benc int res; enum error_codes ret = ERROR_CODES_SUCCESS; struct allocation_result mallocs; + /* to make clang happy */ + mallocs.pointers = NULL; + mallocs.length = 0; /* Open fd (closed by cleanup) */ state->fd = open(config->filepath, O_RDWR, 0644); diff --git a/blackheap/Cargo.toml b/blackheap/Cargo.toml index e16d050..dbd4f60 100644 --- a/blackheap/Cargo.toml +++ b/blackheap/Cargo.toml @@ -15,7 +15,6 @@ clap = { version = "4.5", features = ["derive"] } human-panic = "1.2" lazy_static = "1.4" libc = "0.2" -linregress = "0.5" serde = { version = "1.0", features = ["derive"] } thiserror = "1.0" toml = "0.8" diff --git a/blackheap/src/assets/mod.rs b/blackheap/src/assets/mod.rs index b8d76a5..065b65e 100644 --- a/blackheap/src/assets/mod.rs +++ b/blackheap/src/assets/mod.rs @@ -1,6 +1,6 @@ +use std::collections::HashMap; use std::fs::File; use std::io::{self, Write}; -use std::collections::HashMap; use std::path::Path; use lazy_static::lazy_static; diff --git a/blackheap/src/assets/progress.rs b/blackheap/src/assets/progress.rs index 4ad81b3..89eac11 100644 --- a/blackheap/src/assets/progress.rs +++ b/blackheap/src/assets/progress.rs @@ -90,15 +90,6 @@ impl BenchmarkProgressToml { } } - pub fn get_done_access_sizes(&self, b: &Benchmark) -> Option<&[u32]> { - let operation = Operation::from_is_read_op(b.config.is_read_operation); - - self.benchmarks - .get(&b.scenario) - .and_then(|scenario_map| scenario_map.get(&operation)) - .map(|status| status.access_sizes_done.as_slice()) - } - pub fn get_missing_access_sizes(&self, b: &Benchmark) -> Option<&[u32]> { let operation = Operation::from_is_read_op(b.config.is_read_operation); diff --git a/blackheap/src/benchmark.rs b/blackheap/src/benchmark.rs index d27c139..2e0f0e7 100644 --- a/blackheap/src/benchmark.rs +++ b/blackheap/src/benchmark.rs @@ -3,6 +3,7 @@ use crate::assets::progress::{BenchmarkProgressToml, ProgressError, FILE_NAME}; use crate::cli::Cli; use blackheap_benchmarker::{AccessPattern, BenchmarkConfig, BenchmarkResults}; use serde::{Deserialize, Serialize}; +use std::fs::File; use std::{ collections::HashMap, fs, @@ -143,13 +144,15 @@ pub fn save_and_update_progress( progress: &mut BenchmarkProgressToml, ) -> Result<(), ProgressError> { let operation = Operation::from_is_read_op(b.config.is_read_operation).to_string(); - let file_path = format!( - "{}/{}/{}/{}.txt", + let dir = format!( + "{}/{}/{}", cli.to.to_str().unwrap(), b.scenario.to_string(), operation, - access_size ); + let file_path = format!("{}/{}.txt", &dir, access_size,); + fs::create_dir_all(dir)?; + File::create(&file_path)?; /* we save it as newline seperated f64s */ let durations_str = results diff --git a/blackheap/src/main.rs b/blackheap/src/main.rs index e5b3947..20e6b9a 100644 --- a/blackheap/src/main.rs +++ b/blackheap/src/main.rs @@ -3,7 +3,7 @@ use crate::{assets::progress::Operation, cli::Cli}; use benchmark::Benchmark; use blackheap_benchmarker::ErrorCodes; use clap::Parser; -use tracing::{debug, error, info}; +use tracing::{error, info}; mod assets; mod benchmark; @@ -17,7 +17,6 @@ fn main() { /* CLI parsing */ info!("Parsing and validating CLI"); let cli = Cli::parse(); - debug!("{:?}", &cli); if let Err(e) = cli::validate_cli(&cli) { error!("{:?}", e); std::process::exit(1); @@ -66,7 +65,7 @@ fn main() { /* Run the benchmark */ info!( - "Running {:?} ({:?}): Access Sizes: {:?}", + "Running {:?} ({:?}): Access Size: {:?}", &b.scenario, Operation::from_is_read_op(b.config.is_read_operation), access_size @@ -74,7 +73,7 @@ fn main() { let results = blackheap_benchmarker::benchmark_file(&config); if results.res != ErrorCodes::Success { info!( - "Error {:?} ({:?}): Access Sizes: {:?} failed with {:?}", + "Error {:?} ({:?}): Access Size: {:?} failed with {:?}", &b.scenario, Operation::from_is_read_op(b.config.is_read_operation), access_size,