Fix repetition tester

This commit is contained in:
Abdelrahman Said 2023-11-25 18:25:53 +00:00
parent b2cb252822
commit 297d9c53f3

@ -63,9 +63,11 @@ int main(int argc, char *argv[]) {
return -1;
}
func_data funcs[] = {{{"WRITE", "WRITE WITH MALLOC"}, test_write},
{{"READ", "READ WITH MALLOC"}, test_read},
{{"FREAD", "FREAD WITH MALLOC"}, test_fread}};
func_data funcs[] = {
{{"WRITE", "WRITE WITH MALLOC"}, test_write},
{{"READ", "READ WITH MALLOC"}, test_read},
{{"FREAD", "FREAD WITH MALLOC"}, test_fread},
};
tester.params.read_size = get_file_length(fp);
tester.params.read_count = 1;
@ -93,11 +95,11 @@ void test_fread(reptester *tester, alloc_type type) {
return;
}
handle_alloc(tester, type);
u64 start = read_cpu_timer();
u64 fault_count_start = page_fault_count();
handle_alloc(tester, type);
u64 obj_count = fread(tester->params.buffer, tester->params.read_size,
tester->params.read_count, fp);
@ -126,13 +128,13 @@ void test_read(reptester *tester, alloc_type type) {
return;
}
u64 start = read_cpu_timer();
u64 fault_count_start = page_fault_count();
handle_alloc(tester, type);
i32 fd = fileno(fp);
u64 start = read_cpu_timer();
u64 fault_count_start = page_fault_count();
u64 bytes_read = read(fd, tester->params.buffer,
tester->params.read_size * tester->params.read_count);
@ -154,11 +156,11 @@ void test_read(reptester *tester, alloc_type type) {
}
void test_write(reptester *tester, alloc_type type) {
handle_alloc(tester, type);
u64 start = read_cpu_timer();
u64 fault_count_start = page_fault_count();
handle_alloc(tester, type);
u64 total_size = tester->params.read_size * tester->params.read_count;
for (u64 i = 0; i < total_size; ++i) {