File: moduledef.py

package info (click to toggle)
pypy3 7.3.19%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 212,236 kB
  • sloc: python: 2,098,316; ansic: 540,565; sh: 21,462; asm: 14,419; cpp: 4,451; makefile: 4,209; objc: 761; xml: 530; exp: 499; javascript: 314; pascal: 244; lisp: 45; csh: 12; awk: 4
file content (44 lines) | stat: -rw-r--r-- 1,433 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import sys
from pypy.interpreter.mixedmodule import MixedModule
from rpython.rlib.rvmprof import VMProfPlatformUnsupported
from rpython.rlib import rvmprof
from rpython.translator.platform import CompilationError


class Module(MixedModule):
    """
    VMProf for PyPy: a statistical profiler
    """
    appleveldefs = {
    }
    if sys.platform.startswith('linux'):
        appleveldefs['resolve_addr'] = 'app_vmprof.resolve_addr'
        appleveldefs['resolve_many_addrs'] = 'app_vmprof.resolve_many_addrs'

    interpleveldefs = {
        'enable': 'interp_vmprof.enable',
        'disable': 'interp_vmprof.disable',
        'is_enabled': 'interp_vmprof.is_enabled',
        'get_profile_path': 'interp_vmprof.get_profile_path',
        'stop_sampling': 'interp_vmprof.stop_sampling',
        'start_sampling': 'interp_vmprof.start_sampling',

        'VMProfError': 'space.fromcache(interp_vmprof.Cache).w_VMProfError',
    }


# Force the __extend__ hacks and method replacements to occur
# early.  Without this, for example, 'PyCode._init_ready' was
# already found by the annotator to be the original empty
# method, and the annotator doesn't notice that interp_vmprof.py
# (loaded later) replaces this method.
try:
    import pypy.module._vmprof.interp_vmprof
except VMProfPlatformUnsupported as e:
    pass
except CompilationError as e:
    import sys
    if sys.platform == 'win32':
        pass
    else:
        raise