Compare commits
2 Commits
97a2c6a925
...
6a2f8ecb66
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a2f8ecb66 | ||
|
|
f6081b9fe9 |
@@ -83,11 +83,11 @@ pub fn generate_growable_file(dir: &Path) -> std::io::Result<PathBuf> {
|
|||||||
|
|
||||||
/// Append `count` lines to the file
|
/// Append `count` lines to the file
|
||||||
pub fn append_lines(path: &Path, count: usize) -> std::io::Result<()> {
|
pub fn append_lines(path: &Path, count: usize) -> std::io::Result<()> {
|
||||||
|
let existing_lines = count_existing_lines(path)?;
|
||||||
let mut file = BufWriter::with_capacity(
|
let mut file = BufWriter::with_capacity(
|
||||||
64 * 1024,
|
64 * 1024,
|
||||||
fs::OpenOptions::new().append(true).open(path)?,
|
fs::OpenOptions::new().append(true).open(path)?,
|
||||||
);
|
);
|
||||||
let existing_lines = count_existing_lines(path).unwrap_or(0);
|
|
||||||
for i in 0..count {
|
for i in 0..count {
|
||||||
writeln!(
|
writeln!(
|
||||||
file,
|
file,
|
||||||
@@ -117,7 +117,12 @@ pub fn rotate_file(path: &Path) -> std::io::Result<PathBuf> {
|
|||||||
fn count_existing_lines(path: &Path) -> std::io::Result<u64> {
|
fn count_existing_lines(path: &Path) -> std::io::Result<u64> {
|
||||||
let file = fs::File::open(path)?;
|
let file = fs::File::open(path)?;
|
||||||
let reader = BufReader::new(file);
|
let reader = BufReader::new(file);
|
||||||
Ok(reader.lines().count() as u64)
|
let mut count = 0u64;
|
||||||
|
for line in reader.lines() {
|
||||||
|
line?;
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
Ok(count)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const HANDLER_NONE: u8 = 0;
|
|||||||
const HANDLER_DEFAULT: u8 = 1;
|
const HANDLER_DEFAULT: u8 = 1;
|
||||||
const HANDLER_IGNORE: u8 = 2;
|
const HANDLER_IGNORE: u8 = 2;
|
||||||
const HANDLER_PLAIN: u8 = 3; // extern "C" fn(c_int)
|
const HANDLER_PLAIN: u8 = 3; // extern "C" fn(c_int)
|
||||||
#[expect(clippy::unseparated_literal_suffix, reason = "clarity: this is the SA_SIGACTION variant")]
|
#[allow(clippy::unseparated_literal_suffix, reason = "clarity: this is the SA_SIGACTION variant")]
|
||||||
const HANDLER_SIGACTION: u8 = 4; // extern "C" fn(c_int, *mut siginfo_t, *mut c_void)
|
const HANDLER_SIGACTION: u8 = 4; // extern "C" fn(c_int, *mut siginfo_t, *mut c_void)
|
||||||
|
|
||||||
/// Old SIGBUS handler type — raw atomic, async-signal-safe to read.
|
/// Old SIGBUS handler type — raw atomic, async-signal-safe to read.
|
||||||
|
|||||||
@@ -143,8 +143,7 @@ pub fn format_report(results: &[BenchmarkResult]) -> String {
|
|||||||
report.push_str("| Test | Variant | RSS | Peak RSS | Page Faults |\n");
|
report.push_str("| Test | Variant | RSS | Peak RSS | Page Faults |\n");
|
||||||
report.push_str("|------|---------|-----|----------|-------------|\n");
|
report.push_str("|------|---------|-----|----------|-------------|\n");
|
||||||
|
|
||||||
let mut mem_rows: Vec<&BenchmarkResult> =
|
let mut mem_rows: Vec<&BenchmarkResult> = category_results.to_vec();
|
||||||
category_results.iter().copied().collect();
|
|
||||||
mem_rows.sort_by(|a, b| {
|
mem_rows.sort_by(|a, b| {
|
||||||
(&a.test_name, &a.backend, &a.variant)
|
(&a.test_name, &a.backend, &a.variant)
|
||||||
.cmp(&(&b.test_name, &b.backend, &b.variant))
|
.cmp(&(&b.test_name, &b.backend, &b.variant))
|
||||||
@@ -163,7 +162,10 @@ pub fn format_report(results: &[BenchmarkResult]) -> String {
|
|||||||
report.push('\n');
|
report.push('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut extras: Vec<(String, String, Vec<(String, f64)>)> = category_results
|
type ExtraEntry = (String, f64);
|
||||||
|
type ExtraGroup = (String, String, Vec<ExtraEntry>);
|
||||||
|
|
||||||
|
let mut extras: Vec<ExtraGroup> = category_results
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|r| !r.extra.is_empty())
|
.filter(|r| !r.extra.is_empty())
|
||||||
.map(|r| {
|
.map(|r| {
|
||||||
|
|||||||
Reference in New Issue
Block a user