Skip to content

Commit

Permalink
pyocf: rio: reads and writes accounting
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Mielewczyk <[email protected]>
  • Loading branch information
mmichal10 committed Oct 2, 2024
1 parent 818dacf commit a402060
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/functional/pyocf/rio.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def __init__(self, jobspec: JobSpec, queue):
self.ios = Size(0)
self.io_target = 0
self.finish_time = None
self.submitted_reads = 0
self.submitted_writes = 0

self.qd_condition = Condition()
self.qd = 0
Expand Down Expand Up @@ -159,6 +161,12 @@ def run(self):
io.callback = self.get_io_cb()
self.ios += self.jobspec.bs
io.submit()

if iodir is IoDir.WRITE:
self.submitted_writes += 1
if iodir is IoDir.READ:
self.submitted_reads += 1

with self.qd_condition:
self.qd += 1

Expand All @@ -172,6 +180,8 @@ def __init__(self):
self._threads = []
self.errors = {}
self.error_count = 0
self.submitted_reads = 0
self.submitted_writes = 0

def copy(self):
r = copy.copy(self)
Expand Down Expand Up @@ -254,6 +264,8 @@ def wait_for_completion(self):
thread.join()
self.errors.update({thread.name: thread.errors})
self.error_count += len(thread.errors)
self.submitted_reads = thread.submitted_reads
self.submitted_writes = thread.submitted_writes

self.global_jobspec.target.close()

Expand Down

0 comments on commit a402060

Please sign in to comment.