• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python debug.debug_print函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pypy.rlib.debug.debug_print函数的典型用法代码示例。如果您正苦于以下问题:Python debug_print函数的具体用法?Python debug_print怎么用?Python debug_print使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了debug_print函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: 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
开发者ID:ieure,项目名称:pypy,代码行数:28,代码来源:env.py


示例2: _print_stats

 def _print_stats(self):
     cnt = self.counters
     tim = self.times
     calls = self.calls
     self._print_line_time("Tracing", cnt[TRACING],   tim[TRACING])
     self._print_line_time("Backend", cnt[BACKEND],   tim[BACKEND])
     line = "TOTAL:      \t\t%f" % (self.tk - self.starttime, )
     debug_print(line)
     self._print_intline("ops", cnt[OPS])
     self._print_intline("recorded ops", cnt[RECORDED_OPS])
     self._print_intline("  calls", calls)
     self._print_intline("guards", cnt[GUARDS])
     self._print_intline("opt ops", cnt[OPT_OPS])
     self._print_intline("opt guards", cnt[OPT_GUARDS])
     self._print_intline("forcings", cnt[OPT_FORCINGS])
     self._print_intline("abort: trace too long", cnt[ABORT_TOO_LONG])
     self._print_intline("abort: compiling", cnt[ABORT_BRIDGE])
     self._print_intline("abort: vable escape", cnt[ABORT_ESCAPE])
     self._print_intline("abort: bad loop", cnt[ABORT_BAD_LOOP])
     self._print_intline("abort: force quasi-immut",
                                            cnt[ABORT_FORCE_QUASIIMMUT])
     self._print_intline("nvirtuals", cnt[NVIRTUALS])
     self._print_intline("nvholes", cnt[NVHOLES])
     self._print_intline("nvreused", cnt[NVREUSED])
     cpu = self.cpu
     if cpu is not None:   # for some tests
         self._print_intline("Total # of loops",
                             cpu.total_compiled_loops)
         self._print_intline("Total # of bridges",
                             cpu.total_compiled_bridges)
         self._print_intline("Freed # of loops",
                             cpu.total_freed_loops)
         self._print_intline("Freed # of bridges",
                             cpu.total_freed_bridges)
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:34,代码来源:jitprof.py


示例3: f

 def f():
     state.data = []
     state.datalen1 = 0
     state.datalen2 = 0
     state.datalen3 = 0
     state.datalen4 = 0
     state.threadlocals = gil.GILThreadLocals()
     state.threadlocals.setup_threads(space)
     thread.gc_thread_prepare()
     subident = thread.start_new_thread(bootstrap, ())
     mainident = thread.get_ident()
     runme(True)
     still_waiting = 3000
     while len(state.data) < 2*N:
         debug_print(len(state.data))
         if not still_waiting:
             raise ValueError("time out")
         still_waiting -= 1
         if not we_are_translated(): gil.before_external_call()
         time.sleep(0.01)
         if not we_are_translated(): gil.after_external_call()
     debug_print("leaving!")
     i1 = i2 = 0
     for tid, i in state.data:
         if tid == mainident:
             assert i == i1; i1 += 1
         elif tid == subident:
             assert i == i2; i2 += 1
         else:
             assert 0
     assert i1 == N + skew
     assert i2 == N - skew
     return len(state.data)
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:33,代码来源:test_gil.py


示例4: update

 def update(self, op):
     if (op.has_no_side_effect() or
         op.is_ovf() or
         op.is_guard()): 
         return
     opnum = op.getopnum()
     descr = op.getdescr()
     if (opnum == rop.DEBUG_MERGE_POINT):
         return
     if (opnum == rop.SETFIELD_GC or
         opnum == rop.SETFIELD_RAW):
         self.unsafe_getitem[descr] = True
         return
     if (opnum == rop.SETARRAYITEM_GC or
         opnum == rop.SETARRAYITEM_RAW):
         index = op.getarg(1)
         if isinstance(index, Const):                
             d = self.unsafe_getarrayitem_indexes.get(descr, None)
             if d is None:
                 d = self.unsafe_getarrayitem_indexes[descr] = {}
             d[index.getint()] = True
         else:
             self.unsafe_getarrayitem[descr] = True
         return
     if opnum == rop.CALL:
         effectinfo = descr.get_extra_info()
         if effectinfo is not None:
             for fielddescr in effectinfo.write_descrs_fields:
                 self.unsafe_getitem[fielddescr] = True
             for arraydescr in effectinfo.write_descrs_arrays:
                 self.unsafe_getarrayitem[arraydescr] = True
             return
     debug_print("heap dirty due to op ", opnum)
     self.heap_dirty = True
开发者ID:ieure,项目名称:pypy,代码行数:34,代码来源:unroll.py


示例5: 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()
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:7,代码来源:test_debug.py


示例6: debug_print

 def debug_print(self, hdr='', bad=None):
     if bad is None:
         bad = {}
     debug_print(hdr + "VirtualState():")
     seen = {}
     for s in self.state:
         s.debug_print("    ", seen, bad)
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:7,代码来源:virtualstate.py


