예제 #1
0
 def __exit__(self, exec_type, exec_value, exec_tb):
   if not self._enabled:
     return
   print_mdl.DeleteProfiler()
   setattr(session.BaseSession, 'run', self.old_run)
   setattr(session.BaseSession, '__init__', self.old_init)
   setattr(session.BaseSession, '_profiler_run_internal', None)
   setattr(session.BaseSession, '_profiler_init_internal', None)
   setattr(session.BaseSession, 'profile_context', None)
예제 #2
0
def ProfilerFromFile(profile_file):
    """Initialize a profiler from profile file."""
    print_mdl.ProfilerFromFile(compat.as_bytes(profile_file))
    profiler = model_analyzer.Profiler.__new__(model_analyzer.Profiler)
    yield profiler
    print_mdl.DeleteProfiler()
예제 #3
0
 def __del__(self):
   print_mdl.DeleteProfiler()