// File: /workspace/github_cpp_makefile_star2_O2/narges64[P]SIMBA/common.cpp
// Function: ssd_info::ssd_info(parameter_value*, char*)
ssd_info::ssd_info(parameter_value * parameters, char * statistics_filename)
{
	current_time = 0;
	parameter = parameters;
	int over_provide = 100.0 * parameters->overprovide;

	// repeat_times = new int[parameters->consolidation_degree];
	last_times = 0; // new int64_t [parameters->consolidation_degree];
	// for (int cd = 0; cd < parameters->consolidation_degree; cd++){
	repeat_times=0; 
	//	last_times[cd]=0;
	//	tracefile[cd] = NULL;
	// }

	lun_token = 0;

	request_sequence_number = 0;
	subrequest_sequence_number = 0;
	gc_sequence_number = 0;

	request_queue_length = 0;
	request_queue = NULL;
	stats = new statistics(parameters->consolidation_degree);

	dram = new dram_info(parameters);

	channel_head= new channel_info *[parameters->channel_number];
	for (int i = 0; i < parameters->channel_number; i++){
		channel_head[i] = new channel_info(i, parameters);
	}

	statisticfile=fopen(statistics_filename,"w");
	if(statisticfile==NULL)
	{
		printf("the statistic file can't open\n");
		return;
	}

	fprintf(statisticfile,"-----------------------parameter file----------------------\n");
	parameters->print_all_parameters(statisticfile);
	fprintf(statisticfile,"\n");
	fprintf(statisticfile,"-----------------------simulation output----------------------\n");
	fflush(statisticfile);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
andl $0x0, 0x88(%rdi)
movups %xmm0, 0x78(%rdi)
andq $0x0, (%rdi)
movq %rsi, 0x58(%rdi)
andq $0x0, 0x38(%rdi)
andl $0x0, 0x30(%rdi)
movq %rdx, %r15
andl $0x0, 0x1c(%rdi)
andq $0x0, 0x68(%rdi)
movups %xmm0, 0x8(%rdi)
movl $0x1d0, %edi            # imm = 0x1D0
callq 0x2160
movq %rax, %r12
movl 0x64(%r14), %esi
movq %rax, %rdi
callq 0x39a2
movq %r12, 0x98(%rbx)
pushq $0x28
popq %rdi
callq 0x2160
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x3b52
movq %r12, 0x60(%rbx)
movl 0x98(%r14), %ebp
movq %rbp, %rdi
shlq $0x3, %rdi
callq 0x2040
movq %rax, 0x90(%rbx)
xorl %r12d, %r12d
pushq $0x60
popq %r13
movl %ebp, %eax
cmpq %rax, %r12
jae 0x3864
movq %r13, %rdi
callq 0x2160
movq %rax, %rbp
movq %rax, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0x3ec6
movq 0x90(%rbx), %rax
movq %rbp, (%rax,%r12,8)
incq %r12
movl 0x98(%r14), %ebp
jmp 0x382d
leaq 0x57f0(%rip), %rsi      # 0x905b
movq %r15, %rdi
callq 0x21d0
movq %rax, 0x50(%rbx)
testq %rax, %rax
je 0x38da
leaq 0x57da(%rip), %rdi      # 0x905d
pushq $0x3c
popq %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
movq %rax, %rcx
callq 0x22e0
movq 0x50(%rbx), %rsi
movq %r14, %rdi
callq 0x3732
movq 0x50(%rbx), %rsi
pushq $0xa
popq %rdi
callq 0x21f0
movq 0x50(%rbx), %rcx
leaq 0x57e2(%rip), %rdi      # 0x909a
pushq $0x3f
popq %rsi
movq %r15, %rdx
callq 0x22e0
movq 0x50(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21c0
leaq 0x5b84(%rip), %rdi      # 0x9465
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2270
movq %rax, %rbx
pushq $0x28
popq %rsi
jmp 0x3904
movq %rax, %rbx
movl $0x1d0, %esi            # imm = 0x1D0
movq %r12, %rdi
jmp 0x3912
movq %rax, %rbx
pushq $0x60
popq %rsi
movq %rbp, %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x22b0
nop