Final fixes (CSV, p==0.0)
This commit is contained in:
parent
168f81a19e
commit
10c1f4e5d5
@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
export OPENSSL_DIR=$(readlink -f ../../../openssl)
|
||||
export OPENSSL_DIR=$(readlink -f ~/openssl)
|
||||
export X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR=$OPENSSL_DIR
|
||||
export PKG_CONFIG_PATH=$OPENSSL_DIR
|
||||
export X86_64_UNKNOWN_LINUX_GNU_PKG_CONFIG_PATH=$OPENSSL_DIR
|
||||
|
@ -27,6 +27,7 @@ pub fn main() {
|
||||
|
||||
if let Some(uarch) = MicroArchitecture::get_micro_architecture() {
|
||||
if let Some(vendor_family_model_stepping) = MicroArchitecture::get_family_model_stepping() {
|
||||
println!("{:?}", uarch);
|
||||
let slicing = cache_slicing(
|
||||
uarch,
|
||||
core_per_socket,
|
||||
|
@ -86,7 +86,7 @@ fn main() {
|
||||
|
||||
println!("Number of cores per socket: {}", core_per_socket);
|
||||
|
||||
let m = MMappedMemory::new(SIZE);
|
||||
let m = MMappedMemory::new(SIZE, true);
|
||||
let array = m.slice();
|
||||
|
||||
let cache_line_size = 64;
|
||||
|
@ -15,7 +15,7 @@ pub enum Error {
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "linux", feature = "use_std"))]
|
||||
#[link(name = "cpupower")]
|
||||
#[link(name = "cpufreq")]
|
||||
extern "C" {
|
||||
//unsigned long cpufreq_get_freq_kernel(unsigned int cpu);
|
||||
fn cpufreq_get_freq_kernel(cpu: c_uint) -> c_ulong;
|
||||
|
@ -50,6 +50,7 @@ fn run_benchmark<T: CovertChannel + 'static>(
|
||||
for result in results.iter() {
|
||||
println!("{:?}", result);
|
||||
println!("C: {}, T: {}", result.capacity(), result.true_capacity());
|
||||
println!("Detailed:\"{}\",{},{},{},{}", name, num_pages, result.csv(), result.capacity(), result.true_capacity());
|
||||
average_p += result.error_rate;
|
||||
average_C += result.capacity();
|
||||
average_T += result.true_capacity()
|
||||
@ -79,6 +80,7 @@ fn run_benchmark<T: CovertChannel + 'static>(
|
||||
"{} - {} Variance of p: {}, C: {}, T:{}",
|
||||
name, num_pages, var_p, var_C, var_T
|
||||
);
|
||||
println!("CSV:\"{}\",{},{},{},{},{},{},{}",name,num_pages,average_p, average_C, average_T, var_p, var_C, var_T);
|
||||
BenchmarkStats {
|
||||
raw_res: results,
|
||||
average_p,
|
||||
@ -91,6 +93,8 @@ fn run_benchmark<T: CovertChannel + 'static>(
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("Detailed:Benchmark,Pages,{},C,T",CovertChannelBenchmarkResult::csv_header());
|
||||
println!("CSV:Benchmark,Pages,p,C,T,var_p,var_C,var_T");
|
||||
for num_pages in 1..=32 {
|
||||
/*println!("Benchmarking F+F");
|
||||
for _ in 0..16 {
|
||||
|
@ -53,10 +53,22 @@ impl CovertChannelBenchmarkResult {
|
||||
|
||||
pub fn true_capacity(&self) -> f64 {
|
||||
let p = self.error_rate;
|
||||
if p == 0.0 || p == 0.0 {
|
||||
self.capacity()
|
||||
} else {
|
||||
self.capacity() * (1.0 + ((1.0 - p) * f64::log2(1.0 - p) + p * f64::log2(p)))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn csv(&self) -> String {
|
||||
format!("{},{},{},{},{}", self.num_bytes_transmitted, self.num_bit_errors, self.error_rate, self.time_rdtsc, self.time_seconds.as_nanos())
|
||||
}
|
||||
|
||||
pub fn csv_header() -> String {
|
||||
format!("bytes_transmitted,bits_error,error_rate,time_rdtsc,time_nanosec")
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BitIterator<'a> {
|
||||
bytes: &'a Vec<u8>,
|
||||
byte_index: usize,
|
||||
|
Loading…
Reference in New Issue
Block a user