Additional assembly loops
This commit is contained in:
		@@ -11,6 +11,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
extern "C" void mov_all_bytes_asm(char *buffer, u64 size);
 | 
					extern "C" void mov_all_bytes_asm(char *buffer, u64 size);
 | 
				
			||||||
extern "C" void nop_all_bytes_asm(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 inc_all_bytes_asm(u64 size);
 | 
				
			||||||
extern "C" void dec_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(reptester *tester, alloc_type type);
 | 
				
			||||||
void test_write_mov_all_bytes_asm(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_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_inc_all_bytes_asm(reptester *tester, alloc_type type);
 | 
				
			||||||
void test_write_dec_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);
 | 
					u64 get_file_length(FILE *fp);
 | 
				
			||||||
@@ -73,15 +77,19 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  func_data funcs[] = {
 | 
					  func_data funcs[] = {
 | 
				
			||||||
      {{"WRITE", "WRITE WITH MALLOC"}, test_write},
 | 
					      // {{"WRITE", "WRITE WITH MALLOC"}, test_write},
 | 
				
			||||||
      {{"WRITE MOV ASM", "WRITE MOV ASM WITH MALLOC"},
 | 
					      // {{"WRITE MOV ASM", "WRITE MOV ASM WITH MALLOC"},
 | 
				
			||||||
       test_write_mov_all_bytes_asm},
 | 
					      //  test_write_mov_all_bytes_asm},
 | 
				
			||||||
      {{"WRITE NOP ASM", "WRITE NOP ASM WITH MALLOC"},
 | 
					      {{"WRITE NOP ASM", "WRITE NOP ASM WITH MALLOC"},
 | 
				
			||||||
       test_write_nop_all_bytes_asm},
 | 
					       test_write_nop_all_bytes_asm},
 | 
				
			||||||
      {{"WRITE INC ASM", "WRITE INC ASM WITH MALLOC"},
 | 
					      {{"WRITE NOP 1x3 ASM", "WRITE NOP 1x3 ASM WITH MALLOC"},
 | 
				
			||||||
       test_write_inc_all_bytes_asm},
 | 
					       test_write_nop_1x3_all_bytes_asm},
 | 
				
			||||||
      {{"WRITE DEC ASM", "WRITE DEC ASM WITH MALLOC"},
 | 
					      {{"WRITE NOP 1x9 ASM", "WRITE NOP 1x9 ASM WITH MALLOC"},
 | 
				
			||||||
       test_write_dec_all_bytes_asm},
 | 
					       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},
 | 
					      // {{"READ", "READ WITH MALLOC"}, test_read},
 | 
				
			||||||
      // {{"FREAD", "FREAD WITH MALLOC"}, test_fread},
 | 
					      // {{"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);
 | 
					  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) {
 | 
					void test_write_inc_all_bytes_asm(reptester *tester, alloc_type type) {
 | 
				
			||||||
  u64 start = read_cpu_timer();
 | 
					  u64 start = read_cpu_timer();
 | 
				
			||||||
  u64 fault_count_start = page_fault_count();
 | 
					  u64 fault_count_start = page_fault_count();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,7 @@
 | 
				
			|||||||
global mov_all_bytes_asm
 | 
					global mov_all_bytes_asm
 | 
				
			||||||
global nop_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 inc_all_bytes_asm
 | 
				
			||||||
global dec_all_bytes_asm
 | 
					global dec_all_bytes_asm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -25,6 +27,38 @@ nop_all_bytes_asm:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ret
 | 
						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:
 | 
					inc_all_bytes_asm:
 | 
				
			||||||
	xor rax, rax
 | 
						xor rax, rax
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user