Skip to content

Commit 8a89949

Browse files
committed
add trace cache read/write
Signed-off-by: KantaTamura <[email protected]>
1 parent a57d973 commit 8a89949

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pfio/cache/multiprocess_file_cache.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ def _get(self, i):
241241
fcntl.flock(self.cache_fd, fcntl.LOCK_UN)
242242
return None
243243

244-
data = os.pread(self.cache_fd, l, o)
244+
with record("pfio.cache.multiprocessfile:get:read",
245+
trace=self.trace):
246+
data = os.pread(self.cache_fd, l, o)
245247
assert len(data) == l
246248
fcntl.flock(self.cache_fd, fcntl.LOCK_UN)
247249

@@ -298,7 +300,9 @@ def _put(self, i, data):
298300
index_entry = pack('Qq', data_pos, len(data))
299301
assert os.pwrite(self.cache_fd,
300302
index_entry, index_ofst) == self.buflen
301-
assert os.pwrite(self.cache_fd, data, data_pos) == len(data)
303+
with record("pfio.cache.multiprocessfile:put:write",
304+
trace=self.trace):
305+
assert os.pwrite(self.cache_fd, data, data_pos) == len(data)
302306
os.fsync(self.cache_fd)
303307
fcntl.flock(self.cache_fd, fcntl.LOCK_UN)
304308

0 commit comments

Comments
 (0)