Glow 技术团队博客
  • Home
Sign in Subscribe

profiling

A collection of 1 post
python

Python profiling

Profiling(性能调试)是我一直很感兴趣的一个话题,之前给大家介绍过Datadog这个工具,今天我们来看看Python语言中有哪些方法来做Profiling。 Poorman's Profiler 最基础的就是使用time.time()来计时,这个方法简单有效,也许所有写过Python代码的人都用过。我们可以创建一个decorator使它用起来更方便。 import time import logging import functools def simple_profiling(func): @wraps.functools(func) def wrapped(*args, **kwargs): start_time = time.time() result = func(*args, **kwargs) time_spent = time.time() - start_time fullname = '{}.{}'.format(func.
  • 叶剑烨
    叶剑烨
叶剑烨 10 Oct 2016 • 8 min read
Page 1 of 1
Glow 技术团队博客 © 2025
Powered by Ghost