示例7: debug_collect_finish

 def debug_collect_finish(self):
     if 1:# start_time != -1:
         #end_time = time.time()
         #elapsed_time = end_time - start_time
         #self.total_collection_time += elapsed_time
         #self.total_collection_count += 1
         #total_program_time = end_time - self.program_start_time
         #ct = self.total_collection_time
         #cc = self.total_collection_count
         #debug_print("| number of collections so far       ", 
         #            cc)
         debug_print("| total space size                   ", 
                     self.space_size)
         debug_print("| number of objects alive            ", 
                     self.num_alive_objs)
         debug_print("| used space size                    ", 
                     self.free - self.space)
         debug_print("| next collection after              ", 
                     self.next_collect_after)
         #debug_print("| total collections per second:      ",
         #            cc / total_program_time)
         #debug_print("| total time in markcompact-collect: ",
         #            ct, "seconds")
         #debug_print("| percentage collection<->total time:",
         #            ct * 100.0 / total_program_time, "%")
         debug_print("`----------------------------------------------")
         debug_stop("gc-collect")
开发者ID:ieure,项目名称:pypy,代码行数:27,代码来源:markcompact.py


示例8: 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
开发者ID:ieure,项目名称:pypy,代码行数:59,代码来源:env.py


示例9: _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)
开发者ID:junion,项目名称:butlerbot-unstable,代码行数:8,代码来源:markcompact.py


示例10: _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")
开发者ID:ieure,项目名称:pypy,代码行数:9,代码来源:hybrid.py


示例11: 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")
开发者ID:alkorzt,项目名称:pypy,代码行数:10,代码来源:warmstate.py


示例12: crash_in_jit

 def crash_in_jit(e):
     if not we_are_translated():
         print "~~~ Crash in JIT!"
         print '~~~ %s: %s' % (e.__class__, e)
         if sys.stdout == sys.__stdout__:
             import pdb; pdb.post_mortem(sys.exc_info()[2])
         raise
     debug_print('~~~ Crash in JIT!')
     debug_print('~~~ %s' % (e,))
     raise history.CrashInJIT("crash in JIT")
开发者ID:enyst,项目名称:plexnet,代码行数:10,代码来源:warmspot.py


示例13: propagate_forward

 def propagate_forward(self, op):
     if self.logops is not None:
         debug_print(self.logops.repr_of_resop(op))
     opnum = op.getopnum()
     for value, func in optimize_ops:
         if opnum == value:
             func(self, op)
             break
     else:
         self.emit_operation(op)
开发者ID:ieure,项目名称:pypy,代码行数:10,代码来源:fficall.py


示例14: _end

 def _end(self, event):
     t0 = self.t1
     self.t1 = self.timer()
     if not self.current:
         debug_print("BROKEN PROFILER DATA!")
         return
     ev1 = self.current.pop()
     if ev1 != event:
         debug_print("BROKEN PROFILER DATA!")
         return
     self.times[ev1] += self.t1 - t0
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:11,代码来源:jitprof.py


示例15: get_total_memory_darwin

def get_total_memory_darwin(result):
    debug_start("gc-hardware")
    if result <= 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
开发者ID:ieure,项目名称:pypy,代码行数:11,代码来源:env.py


示例16: log_bridge

 def log_bridge(self, inputargs, operations, number=-1):
     if number == -1:
         debug_start("jit-log-noopt-bridge")
         self._log_operations(inputargs, operations)
         debug_stop("jit-log-noopt-bridge")
     else:
         debug_start("jit-log-opt-bridge")
         debug_print("# bridge out of Guard", number,
                     "with", len(operations), "ops")
         self._log_operations(inputargs, operations)
         debug_stop("jit-log-opt-bridge")
开发者ID:alkorzt,项目名称:pypy,代码行数:11,代码来源:logger.py


示例17: 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")
开发者ID:alkorzt,项目名称:pypy,代码行数:11,代码来源:logger.py


示例18: collect_oldrefs_to_nursery

 def collect_oldrefs_to_nursery(self):
     # Follow the old_objects_pointing_to_young list and move the
     # young objects they point to out of the nursery.
     count = 0
     oldlist = self.old_objects_pointing_to_young
     while oldlist.non_empty():
         count += 1
         obj = oldlist.pop()
         hdr = self.header(obj)
         hdr.tid |= GCFLAG_NO_YOUNG_PTRS
         self.trace_and_drag_out_of_nursery(obj)
     debug_print("collect_oldrefs_to_nursery", count)
开发者ID:alkorzt,项目名称:pypy,代码行数:12,代码来源:generation.py


示例19: _compile_and_run

 def _compile_and_run(self, t, entry_point, entry_point_graph, args):
     from pypy.translator.c.genc import CStandaloneBuilder as CBuilder
     # XXX patch exceptions
     cbuilder = CBuilder(t, entry_point, config=t.config)
     cbuilder.generate_source()
     self._check_cbuilder(cbuilder)
     exe_name = cbuilder.compile()
     debug_print('---------- Test starting ----------')
     stdout = cbuilder.cmdexec(" ".join([str(arg) for arg in args]))
     res = int(stdout)
     debug_print('---------- Test done (%d) ----------' % (res,))
     return res
开发者ID:alkorzt,项目名称:pypy,代码行数:12,代码来源:support.py



注:本文中的pypy.rlib.debug.debug_print函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python debug.debug_start函数代码示例发布时间:2022-05-27
下一篇:
Python unicodetype.unicode_from_string函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap