예제 #1
0
 def run_as_package(self):
     """Runs program as Python package."""
     pkg_code = base_profile.get_package_code(self._run_object)
     with _CodeHeatmapCalculator() as prof:
         for _, compiled_code in pkg_code.values():
             prof.add_code(compiled_code)
         try:
             runpy.run_path(self._run_object)
         except SystemExit:
             pass
     return self._consodalidate_stats(pkg_code, prof)
예제 #2
0
 def run_as_package_in_namespace(self):
     """Runs object as package in Python namespace."""
     import runpy
     pkg_code = base_profile.get_package_code(self._run_object)
     with CodeEventsTracker() as prof:
         for _, compiled_code in pkg_code.values():
             prof.add_code(compiled_code)
         try:
             runpy.run_module(self._run_object, run_name='__main__')
         except SystemExit:
             pass
     return prof.events_list
예제 #3
0
 def run_as_package(self):
     """Runs program as package."""
     pkg_code = base_profile.get_package_code(self._run_object)
     with _CodeEventsTracker() as prof:
         for _, compiled_code in pkg_code.values():
             prof.add_code(compiled_code)
         try:
             prof.compute_mem_overhead()
             runpy.run_path(self._run_object, run_name='__main__')
         except SystemExit:
             pass
     return prof
예제 #4
0
 def run_as_package_in_namespace(self):
     """Runs program as package in Python namespace."""
     import runpy
     pkg_code = base_profile.get_package_code(self._run_object)
     with CodeHeatmapCalculator() as prof:
         for _, compiled_code in pkg_code.values():
             prof.add_code(compiled_code)
         try:
             runpy.run_module(self._run_object)
         except SystemExit:
             pass
     return self._consodalidate_stats(pkg_code, prof)
예제 #5
0
 def run_as_package_in_namespace(self):
     """Runs object as package in Python namespace."""
     import runpy
     pkg_code = base_profile.get_package_code(self._run_object)
     with CodeEventsTracker() as prof:
         for _, compiled_code in pkg_code.values():
             prof.add_code(compiled_code)
         try:
             runpy.run_module(self._run_object, run_name='__main__')
         except SystemExit:
             pass
     return prof.events_list
예제 #6
0
 def run_as_package_path(self):
     """Runs program as package specified with file path."""
     import runpy
     pkg_code = base_profile.get_package_code(self._run_object,
                                              name_is_path=True)
     with CodeEventsTracker() as prof:
         for _, compiled_code in pkg_code.values():
             prof.add_code(compiled_code)
         try:
             runpy.run_path(self._run_object, run_name='__main__')
         except SystemExit:
             pass
     return prof.events_list
예제 #7
0
 def run_as_package_path(self):
     """Runs program as package specified with file path."""
     import runpy
     pkg_code = base_profile.get_package_code(
         self._run_object, name_is_path=True)
     with CodeHeatmapCalculator() as prof:
         for _, compiled_code in pkg_code.values():
             prof.add_code(compiled_code)
         try:
             runpy.run_path(self._run_object)
         except SystemExit:
             pass
     return self._consodalidate_stats(pkg_code, prof)
예제 #8
0
 def run_as_package_path(self):
     """Runs program as package specified with file path."""
     import runpy
     pkg_code = base_profile.get_package_code(
         self._run_object, name_is_path=True)
     with CodeEventsTracker() as prof:
         for _, compiled_code in pkg_code.values():
             prof.add_code(compiled_code)
         try:
             runpy.run_path(self._run_object, run_name='__main__')
         except SystemExit:
             pass
     return prof.events_list
예제 #9
0
 def run_as_package_path(self):
     """Runs program as package specified with file path."""
     import runpy
     pkg_code = base_profile.get_package_code(self._run_object,
                                              name_is_path=True)
     with CodeHeatmapCalculator() as prof:
         for _, compiled_code in pkg_code.values():
             prof.add_code(compiled_code)
         try:
             runpy.run_path(self._run_object)
         except SystemExit:
             pass
     return self._consodalidate_stats(pkg_code, prof)
예제 #10
0
 def run_as_package_in_namespace(self):
     """Runs program as package in Python namespace."""
     import runpy
     pkg_code = base_profile.get_package_code(self._run_object)
     with CodeHeatmapCalculator() as prof:
         for _, compiled_code in pkg_code.values():
             prof.add_code(compiled_code)
         try:
             runpy.run_module(self._run_object)
         except ImportError:
             raise CodeHeatmapRunError('Unable to run package %s' %
                                       self._run_object)
         except SystemExit:
             pass
     return self._consodalidate_stats(pkg_code, prof)