一个不错的Python性能测试中时间差的获取方式

from time import perf_counter

def get_session_user_storage_info():
    start_time = perf_counter()
    ......
    
    end_time = perf_counter()    
    print("=============耗时:")
    print(end_time - start_time)

结果展示:单位为秒

猜你喜欢

转载自blog.csdn.net/wangyuntuan/article/details/126269672