当前位置: 首页>>代码示例>>Python>>正文


Python Process.cpu_percent方法代码示例

本文整理汇总了Python中multiprocessing.Process.cpu_percent方法的典型用法代码示例。如果您正苦于以下问题:Python Process.cpu_percent方法的具体用法?Python Process.cpu_percent怎么用?Python Process.cpu_percent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在multiprocessing.Process的用法示例。


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

示例1: while

# 需要导入模块: from multiprocessing import Process [as 别名]
# 或者: from multiprocessing.Process import cpu_percent [as 别名]
     pair_buffer={}
     scaffold_count={}
#     while (not inq.empty()) or sum( [reader.is_alive() for reader in readers] )>0:
     while True:
          if args.debug: print("get")
          try:
               procid,scaffold,pairs = inq.get()
#               procid,scaffold,pairs = inq.get(True,10)
               #print("#got data:",procid,scaffold,len(pairs))
               print("#got data from inq:",procid,scaffold,len(pairs),inq.empty(),inq.qsize(),inq.full(),strftime("%Y-%m-%d %H:%M:%S"),sum( [reader.is_alive() for reader in readers] ),"q.size():",q.qsize(),file=sys.stderr,sep="\t")
               sys.stderr.flush()
               sys.stdout.flush()
          except Exception as e:
               print(e,file=sys.stderr)
               if args.top:
                    print("queue get timed out",[reader.cpu_percent() for reader in reader_procs],[worker.cpu_percent() for worker in worker_procs])
               #print("#timed out",inq.empty())
               print("#read from queue timed out:",inq.empty(),inq.qsize(),inq.full(),strftime("%Y-%m-%d %H:%M:%S"),sum( [reader.is_alive() for reader in readers] ),file=sys.stderr,sep="\t")
               sys.stderr.flush()
               continue
          if args.debug: print("got")
          if not scaffold in pair_buffer:
               pair_buffer[scaffold]=[]
          pair_buffer[scaffold] += pairs
          scaffold_count[scaffold] = scaffold_count.get(scaffold,0)+1
#          print("#:",scaffold,scaffold_count[scaffold])
          if scaffold=="DONE": 
               print("#seen DONE {} times.".format(scaffold_count.get(scaffold,0)),strftime("%Y-%m-%d %H:%M:%S"),file=sys.stderr,sep="\t")
               if scaffold_count[scaffold] == nbams:
                    print("#done. calling task_done:",strftime("%Y-%m-%d %H:%M:%S"),file=sys.stderr,sep="\t")
                    sys.stderr.flush()
开发者ID:alexharkess,项目名称:HiRise_July2015_GR,代码行数:33,代码来源:parallel_breaker.py


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