Updated benches based on changes, commented out outdated benchmarks

This commit is contained in:
Christopher Haster
2023-06-30 03:00:07 -05:00
parent eee0e6cfa1
commit 938cee1640
6 changed files with 461 additions and 467 deletions
+56 -56
View File
@@ -1,56 +1,56 @@
[cases.bench_superblocks_found]
# support benchmarking with files
defines.N = [0, 1024]
defines.FILE_SIZE = 8
defines.CHUNK_SIZE = 8
code = '''
lfs_t lfs;
lfs_format(&lfs, cfg) => 0;
// create files?
lfs_mount(&lfs, cfg) => 0;
char name[256];
uint8_t buffer[CHUNK_SIZE];
for (lfs_size_t i = 0; i < N; i++) {
sprintf(name, "file%08x", i);
lfs_file_t file;
lfs_file_open(&lfs, &file, name,
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
for (lfs_size_t j = 0; j < FILE_SIZE; j += CHUNK_SIZE) {
for (lfs_size_t k = 0; k < CHUNK_SIZE; k++) {
buffer[k] = i+j+k;
}
lfs_file_write(&lfs, &file, buffer, CHUNK_SIZE) => CHUNK_SIZE;
}
lfs_file_close(&lfs, &file) => 0;
}
lfs_unmount(&lfs) => 0;
BENCH_START();
lfs_mount(&lfs, cfg) => 0;
BENCH_STOP();
lfs_unmount(&lfs) => 0;
'''
[cases.bench_superblocks_missing]
code = '''
lfs_t lfs;
BENCH_START();
int err = lfs_mount(&lfs, cfg);
assert(err != 0);
BENCH_STOP();
'''
[cases.bench_superblocks_format]
code = '''
lfs_t lfs;
BENCH_START();
lfs_format(&lfs, cfg) => 0;
BENCH_STOP();
'''
#[cases.bench_superblocks_found]
## support benchmarking with files
#defines.N = [0, 1024]
#defines.FILE_SIZE = 8
#defines.CHUNK_SIZE = 8
#code = '''
# lfs_t lfs;
# lfs_format(&lfs, cfg) => 0;
#
# // create files?
# lfs_mount(&lfs, cfg) => 0;
# char name[256];
# uint8_t buffer[CHUNK_SIZE];
# for (lfs_size_t i = 0; i < N; i++) {
# sprintf(name, "file%08x", i);
# lfs_file_t file;
# lfs_file_open(&lfs, &file, name,
# LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
#
# for (lfs_size_t j = 0; j < FILE_SIZE; j += CHUNK_SIZE) {
# for (lfs_size_t k = 0; k < CHUNK_SIZE; k++) {
# buffer[k] = i+j+k;
# }
# lfs_file_write(&lfs, &file, buffer, CHUNK_SIZE) => CHUNK_SIZE;
# }
#
# lfs_file_close(&lfs, &file) => 0;
# }
# lfs_unmount(&lfs) => 0;
#
# BENCH_START();
# lfs_mount(&lfs, cfg) => 0;
# BENCH_STOP();
#
# lfs_unmount(&lfs) => 0;
#'''
#
#[cases.bench_superblocks_missing]
#code = '''
# lfs_t lfs;
#
# BENCH_START();
# int err = lfs_mount(&lfs, cfg);
# assert(err != 0);
# BENCH_STOP();
#'''
#
#[cases.bench_superblocks_format]
#code = '''
# lfs_t lfs;
#
# BENCH_START();
# lfs_format(&lfs, cfg) => 0;
# BENCH_STOP();
#'''
#