Skip to content

Commit

Permalink
fix:update
Browse files Browse the repository at this point in the history
  • Loading branch information
FanLu1994 committed Nov 21, 2023
1 parent 08a238a commit 8a9decc
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions source/_posts/测试开发/pyinstrument.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: pyinstrument
date: 2023-11-21 22:41:31
tags:
- DEBUG
- python
- 工具
categories: 测试开发
---
>https://pyinstrument.readthedocs.io/en/latest/guide.html
这是一个python性能分析工具.

大致有两种使用方式:
1. 命令行直接运行脚本
```
pyinstrument script.py
```
2. 嵌入到项目中
- 简单包裹代码块
```python
from pyinstrument import Profiler

profiler = Profiler()
profiler.start()

# code you want to profile

profiler.stop()

profiler.print()

```
- 作为中间件嵌入到`django``flask``fastapi``falcon`中使用

0 comments on commit 8a9decc

Please sign in to comment.