profile python app online, Display FlameGraph in a browser
Project description
## 项目名
`profiler_online`
### 介绍:
用来解析查找python程序可能存在的各方面性能或者奇葩问题的工具,通过web访问访问可以直接拿到火焰吐.
Will Add Future:
* 加入内存的相关信息
* 查询时间范围
### 安装:
**pypi:**
```
pip install profiler_online
```
**源码安装:**
```
git clone https://github.com/rfyiamcool/profiler_online.git
cd profiler_online
python setup.py install
```
### 用法:
这边已经封装好了,你需要做的只是把性能分析模块引入到你的应用里面.
```
from profiler_online import run_profiler
run_profiler()
```
### 测试:
打开浏览器 http://127.0.0.1:8080 这样就可以显示正在运行服务的性能火焰图了.

### 问题:
下面是以前创建火焰图的方法.
```
python test.py
curl "127.0.0.1:8080" | profiler_online/tools/flamegraph.pl > flame.html
```
改进的方法:
```
直接浏览器打开,地址栏 --> 127.0.0.1:8080
```
在开发过程中,遇到了python系统调用时不能正常捕获输出. 现在已经改为临时文件的方式.
```
cmdstr = './profiler_online/tools/flamegraph.pl'
p = subprocess.Popen(cmdstr, stdin = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
p.stdin.write(stats)
p.stdin.flush()
try:
if p.stderr:
stats = p.stderr.read()
p.stderr.flush()
if p.stdout:
stats = p.stdout.read()
except Exception, e:
print e,Exception
```
`profiler_online`
### 介绍:
用来解析查找python程序可能存在的各方面性能或者奇葩问题的工具,通过web访问访问可以直接拿到火焰吐.
Will Add Future:
* 加入内存的相关信息
* 查询时间范围
### 安装:
**pypi:**
```
pip install profiler_online
```
**源码安装:**
```
git clone https://github.com/rfyiamcool/profiler_online.git
cd profiler_online
python setup.py install
```
### 用法:
这边已经封装好了,你需要做的只是把性能分析模块引入到你的应用里面.
```
from profiler_online import run_profiler
run_profiler()
```
### 测试:
打开浏览器 http://127.0.0.1:8080 这样就可以显示正在运行服务的性能火焰图了.

### 问题:
下面是以前创建火焰图的方法.
```
python test.py
curl "127.0.0.1:8080" | profiler_online/tools/flamegraph.pl > flame.html
```
改进的方法:
```
直接浏览器打开,地址栏 --> 127.0.0.1:8080
```
在开发过程中,遇到了python系统调用时不能正常捕获输出. 现在已经改为临时文件的方式.
```
cmdstr = './profiler_online/tools/flamegraph.pl'
p = subprocess.Popen(cmdstr, stdin = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
p.stdin.write(stats)
p.stdin.flush()
try:
if p.stderr:
stats = p.stderr.read()
p.stderr.flush()
if p.stdout:
stats = p.stdout.read()
except Exception, e:
print e,Exception
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
profiler_online-2.2.tar.gz
(17.0 kB
view details)
File details
Details for the file profiler_online-2.2.tar.gz.
File metadata
- Download URL: profiler_online-2.2.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
879eb8828252b7cd375ba1f6c9f2db349a5b0fce7f7ce14123b4b2e9b27e0780
|
|
| MD5 |
8e502ae8ef202b417d1723fbc83ccbe2
|
|
| BLAKE2b-256 |
79994466281c772a327ad5808cd3b18fa9b72d0e026e55b01b5a425fe2454359
|