Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 29 additions & 16 deletions src/host/IO_Flow_Base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions src/host/IO_Flow_Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/host/IO_Flow_Integration_Based.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
1 change: 1 addition & 0 deletions src/host/IO_Flow_Synthetic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 8 additions & 2 deletions src/host/IO_Flow_Trace_Based.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand All @@ -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();
Expand Down