Skip to content

Commit

Permalink
several few bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
lquenti committed Feb 23, 2024
1 parent bd4655f commit 6bbb49c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 37 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/c.yml

This file was deleted.

3 changes: 3 additions & 0 deletions blackheap-benchmarker/src/c_code/benchmarker_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion blackheap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion blackheap/src/assets/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
9 changes: 0 additions & 9 deletions blackheap/src/assets/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
9 changes: 6 additions & 3 deletions blackheap/src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions blackheap/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -66,15 +65,15 @@ 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
);
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,
Expand Down

0 comments on commit 6bbb49c

Please sign in to comment.