Additional assembly loops
This commit is contained in:
parent
57acc5e16f
commit
12f25cfe51
@ -11,6 +11,8 @@
|
||||
|
||||
extern "C" void mov_all_bytes_asm(char *buffer, u64 size);
|
||||
extern "C" void nop_all_bytes_asm(u64 size);
|
||||
extern "C" void nop_1x3_all_bytes_asm(u64 size);
|
||||
extern "C" void nop_1x9_all_bytes_asm(u64 size);
|
||||
extern "C" void inc_all_bytes_asm(u64 size);
|
||||
extern "C" void dec_all_bytes_asm(u64 size);
|
||||
|
||||
@ -19,6 +21,8 @@ void test_read(reptester *tester, alloc_type type);
|
||||
void test_write(reptester *tester, alloc_type type);
|
||||
void test_write_mov_all_bytes_asm(reptester *tester, alloc_type type);
|
||||
void test_write_nop_all_bytes_asm(reptester *tester, alloc_type type);
|
||||
void test_write_nop_1x3_all_bytes_asm(reptester *tester, alloc_type type);
|
||||
void test_write_nop_1x9_all_bytes_asm(reptester *tester, alloc_type type);
|
||||
void test_write_inc_all_bytes_asm(reptester *tester, alloc_type type);
|
||||
void test_write_dec_all_bytes_asm(reptester *tester, alloc_type type);
|
||||
u64 get_file_length(FILE *fp);
|
||||
@ -73,15 +77,19 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
func_data funcs[] = {
|
||||
{{"WRITE", "WRITE WITH MALLOC"}, test_write},
|
||||
{{"WRITE MOV ASM", "WRITE MOV ASM WITH MALLOC"},
|
||||
test_write_mov_all_bytes_asm},
|
||||
// {{"WRITE", "WRITE WITH MALLOC"}, test_write},
|
||||
// {{"WRITE MOV ASM", "WRITE MOV ASM WITH MALLOC"},
|
||||
// test_write_mov_all_bytes_asm},
|
||||
{{"WRITE NOP ASM", "WRITE NOP ASM WITH MALLOC"},
|
||||
test_write_nop_all_bytes_asm},
|
||||
{{"WRITE INC ASM", "WRITE INC ASM WITH MALLOC"},
|
||||
test_write_inc_all_bytes_asm},
|
||||
{{"WRITE DEC ASM", "WRITE DEC ASM WITH MALLOC"},
|
||||
test_write_dec_all_bytes_asm},
|
||||
{{"WRITE NOP 1x3 ASM", "WRITE NOP 1x3 ASM WITH MALLOC"},
|
||||
test_write_nop_1x3_all_bytes_asm},
|
||||
{{"WRITE NOP 1x9 ASM", "WRITE NOP 1x9 ASM WITH MALLOC"},
|
||||
test_write_nop_1x9_all_bytes_asm},
|
||||
// {{"WRITE INC ASM", "WRITE INC ASM WITH MALLOC"},
|
||||
// test_write_inc_all_bytes_asm},
|
||||
// {{"WRITE DEC ASM", "WRITE DEC ASM WITH MALLOC"},
|
||||
// test_write_dec_all_bytes_asm},
|
||||
// {{"READ", "READ WITH MALLOC"}, test_read},
|
||||
// {{"FREAD", "FREAD WITH MALLOC"}, test_fread},
|
||||
};
|
||||
@ -253,6 +261,56 @@ void test_write_nop_all_bytes_asm(reptester *tester, alloc_type type) {
|
||||
handle_free(tester, type);
|
||||
}
|
||||
|
||||
void test_write_nop_1x3_all_bytes_asm(reptester *tester, alloc_type 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;
|
||||
|
||||
nop_1x3_all_bytes_asm(total_size);
|
||||
|
||||
u64 fault_count_end = page_fault_count();
|
||||
u64 end = read_cpu_timer();
|
||||
|
||||
u64 read_time = end - start;
|
||||
u64 page_faults = fault_count_end - fault_count_start;
|
||||
|
||||
tester->results = {
|
||||
total_size,
|
||||
read_time,
|
||||
page_faults,
|
||||
};
|
||||
|
||||
handle_free(tester, type);
|
||||
}
|
||||
|
||||
void test_write_nop_1x9_all_bytes_asm(reptester *tester, alloc_type 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;
|
||||
|
||||
nop_1x9_all_bytes_asm(total_size);
|
||||
|
||||
u64 fault_count_end = page_fault_count();
|
||||
u64 end = read_cpu_timer();
|
||||
|
||||
u64 read_time = end - start;
|
||||
u64 page_faults = fault_count_end - fault_count_start;
|
||||
|
||||
tester->results = {
|
||||
total_size,
|
||||
read_time,
|
||||
page_faults,
|
||||
};
|
||||
|
||||
handle_free(tester, type);
|
||||
}
|
||||
|
||||
void test_write_inc_all_bytes_asm(reptester *tester, alloc_type type) {
|
||||
u64 start = read_cpu_timer();
|
||||
u64 fault_count_start = page_fault_count();
|
||||
|
@ -1,5 +1,7 @@
|
||||
global mov_all_bytes_asm
|
||||
global nop_all_bytes_asm
|
||||
global nop_1x3_all_bytes_asm
|
||||
global nop_1x9_all_bytes_asm
|
||||
global inc_all_bytes_asm
|
||||
global dec_all_bytes_asm
|
||||
|
||||
@ -25,6 +27,38 @@ nop_all_bytes_asm:
|
||||
|
||||
ret
|
||||
|
||||
nop_1x3_all_bytes_asm:
|
||||
xor rax, rax
|
||||
|
||||
.loop:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
inc rax
|
||||
cmp rdi, rax
|
||||
jne .loop
|
||||
|
||||
ret
|
||||
|
||||
nop_1x9_all_bytes_asm:
|
||||
xor rax, rax
|
||||
|
||||
.loop:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
inc rax
|
||||
cmp rdi, rax
|
||||
jne .loop
|
||||
|
||||
ret
|
||||
|
||||
inc_all_bytes_asm:
|
||||
xor rax, rax
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user