vprof/profiler.py
def _profile_module(self):
        """Runs cProfile on a module."""
        prof = cProfile.Profile()
        try:
            with open(self._run_object, 'rb') as srcfile:
                code = compile(srcfile.read(), self._run_object, 'exec')
            prof.runctx(code, self._globs, None)
        except SystemExit:
            pass
        prof_stats = pstats.Stats(prof)
        prof_stats.calc_callees()
        return {
            'objectName': self._object_name,
            'callStats': self._transform_stats(prof_stats),
            'totalTime': prof_stats.total_tt,
            'primitiveCalls': prof_stats.prim_calls,
            'totalCalls': prof_stats.total_calls,
            'timestamp': int(time.time())
        }
def _profile_module(self):
        """Runs cProfile on a module."""
        prof = cProfile.Profile()
        try:
            with open(self._run_object, 'rb') as srcfile:
                code = compile(srcfile.read(), self._run_object, 'exec')
            prof.runctx(code, self._globs, None)
        except SystemExit:
            pass
        prof_stats = pstats.Stats(prof)
        prof_stats.calc_callees()
        return {
            'objectName': self._object_name,
            'callStats': self._transform_stats(prof_stats),
            'totalTime': prof_stats.total_tt,
            'primitiveCalls': prof_stats.prim_calls,
            'totalCalls': prof_stats.total_calls,
            'timestamp': int(time.time())
        }
def _profile_module ( self ) : prof = cProfile . Profile ( ) try : with open ( self . _run_object , 'rb' ) as srcfile : code = compile ( srcfile . read ( ) , self . _run_object , 'exec' ) prof . runctx ( code , self . _globs , None ) except SystemExit : pass prof_stats = pstats . Stats ( prof ) prof_stats . calc_callees ( ) return { 'objectName' : self . _object_name , 'callStats' : self . _transform_stats ( prof_stats ) , 'totalTime' : prof_stats . total_tt , 'primitiveCalls' : prof_stats . prim_calls , 'totalCalls' : prof_stats . total_calls , 'timestamp' : int ( time . time ( ) ) }
Runs cProfile on a module.
Runs cProfile on a module .