本文整理汇总了Python中pypy.rlib.debug.debug_start函数的典型用法代码示例。如果您正苦于以下问题:Python debug_start函数的具体用法?Python debug_start怎么用?Python debug_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug_start函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: debug_collect_start
def debug_collect_start(self, requested_size):
if 1:# have_debug_prints():
debug_start("gc-collect")
debug_print()
debug_print(".----------- Full collection -------------------")
debug_print("| requested size:",
requested_size)
示例2: optimize_loop
def optimize_loop(metainterp_sd, old_loop_tokens, loop, enable_opts):
debug_start("jit-optimize")
try:
return _optimize_loop(metainterp_sd, old_loop_tokens, loop,
enable_opts)
finally:
debug_stop("jit-optimize")
示例3: send_loop_to_backend
def send_loop_to_backend(greenkey, jitdriver_sd, metainterp_sd, loop, type):
jitdriver_sd.on_compile(metainterp_sd.logger_ops, loop.token, loop.operations, type, greenkey)
loopname = jitdriver_sd.warmstate.get_location_str(greenkey)
globaldata = metainterp_sd.globaldata
loop_token = loop.token
loop_token.number = n = globaldata.loopnumbering
globaldata.loopnumbering += 1
if not we_are_translated():
show_loop(metainterp_sd, loop)
loop.check_consistency()
operations = get_deep_immutable_oplist(loop.operations)
metainterp_sd.profiler.start_backend()
debug_start("jit-backend")
try:
ops_offset = metainterp_sd.cpu.compile_loop(loop.inputargs, operations, loop.token, name=loopname)
finally:
debug_stop("jit-backend")
metainterp_sd.profiler.end_backend()
metainterp_sd.stats.add_new_loop(loop)
if not we_are_translated():
if type != "entry bridge":
metainterp_sd.stats.compiled()
else:
loop._ignore_during_counting = True
metainterp_sd.log("compiled new " + type)
#
metainterp_sd.logger_ops.log_loop(loop.inputargs, loop.operations, n, type, ops_offset)
short = loop.token.short_preamble
if short:
metainterp_sd.logger_ops.log_short_preamble(short[-1].inputargs, short[-1].operations)
#
if metainterp_sd.warmrunnerdesc is not None: # for tests
metainterp_sd.warmrunnerdesc.memory_manager.keep_loop_alive(loop.token)
示例4: get_total_memory_linux2
def get_total_memory_linux2(filename):
debug_start("gc-hardware")
result = -1.0
try:
fd = os.open(filename, os.O_RDONLY, 0644)
try:
buf = os.read(fd, 4096)
finally:
os.close(fd)
except OSError:
pass
else:
if buf.startswith('MemTotal:'):
start = _skipspace(buf, len('MemTotal:'))
stop = start
while stop < len(buf) and buf[stop].isdigit():
stop += 1
if start < stop:
result = float(buf[start:stop]) * 1024.0 # assume kB
if result < 0.0:
debug_print("get_total_memory() failed")
result = addressable_size
else:
debug_print("memtotal =", result)
if result > addressable_size:
result = addressable_size
debug_stop("gc-hardware")
return result
示例5: _dump
def _dump(self, addr, logname, backend=None):
debug_start(logname)
if have_debug_prints():
#
if backend is not None:
debug_print('BACKEND', backend)
#
from pypy.jit.backend.hlinfo import highleveljitinfo
if highleveljitinfo.sys_executable:
debug_print('SYS_EXECUTABLE', highleveljitinfo.sys_executable)
else:
debug_print('SYS_EXECUTABLE', '??')
#
HEX = '0123456789ABCDEF'
dump = []
src = rffi.cast(rffi.CCHARP, addr)
for p in range(self.get_relative_pos()):
o = ord(src[p])
dump.append(HEX[o >> 4])
dump.append(HEX[o & 15])
debug_print('CODE_DUMP',
'@%x' % addr,
'+0 ', # backwards compatibility
''.join(dump))
#
debug_stop(logname)
示例6: send_bridge_to_backend
def send_bridge_to_backend(jitdriver_sd, metainterp_sd, faildescr, inputargs, operations, original_loop_token):
n = metainterp_sd.cpu.get_fail_descr_number(faildescr)
if not we_are_translated():
show_procedures(metainterp_sd)
seen = dict.fromkeys(inputargs)
TreeLoop.check_consistency_of_branch(operations, seen)
if metainterp_sd.warmrunnerdesc is not None:
hooks = metainterp_sd.warmrunnerdesc.hooks
debug_info = JitDebugInfo(
jitdriver_sd, metainterp_sd.logger_ops, original_loop_token, operations, "bridge", fail_descr_no=n
)
hooks.before_compile_bridge(debug_info)
else:
hooks = None
debug_info = None
operations = get_deep_immutable_oplist(operations)
metainterp_sd.profiler.start_backend()
debug_start("jit-backend")
try:
asminfo = do_compile_bridge(metainterp_sd, faildescr, inputargs, operations, original_loop_token)
finally:
debug_stop("jit-backend")
metainterp_sd.profiler.end_backend()
if hooks is not None:
debug_info.asminfo = asminfo
hooks.after_compile_bridge(debug_info)
if not we_are_translated():
metainterp_sd.stats.compiled()
metainterp_sd.log("compiled new bridge")
#
if asminfo is not None:
ops_offset = asminfo.ops_offset
else:
ops_offset = None
metainterp_sd.logger_ops.log_bridge(inputargs, operations, n, ops_offset)
示例7: send_loop_to_backend
def send_loop_to_backend(metainterp_sd, loop, type):
globaldata = metainterp_sd.globaldata
loop_token = loop.token
loop_token.number = n = globaldata.loopnumbering
globaldata.loopnumbering += 1
metainterp_sd.logger_ops.log_loop(loop.inputargs, loop.operations, n, type)
if not we_are_translated():
show_loop(metainterp_sd, loop)
loop.check_consistency()
metainterp_sd.profiler.start_backend()
debug_start("jit-backend")
try:
metainterp_sd.cpu.compile_loop(loop.inputargs, loop.operations,
loop.token)
finally:
debug_stop("jit-backend")
metainterp_sd.profiler.end_backend()
metainterp_sd.stats.add_new_loop(loop)
if not we_are_translated():
if type != "entry bridge":
metainterp_sd.stats.compiled()
else:
loop._ignore_during_counting = True
metainterp_sd.log("compiled new " + type)
示例8: f
def f(x):
debug_start("mycat")
debug_print("foo", 2, "bar", x)
debug_stop("mycat")
debug_flush() # does nothing
debug_offset() # should not explode at least
return have_debug_prints()
示例9: set_nursery_size
def set_nursery_size(self, newsize):
debug_start("gc-set-nursery-size")
if newsize < self.min_nursery_size:
newsize = self.min_nursery_size
if newsize > self.space_size // 2:
newsize = self.space_size // 2
# Compute the new bounds for how large young objects can be
# (larger objects are allocated directly old). XXX adjust
self.nursery_size = newsize
self.largest_young_fixedsize = self.get_young_fixedsize(newsize)
self.largest_young_var_basesize = self.get_young_var_basesize(newsize)
scale = 0
while (self.min_nursery_size << (scale+1)) <= newsize:
scale += 1
self.nursery_scale = scale
debug_print("nursery_size =", newsize)
debug_print("largest_young_fixedsize =",
self.largest_young_fixedsize)
debug_print("largest_young_var_basesize =",
self.largest_young_var_basesize)
debug_print("nursery_scale =", scale)
# we get the following invariant:
assert self.nursery_size >= (self.min_nursery_size << scale)
# Force a full collect to remove the current nursery whose size
# no longer matches the bounds that we just computed. This must
# be done after changing the bounds, because it might re-create
# a new nursery (e.g. if it invokes finalizers).
self.semispace_collect()
debug_stop("gc-set-nursery-size")
示例10: get_L2cache_linux2
def get_L2cache_linux2(filename="/proc/cpuinfo"):
debug_start("gc-hardware")
L2cache = sys.maxint
try:
fd = os.open(filename, os.O_RDONLY, 0644)
try:
data = []
while True:
buf = os.read(fd, 4096)
if not buf:
break
data.append(buf)
finally:
os.close(fd)
except OSError:
pass
else:
data = ''.join(data)
linepos = 0
while True:
start = _findend(data, '\ncache size', linepos)
if start < 0:
break # done
linepos = _findend(data, '\n', start)
if linepos < 0:
break # no end-of-line??
# *** data[start:linepos] == " : 2048 KB\n"
start = _skipspace(data, start)
if data[start] != ':':
continue
# *** data[start:linepos] == ": 2048 KB\n"
start = _skipspace(data, start + 1)
# *** data[start:linepos] == "2048 KB\n"
end = start
while '0' <= data[end] <= '9':
end += 1
# *** data[start:end] == "2048"
if start == end:
continue
number = int(data[start:end])
# *** data[end:linepos] == " KB\n"
end = _skipspace(data, end)
if data[end] not in ('K', 'k'): # assume kilobytes for now
continue
number = number * 1024
# for now we look for the smallest of the L2 caches of the CPUs
if number < L2cache:
L2cache = number
debug_print("L2cache =", L2cache)
debug_stop("gc-hardware")
if L2cache < sys.maxint:
return L2cache
else:
# Print a top-level warning even in non-debug builds
llop.debug_print(lltype.Void,
"Warning: cannot find your CPU L2 cache size in /proc/cpuinfo")
return -1
示例11: _emergency_initial_block
def _emergency_initial_block(self, requested_size):
# xxx before the GC is fully setup, we might get there. Hopefully
# we will only allocate a couple of strings, e.g. in read_from_env().
# Just allocate them raw and leak them.
debug_start("gc-initial-block")
debug_print("leaking", requested_size, "bytes")
debug_stop("gc-initial-block")
return llmemory.raw_malloc(requested_size)
示例12: optimize_bridge
def optimize_bridge(metainterp_sd, old_loop_tokens, bridge, enable_opts,
inline_short_preamble=True, retraced=False):
debug_start("jit-optimize")
try:
return _optimize_bridge(metainterp_sd, old_loop_tokens, bridge,
enable_opts,
inline_short_preamble, retraced)
finally:
debug_stop("jit-optimize")
示例13: _check_rawsize_alloced
def _check_rawsize_alloced(self, size_estimate, can_collect=True):
self.large_objects_collect_trigger -= size_estimate
if can_collect and self.large_objects_collect_trigger < 0:
debug_start("gc-rawsize-collect")
debug_print("allocated", (self._initial_trigger -
self.large_objects_collect_trigger),
"bytes, triggering full collection")
self.semispace_collect()
debug_stop("gc-rawsize-collect")
示例14: disable_noninlinable_function
def disable_noninlinable_function(self, metainterp):
greenkey = metainterp.greenkey_of_huge_function
if greenkey is not None:
cell = self.jit_cell_at_key(greenkey)
cell.dont_trace_here = True
debug_start("jit-disableinlining")
sd = self.warmrunnerdesc.metainterp_sd
loc = sd.state.get_location_str(greenkey)
debug_print("disabled inlining", loc)
debug_stop("jit-disableinlining")
示例15: log_loop
def log_loop(self, inputargs, operations, number=0, type=None):
if type is None:
debug_start("jit-log-noopt-loop")
self._log_operations(inputargs, operations)
debug_stop("jit-log-noopt-loop")
else:
debug_start("jit-log-opt-loop")
debug_print("# Loop", number, ":", type,
"with", len(operations), "ops")
self._log_operations(inputargs, operations)
debug_stop("jit-log-opt-loop")