Esempio n. 1
0
def traceback(estimate_number_of_entries):
    """Build and return a vmprof-like traceback, as a pair (array_p,
    array_length).  The caller must free array_p.  Not for signal handlers:
    for these, call vmprof_get_traceback() from C code.
    """
    _cintf = rvmprof._get_vmprof().cintf
    size = estimate_number_of_entries * 2 + 4
    stack = cintf.get_rvmprof_stack()
    array_p = lltype.malloc(rffi.SIGNEDP.TO, size, flavor='raw')
    NULL = llmemory.NULL
    array_length = _cintf.vmprof_get_traceback(stack, NULL, array_p, size)
    return (array_p, array_length)
Esempio n. 2
0
def get_profile_path(space):
    vmp = _get_vmprof()
    if not vmp.is_enabled:
        return None

    with rffi.scoped_alloc_buffer(4096) as buf:
        length = vmp.cintf.vmprof_get_profile_path(buf.raw, buf.size)
        if length == -1:
            return ""
        return buf.str(length)

    return None
Esempio n. 3
0
def start_sampling():
    return _get_vmprof().start_sampling()
Esempio n. 4
0
def stop_sampling():
    return _get_vmprof().stop_sampling()
Esempio n. 5
0
def is_enabled():
    vmp = _get_vmprof()
    return vmp.is_enabled
Esempio n. 6
0
def enable(fileno, interval, memory=0, native=0, real_time=0):
    _get_vmprof().enable(fileno, interval, memory, native, real_time)
Esempio n. 7
0
def disable():
    _get_vmprof().disable()
Esempio n. 8
0
def register_code_object_class(CodeClass, full_name_func):
    _get_vmprof().register_code_object_class(CodeClass, full_name_func)
Esempio n. 9
0
def register_code(code, name):
    _get_vmprof().register_code(code, name)
Esempio n. 10
0
def enable(fileno, interval):
    _get_vmprof().enable(fileno, interval)
Esempio n. 11
0
def disable():
    _get_vmprof().disable()
Esempio n. 12
0
def register_code(code, name):
    _get_vmprof().register_code(code, name)
Esempio n. 13
0
def register_code_object_class(CodeClass, full_name_func):
    _get_vmprof().register_code_object_class(CodeClass, full_name_func)
Esempio n. 14
0
def start_sampling(space):
    _get_vmprof().cintf.vmprof_start_sampling()
Esempio n. 15
0
def stop_sampling(space):
    fd = _get_vmprof().cintf.vmprof_stop_sampling()
    return rffi.cast(lltype.Signed, fd)
Esempio n. 16
0
def enable(fileno, interval):
    _get_vmprof().enable(fileno, interval)