#![allow(dead_code)]
use std::io::{stdout,stderr,Write};
use crate::metrics_allocator::MetricsAllocator;
#[cfg(any(feature = "tolerance_10_percent", not(any(feature = "tolerance_25_percent"))))]
pub const PERCENT_TOLERANCE: f64 = 0.10;
#[cfg(feature = "tolerance_25_percent")]
pub const PERCENT_TOLERANCE: f64 = 0.25;
#[cfg(feature = "report_stdout")]
pub const OUTPUT: fn(&str) = stdout_write;
#[cfg(feature = "report_stderr")]
pub const OUTPUT: fn(&str) = stderr_write;
#[cfg(not(any(feature = "report_stdout", feature = "report_stderr")))]
pub const OUTPUT: fn(&str) = null_write;
#[cfg(not(feature = "no_allocator_metrics"))]
#[global_allocator]
pub static ALLOC: MetricsAllocator<SAVE_POINT_RING_BUFFER_SIZE> = MetricsAllocator::new();
#[cfg(feature = "no_allocator_metrics")]
pub static ALLOC: MetricsAllocator<SAVE_POINT_RING_BUFFER_SIZE> = MetricsAllocator::new();
pub const SAVE_POINT_RING_BUFFER_SIZE: usize = 1024;
fn stdout_write(buf: &str) {
sync_outputs();
print!("{}", buf);
sync_outputs();
}
fn stderr_write(buf: &str) {
sync_outputs();
eprint!("{}", buf);
sync_outputs();
}
fn sync_outputs() {
_ = stdout().flush();
_ = stderr().flush();
}
fn null_write(_buf: &str) {
}