| 1 |
import sys |
| 2 |
from pypy.interpreter.mixedmodule import MixedModule |
| 3 |
from rpython.rlib.rvmprof import VMProfPlatformUnsupported |
| 4 |
from rpython.rlib import rvmprof |
| 5 |
from rpython.translator.platform import CompilationError |
| 6 |
|
| 7 |
|
| 8 |
class Module(MixedModule): |
| 9 |
""" |
| 10 |
VMProf for PyPy: a statistical profiler |
| 11 |
""" |
| 12 |
appleveldefs = { |
| 13 |
} |
| 14 |
if sys.platform.startswith('linux'): |
| 15 |
appleveldefs['resolve_addr'] = 'app_vmprof.resolve_addr' |
| 16 |
appleveldefs['resolve_many_addr'] = 'app_vmprof.resolve_many_addr' |
| 17 |
|
| 18 |
interpleveldefs = { |
| 19 |
'enable': 'interp_vmprof.enable', |
| 20 |
'disable': 'interp_vmprof.disable', |
| 21 |
'is_enabled': 'interp_vmprof.is_enabled', |
| 22 |
'get_profile_path': 'interp_vmprof.get_profile_path', |
| 23 |
'stop_sampling': 'interp_vmprof.stop_sampling', |
| 24 |
'start_sampling': 'interp_vmprof.start_sampling', |
| 25 |
|
| 26 |
'VMProfError': 'space.fromcache(interp_vmprof.Cache).w_VMProfError', |
| 27 |
} |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
try: |
| 36 |
import pypy.module._vmprof.interp_vmprof |
| 37 |
except VMProfPlatformUnsupported as e: |
| 38 |
pass |
| 39 |
except CompilationError as e: |
| 40 |
import sys |
| 41 |
if sys.platform == 'win32': |
| 42 |
pass |
| 43 |
else: |
| 44 |
raise |