diff --git a/src/host/IO_Flow_Base.cpp b/src/host/IO_Flow_Base.cpp index 3ee07433..948d8008 100644 --- a/src/host/IO_Flow_Base.cpp +++ b/src/host/IO_Flow_Base.cpp @@ -36,7 +36,7 @@ IO_Flow_Base::IO_Flow_Base(const sim_object_id_type &name, uint16_t flow_id, LHA STAT_min_request_delay(MAXIMUM_TIME), STAT_min_request_delay_read(MAXIMUM_TIME), STAT_min_request_delay_write(MAXIMUM_TIME), STAT_max_request_delay(0), STAT_max_request_delay_read(0), STAT_max_request_delay_write(0), STAT_transferred_bytes_total(0), STAT_transferred_bytes_read(0), STAT_transferred_bytes_write(0), progress(0), next_progress_step(0), - enabled_logging(enabled_logging), logging_period(logging_period), logging_file_path(logging_file_path) + enabled_logging(enabled_logging), logging_period(logging_period), logging_file_path(logging_file_path), total_write_requests_to_be_generated(0) { Host_IO_Request *t = NULL; @@ -564,21 +564,34 @@ IO_Flow_Base::IO_Flow_Base(const sim_object_id_type &name, uint16_t flow_id, LHA std::string val = ID(); xmlwriter.Write_attribute_string(attr, val); - attr = "Request_Count"; - val = std::to_string(STAT_generated_request_count); - xmlwriter.Write_attribute_string(attr, val); - - attr = "Read_Request_Count"; - val = std::to_string(STAT_generated_read_request_count); - xmlwriter.Write_attribute_string(attr, val); - - attr = "Write_Request_Count"; - val = std::to_string(STAT_generated_write_request_count); - xmlwriter.Write_attribute_string(attr, val); - - attr = "IOPS"; - val = std::to_string((double)STAT_generated_request_count / (Simulator->Time() / SIM_TIME_TO_SECONDS_COEFF)); - xmlwriter.Write_attribute_string(attr, val); + attr = "Request_Count"; + val = std::to_string(STAT_generated_request_count); + xmlwriter.Write_attribute_string(attr, val); + + attr = "Read_Request_Count"; + val = std::to_string(STAT_generated_read_request_count); + xmlwriter.Write_attribute_string(attr, val); + + attr = "Write_Request_Count"; + val = std::to_string(STAT_generated_write_request_count); + xmlwriter.Write_attribute_string(attr, val); + attr = "Host_Write_Request_Count"; + val = std::to_string(total_write_requests_to_be_generated); + xmlwriter.Write_attribute_string(attr, val); + + attr = "Actual_Writes_on_Flash"; + val = std::to_string(Simulator->stats->IssuedProgramCMD + Simulator->stats->IssuedMultiplaneProgramCMD); + xmlwriter.Write_attribute_string(attr, val); + + attr = "Write_Amplification"; + val = std::to_string( + (double) (Simulator->stats->IssuedProgramCMD + Simulator->stats->IssuedMultiplaneProgramCMD) / + total_write_requests_to_be_generated); + + xmlwriter.Write_attribute_string(attr, val); + attr = "IOPS"; + val = std::to_string((double) STAT_generated_request_count / (Simulator->Time() / SIM_TIME_TO_SECONDS_COEFF)); + xmlwriter.Write_attribute_string(attr, val); attr = "IOPS_Read"; val = std::to_string((double)STAT_generated_read_request_count / (Simulator->Time() / SIM_TIME_TO_SECONDS_COEFF)); diff --git a/src/host/IO_Flow_Base.h b/src/host/IO_Flow_Base.h index ae864b6c..ee83e67a 100644 --- a/src/host/IO_Flow_Base.h +++ b/src/host/IO_Flow_Base.h @@ -73,6 +73,7 @@ namespace Host_Components double initial_occupancy_ratio;//The initial amount of valid logical pages when pereconditioning is performed sim_time_type stop_time;//The flow stops generating request when simulation time reaches stop_time unsigned int total_requests_to_be_generated;//If stop_time is zero, then the flow stops generating request when the number of generated requests is equal to total_req_count + unsigned int total_write_requests_to_be_generated; // To Calculate Write Amplification we need to first see how many write requests are actually being made by the host HostInterface_Types SSD_device_type; PCIe_Root_Complex* pcie_root_complex; SATA_HBA* sata_hba; diff --git a/src/host/IO_Flow_Integration_Based.cpp b/src/host/IO_Flow_Integration_Based.cpp index 478e9fa0..a20ea4d8 100644 --- a/src/host/IO_Flow_Integration_Based.cpp +++ b/src/host/IO_Flow_Integration_Based.cpp @@ -58,6 +58,7 @@ namespace Host_Components { if (user_data_req->type == kREQUEST_TYPE::WRITE) { request->Type = Host_IO_Request_Type::WRITE; STAT_generated_write_request_count++; + ++total_write_requests_to_be_generated; } else { request->Type = Host_IO_Request_Type::READ; STAT_generated_read_request_count++; diff --git a/src/host/IO_Flow_Synthetic.cpp b/src/host/IO_Flow_Synthetic.cpp index 966e2340..10d7fa5c 100644 --- a/src/host/IO_Flow_Synthetic.cpp +++ b/src/host/IO_Flow_Synthetic.cpp @@ -88,6 +88,7 @@ IO_Flow_Synthetic::IO_Flow_Synthetic(const sim_object_id_type &name, uint16_t fl } else { request->Type = Host_IO_Request_Type::WRITE; STAT_generated_write_request_count++; + ++total_write_requests_to_be_generated; } switch (request_size_distribution) { diff --git a/src/host/IO_Flow_Trace_Based.cpp b/src/host/IO_Flow_Trace_Based.cpp index 5a8505d2..53de4529 100644 --- a/src/host/IO_Flow_Trace_Based.cpp +++ b/src/host/IO_Flow_Trace_Based.cpp @@ -140,6 +140,7 @@ void IO_Flow_Trace_Based::Start_simulation() PRINT_MESSAGE("Investigating input trace file: " << trace_file_path); sim_time_type last_request_arrival_time = 0; + auto total_write_requests_in_file = 0; while (std::getline(trace_file, trace_line)) { Utils::Helper_Functions::Remove_cr(trace_line); @@ -150,6 +151,9 @@ void IO_Flow_Trace_Based::Start_simulation() break; } total_requests_in_file++; + if (current_trace_line[ASCIITraceTypeColumn] == ASCIITraceWriteCode) { + ++total_write_requests_in_file; + } sim_time_type prev_time = last_request_arrival_time; last_request_arrival_time = std::strtoll(current_trace_line[ASCIITraceTimeColumn].c_str(), &pEnd, 10); if (last_request_arrival_time < prev_time) @@ -164,11 +168,13 @@ void IO_Flow_Trace_Based::Start_simulation() if (total_replay_no == 1) { total_requests_to_be_generated = (int)(((double)percentage_to_be_simulated / 100) * total_requests_in_file); - } + total_write_requests_to_be_generated += (int)(((double)percentage_to_be_simulated / 100) * total_write_requests_in_file); + } else { total_requests_to_be_generated = total_requests_in_file * total_replay_no; - } + total_write_requests_to_be_generated += (int)(((double)percentage_to_be_simulated / 100) * total_write_requests_in_file); + } trace_file.open(trace_file_path); current_trace_line.clear();