import time
def coreLoop():
limit = 10 ** 8
while (limit > 0):
limit -= 1
def otherLoop1():
time.sleep(0.2)
def otherLoop2():
time.sleep(0.4)
def main():
startTime = time.localtime()
print('程序开始时间:', time.strftime('%Y-%m-%d %H:%M:%S', startTime))
startPerfCounter = time.perf_counter()
otherLoop1()
otherLoop1PerfCounter = time.perf_counter()
otherLoop1Perf = otherLoop1PerfCounter - startPerfCounter
coreLoop()
coreLoopPerfCounter = time.perf_counter()
coreLoopPerf = coreLoopPerfCounter - otherLoop1PerfCounter
otherLoop2()
otherLoop2PerfCounter = time.perf_counter()
otherLoop2Perf = otherLoop2PerfCounter - coreLoopPerfCounter
endPerfCounter = time.perf_counter()
totalPerf = endPerfCounter - startPerfCounter
endTime = time.localtime()
print('模块1运行时间是:{}秒'.format(otherLoop1Perf))
print('核心模块运行时间是:{}秒'.format(coreLoopPerf))
print('模块2运行时间是:{}秒'.format(otherLoop2Perf))
print('程序运行总时间是:{}秒'.format(totalPerf))
print('程序结束时间:', time.strftime('%Y-%m-%d %H:%M:%S', endTime))
main()
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
NCRE-Python-code.zip (12个子文件)
NCRE-Python-code
.DS_Store 6KB
《全国计算机等级考试二级教程——Python语言程序设计(2018年版)》学习笔记.md 52KB
.gitignore 1KB
code
CEncode.py 281B
CCDecode.py 365B
getNGurl.py 852B
Counter.py 1KB
SnowView.py 890B
CalStoryOfStone2.py 727B
CCEncode.py 360B
CDecode.py 285B
CalStoryOfStone.py 769B
共 12 条
- 1
资源评论
MarcoPage
- 粉丝: 2278
- 资源: 999
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功