Skip to content

Commit

Permalink
Fixed mocking for DFTracer (#220)
Browse files Browse the repository at this point in the history
* Fixed mocking for DFTracer

The current mocking was not following the correct signature as used in DFTracer

* Fixed typo

* Update utility.py

Make it more generic

---------

Co-authored-by: Huihuo Zheng <[email protected]>
  • Loading branch information
hariharan-devarajan and zhenghh04 authored Aug 27, 2024
1 parent 866828c commit f764d93
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions dlio_benchmark/utils/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,42 @@
from dftracer.logger import dftracer as PerfTrace, dft_fn as Profile, DFTRACER_ENABLE as DFTRACER_ENABLE
except:
class Profile(object):
def __init__(self, name=None, cat=None):
self.type = type
def log(self, func):
return func
def log_init(self, func):
return func
def iter(self, a):
return a
def __init__(self, **kwargs):
return
def log(self, **kwargs):
return
def log_init(self, **kwargs):
return
def iter(self, **kwargs):
return
def __enter__(self):
return
def __exit__(self, type, value, traceback):
def __exit__(self, **kwargs):
return
def update(self, *, epoch=0, step=0, size=0, default=None):
def update(self, **kwargs):
return
def flush(self):
return
def reset(self):
return
def log_static(self, **kwargs):
return
class dftracer(object):
def __init__(self,):
self.type = None
def initialize_log(self, logfile=None, data_dir=None, process_id=-1):
def initialize_log(self, **kwargs):
return
def get_time(self):
return
def enter_event(self):
return
def exit_event(self):
return
def log_event(self, **kwargs):
return
def finalize(self):
return
def iter(self, a):
return a

PerfTrace = dftracer()
DFTRACER_ENABLE = False

Expand Down

0 comments on commit f764d93

Please sign in to comment.