Skip to content

Commit da1706c

Browse files
authored
Merge pull request #328 from harriscr/ch_wip_pp_ti
Fixes for post_processing code for the total_iodepth feature from PR 324. This code can be merged without the total_iodepth feature as it does not alter existing post processing behaviour
2 parents c33c8c8 + 4cd22ee commit da1706c

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

post_processing/formatter/test_run_result.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ def _convert_file(self, file_path: Path) -> None:
8686

8787
with open(str(file_path), "r", encoding="utf8") as file:
8888
data: dict[str, Any] = json.load(file)
89-
iodepth: str = f"{data['global options']['iodepth']}"
89+
iodepth: str = self._get_iodepth(
90+
f"{data['global options']['iodepth']}", f"{data['global options']['write_iops_log']}"
91+
)
9092
blocksize: str = f"{data['global options']['bs']}"
9193
operation: str = f"{data['global options']['rw']}"
9294
global_details: IODEPTH_DETAILS_TYPE = self._get_global_options(data["global options"])
@@ -305,3 +307,29 @@ def _sum_standard_deviation_values(
305307
)
306308

307309
return latency_standard_deviation
310+
311+
def _get_iodepth(self, iodepth_value: str, logfile_name: str) -> str:
312+
"""
313+
Checks to see if the iodepth encoded in the logfile name matches
314+
the iodepth in the output file. If it does, return the iodepth
315+
from the file, otherwise return the iodepth parsed from the
316+
log file path
317+
"""
318+
iodepth: int = int(iodepth_value)
319+
320+
# the logfile name is of the format:
321+
# /tmp/cbt/00000000/LibrbdFio/randwrite_1048576/iodepth-001/numjobs-001/output.0
322+
iodepth_start_index: int = logfile_name.find("iodepth")
323+
numjobs_start_index: int = logfile_name.find("numjobs")
324+
# an index of -1 is no match found, so do nothing
325+
if iodepth_start_index != -1 and numjobs_start_index != -1:
326+
iodepth_end_index: int = iodepth_start_index + len("iodepth")
327+
iodepth_string: str = logfile_name[iodepth_end_index + 1 : numjobs_start_index - 1]
328+
logfile_iodepth: int = int(iodepth_string)
329+
330+
if logfile_iodepth > iodepth:
331+
iodepth = logfile_iodepth
332+
333+
return str(iodepth)
334+
335+
__test__ = False

0 commit comments

Comments
 (0)