GithubHelp home page GithubHelp logo

gaogaotiantian / viztracer Goto Github PK

View Code? Open in Web Editor NEW
4.4K 48.0 348.0 42.64 MB

VizTracer is a low-overhead logging/debugging/profiling tool that can trace and visualize your python code execution.

Home Page: https://viztracer.readthedocs.io/

License: Apache License 2.0

Python 71.25% C 25.70% Makefile 0.15% C++ 2.90%
tracer python3 debugging profiling visualization flamegraph python logging

viztracer's People

Contributors

acehinnnqru avatar alexeykozhevin avatar colesbury avatar comzyh avatar daavoo avatar dancingsnow0517 avatar f-park avatar gaogaotiantian avatar imba-tjd avatar kianmeng avatar liuyangc3 avatar luoos avatar maartenbreddels avatar monkeywq avatar mwerschy avatar odidev avatar ogrisel avatar peterstolz avatar richardsheridan avatar sefank avatar tanloong avatar ttianshun avatar xzxcxzxcxzxc avatar yihong0618 avatar youker-shawn avatar zyckk4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

viztracer's Issues

Interface for stacktraces

It would be nice to have a function to get a list[str] as function of the time. I plan to take viztracer's output to inject stacktraces back into perf, which can sample at a regular interval, this should allow us to create the FlameGraph tools https://github.com/brendangregg/FlameGraph to make offcpu/offgil flamegraphs etc.

Do you think it makes sense to include this in viztracer?

run viztracer against python2.x appplication

Hi

root@controller:~# python  --version
Python 2.7.12

root@controller:~# pip --version
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
pip 20.3 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

Does viztracer support python2.x ? I got errors when running pip -vvv install viztracer

Link requires a different Python (2.7.12 not in: u'>=3.6'): https://files.pythonhosted.org/packages/1d/38/078b2fe674f1a47d88d860c81b288f182265f56a26b096c6181f6d7547f2/viztracer> -0.10.4.tar.gz#sha256=ceb7464a3f25bffff675904ae5d66bb0b81188b2d21ec147aa32d1d4931b954f (from https://pypi.org/simple/viztracer/) (requires-python:>=3.6)
 Given no hashes to check 0 links for project 'viztracer': discarding no candidates
ERROR: Could not find a version that satisfies the requirement viztracer (from versions: none)
 ERROR: No matching distribution found for viztracer

If it not , is it possible to run viztracer against python2.x appplication ?
for example , I install openstack nova-api via apt-get install nova-api.
And the nova mudules are located at /usr/lib/python2.7/dist-packages/nova/

Finally, I install viztracer via pip3 , and run viztracer against nova-api, I got error:

root@controller:~# viztracer  /usr/bin/nova-api --config-file=/etc/nova/nova.conf --log-file=/var/log/nova/nova-api.log
Traceback (most recent call last):
  File "/usr/local/bin/viztracer", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/dist-packages/viztracer/main.py", line 372, in main
    success, err_msg = ui.run()
  File "/usr/local/lib/python3.5/dist-packages/viztracer/main.py", line 201, in run
    return self.run_command()
  File "/usr/local/lib/python3.5/dist-packages/viztracer/main.py", line 300, in run_command
    return self.run_code(code, main_mod.__dict__)
  File "/usr/local/lib/python3.5/dist-packages/viztracer/main.py", line 250, in run_code
    exec(code, global_dict)
  File "/usr/bin/nova-api", line 6, in <module>
    from nova.cmd.api import main
ImportError: No module named 'nova'
Loading finish                                        
Saving report to /root/result.html ...
Dumping trace data to json, total entries: 41140, estimated json file size: 4.7MiB
Generating HTML report
Report saved.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/viztracer/main.py", line 363, in exit_routine
    exit(0)
  File "/usr/lib/python3.5/_sitebuiltins.py", line 26, in __call__
    raise SystemExit(code)
SystemExit: 0

运行django访问api接口, 使用log_sparse未能生成报告; 而运行flask访问api接口, 则报错退出

我想用log_sparse功能监控web程序中某段代码的性能, 但django程序中未生产报告, 而flask则直接报错退出, 请问为啥呀?

mac 10.15.4
python 3.6.8
Django 3.1.3
Flask 1.1.2

from django.views.decorators.http import require_GET
from django.http import HttpResponse
from viztracer import log_sparse

@require_GET
def index(request):
    ret = hello()
    return HttpResponse(ret)

@log_sparse
def hello():
    return 'hello world'
viztracer --log_sparse manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
December 20, 2020 - 13:05:59
Django version 3.1.3, using settings 'cbv_demo.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[20/Dec/2020 13:06:01] "GET /index/ HTTP/1.1" 200 11
[20/Dec/2020 13:06:02] "GET /index/ HTTP/1.1" 200 11
[20/Dec/2020 13:06:02] "GET /index/ HTTP/1.1" 200 11
^CSaving report to /Users/admin/Documents/pythonprojects/cbv_demo/result.html ...
Dumping trace data to json, total entries: 0, estimated json file size: 0.0B
Generating HTML report
Report saved.
from flask import Flask
from viztracer import log_sparse

app = Flask(__name__)


@app.route('/')
def hello_world():
    return hello()


def hello():
    win()
    return 'Hello, World!'


@log_sparse
def win():
    x = 4 + 4
    return 'win'


if __name__ == '__main__':
    app.run()
➜  cbv_demo git:(master) ✗ python3 -m viztracer --log_sparse flask_demo.py
 * Serving Flask app "flask_demo" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

# 请求127.0.0.1:5000/ 程序报错退出
[1]    7622 segmentation fault  python3 -m viztracer --log_sparse flask_demo.py

报错信息:
Process: Python [7566]
Path: /Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: 3.6.8 (3.6.8)
Code Type: X86-64 (Native)
Parent Process: zsh [3163]
Responsible: pycharm [766]
User ID: 501

Date/Time: 2020-12-20 20:55:41.790 +0800
OS Version: Mac OS X 10.15.4 (19E287)
Report Version: 12
Anonymous UUID: A0094B33-5625-98F4-EAFE-D7C8980D3E61

Sleep/Wake UUID: 5CDACBA0-34C7-45DE-9148-1346AF15F3C4

Time Awake Since Boot: 3500 seconds
Time Since Wake: 1900 seconds

System Integrity Protection: disabled

Crashed Thread: 1

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000010
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [7566]

VM Regions Near 0x10:
-->
__TEXT 000000010196b000-000000010196c000 [ 4K] r-x/rwx SM=COW /Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python

Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff6ed283d6 poll + 10
1 select.cpython-36m-darwin.so 0x000000010214f962 poll_poll + 466
2 org.python.python 0x00000001019c77cb _PyCFunction_FastCallDict + 491
3 org.python.python 0x0000000101a49747 call_function + 439
4 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
5 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
6 org.python.python 0x0000000101a4aae1 fast_function + 545
7 org.python.python 0x0000000101a49721 call_function + 401
8 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
9 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
10 org.python.python 0x0000000101a4aae1 fast_function + 545
11 org.python.python 0x0000000101a49721 call_function + 401
12 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
13 org.python.python 0x0000000101a4aa3d fast_function + 381
14 org.python.python 0x0000000101a49721 call_function + 401
15 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
16 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
17 org.python.python 0x0000000101a4aae1 fast_function + 545
18 org.python.python 0x0000000101a49721 call_function + 401
19 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
20 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
21 org.python.python 0x0000000101a3f2bb PyEval_EvalCodeEx + 107
22 org.python.python 0x00000001019a80cd function_call + 381
23 org.python.python 0x000000010197e4f0 PyObject_Call + 96
24 org.python.python 0x0000000101a4619a _PyEval_EvalFrameDefault + 28298
25 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
26 org.python.python 0x0000000101a4aae1 fast_function + 545
27 org.python.python 0x0000000101a49721 call_function + 401
28 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
29 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
30 org.python.python 0x0000000101a3f244 PyEval_EvalCode + 100
31 org.python.python 0x0000000101a3c8c4 builtin_exec + 548
32 org.python.python 0x00000001019c77cb _PyCFunction_FastCallDict + 491
33 org.python.python 0x0000000101a49747 call_function + 439
34 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
35 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
36 org.python.python 0x0000000101a4aae1 fast_function + 545
37 org.python.python 0x0000000101a49721 call_function + 401
38 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
39 org.python.python 0x0000000101a4aa3d fast_function + 381
40 org.python.python 0x0000000101a49721 call_function + 401
41 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
42 org.python.python 0x0000000101a4aa3d fast_function + 381
43 org.python.python 0x0000000101a49721 call_function + 401
44 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
45 org.python.python 0x0000000101a4aa3d fast_function + 381
46 org.python.python 0x0000000101a49721 call_function + 401
47 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
48 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
49 org.python.python 0x0000000101a3f244 PyEval_EvalCode + 100
50 org.python.python 0x0000000101a3c8c4 builtin_exec + 548
51 org.python.python 0x00000001019c77cb _PyCFunction_FastCallDict + 491
52 org.python.python 0x0000000101a49747 call_function + 439
53 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
54 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
55 org.python.python 0x0000000101a4aae1 fast_function + 545
56 org.python.python 0x0000000101a49721 call_function + 401
57 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
58 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
59 org.python.python 0x0000000101a3f2bb PyEval_EvalCodeEx + 107
60 org.python.python 0x00000001019a80cd function_call + 381
61 org.python.python 0x000000010197e4f0 PyObject_Call + 96
62 org.python.python 0x0000000101a8ee73 RunModule + 147
63 org.python.python 0x0000000101a8e828 Py_Main + 2808
64 org.python.python 0x000000010196bdf8 0x10196b000 + 3576
65 libdyld.dylib 0x00007fff6ebe0cc9 start + 1

Thread 1 Crashed:
0 snaptrace.cpython-36m-darwin.so 0x00000001021ac1e6 snaptrace_addraw + 150
1 org.python.python 0x00000001019c77cb _PyCFunction_FastCallDict + 491
2 org.python.python 0x0000000101a49747 call_function + 439
3 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
4 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
5 org.python.python 0x0000000101a4aae1 fast_function + 545
6 org.python.python 0x0000000101a49721 call_function + 401
7 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
8 org.python.python 0x0000000101a4aa3d fast_function + 381
9 org.python.python 0x0000000101a49721 call_function + 401
10 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
11 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
12 org.python.python 0x0000000101a3f2bb PyEval_EvalCodeEx + 107
13 org.python.python 0x00000001019a80cd function_call + 381
14 org.python.python 0x000000010197e4f0 PyObject_Call + 96
15 org.python.python 0x0000000101a4619a _PyEval_EvalFrameDefault + 28298
16 org.python.python 0x0000000101a4aa3d fast_function + 381
17 org.python.python 0x0000000101a49721 call_function + 401
18 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
19 org.python.python 0x0000000101a4aa3d fast_function + 381
20 org.python.python 0x0000000101a49721 call_function + 401
21 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
22 org.python.python 0x0000000101a4aa3d fast_function + 381
23 org.python.python 0x0000000101a49721 call_function + 401
24 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
25 org.python.python 0x0000000101a4ac5c _PyFunction_FastCallDict + 348
26 org.python.python 0x000000010197e6b7 _PyObject_FastCallDict + 247
27 org.python.python 0x000000010197e7d5 _PyObject_Call_Prepend + 149
28 org.python.python 0x000000010197e4f0 PyObject_Call + 96
29 org.python.python 0x00000001019dec85 slot_tp_call + 117
30 org.python.python 0x000000010197e685 _PyObject_FastCallDict + 197
31 org.python.python 0x0000000101a49648 call_function + 184
32 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
33 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
34 org.python.python 0x0000000101a4aae1 fast_function + 545
35 org.python.python 0x0000000101a49721 call_function + 401
36 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
37 org.python.python 0x0000000101a4a1af _PyEval_EvalCodeWithName + 2447
38 org.python.python 0x0000000101a4aae1 fast_function + 545
39 org.python.python 0x0000000101a49721 call_function + 401
40 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
41 org.python.python 0x0000000101a4aa3d fast_function + 381
42 org.python.python 0x0000000101a49721 call_function + 401
43 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
44 org.python.python 0x0000000101a4aa3d fast_function + 381
45 org.python.python 0x0000000101a49721 call_function + 401
46 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
47 org.python.python 0x0000000101a4aa3d fast_function + 381
48 org.python.python 0x0000000101a49721 call_function + 401
49 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
50 org.python.python 0x0000000101a4ac5c _PyFunction_FastCallDict + 348
51 org.python.python 0x000000010197e6b7 _PyObject_FastCallDict + 247
52 org.python.python 0x000000010197e7d5 _PyObject_Call_Prepend + 149
53 org.python.python 0x000000010197e4f0 PyObject_Call + 96
54 org.python.python 0x00000001019dfadd slot_tp_init + 125
55 org.python.python 0x00000001019dbd09 type_call + 313
56 org.python.python 0x000000010197e685 _PyObject_FastCallDict + 197
57 org.python.python 0x0000000101a49648 call_function + 184
58 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
59 org.python.python 0x0000000101a4aa3d fast_function + 381
60 org.python.python 0x0000000101a49721 call_function + 401
61 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
62 org.python.python 0x0000000101a4ac5c _PyFunction_FastCallDict + 348
63 org.python.python 0x000000010197e6b7 _PyObject_FastCallDict + 247
64 org.python.python 0x000000010197e7d5 _PyObject_Call_Prepend + 149
65 org.python.python 0x000000010197e4f0 PyObject_Call + 96
66 org.python.python 0x0000000101a4619a _PyEval_EvalFrameDefault + 28298
67 org.python.python 0x0000000101a4aa3d fast_function + 381
68 org.python.python 0x0000000101a49721 call_function + 401
69 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
70 org.python.python 0x0000000101a4aa3d fast_function + 381
71 org.python.python 0x0000000101a49721 call_function + 401
72 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
73 org.python.python 0x0000000101a4ac5c _PyFunction_FastCallDict + 348
74 org.python.python 0x000000010197e6b7 _PyObject_FastCallDict + 247
75 org.python.python 0x000000010197e7d5 _PyObject_Call_Prepend + 149
76 org.python.python 0x000000010197e4f0 PyObject_Call + 96
77 org.python.python 0x0000000101a91396 t_bootstrap + 70
78 org.python.python 0x0000000101a8abe9 pythread_wrapper + 25
79 libsystem_pthread.dylib 0x00007fff6ede5109 _pthread_start + 148
80 libsystem_pthread.dylib 0x00007fff6ede0b8b thread_start + 15

Thread 2:
0 libsystem_kernel.dylib 0x00007fff6ed253a6 __recvfrom + 10
1 _socket.cpython-36m-darwin.so 0x0000000102133dbb sock_recv_impl + 27
2 _socket.cpython-36m-darwin.so 0x0000000102133461 sock_call_ex + 529
3 _socket.cpython-36m-darwin.so 0x00000001021315b9 sock_recv_into + 265
4 org.python.python 0x00000001019c7697 _PyCFunction_FastCallDict + 183
5 org.python.python 0x0000000101a49747 call_function + 439
6 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
7 org.python.python 0x0000000101a4ac5c _PyFunction_FastCallDict + 348
8 org.python.python 0x000000010197e6b7 _PyObject_FastCallDict + 247
9 org.python.python 0x000000010197e7d5 _PyObject_Call_Prepend + 149
10 org.python.python 0x000000010197e685 _PyObject_FastCallDict + 197
11 org.python.python 0x000000010197f468 PyObject_CallMethodObjArgs + 520
12 org.python.python 0x0000000101ac9bf7 _bufferedreader_raw_read + 135
13 org.python.python 0x0000000101ac9f76 _buffered_readline + 662
14 org.python.python 0x0000000101ac8f0e _io__Buffered_readline + 78
15 org.python.python 0x00000001019c77cb _PyCFunction_FastCallDict + 491
16 org.python.python 0x0000000101a49747 call_function + 439
17 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
18 org.python.python 0x0000000101a4aa3d fast_function + 381
19 org.python.python 0x0000000101a49721 call_function + 401
20 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
21 org.python.python 0x0000000101a4aa3d fast_function + 381
22 org.python.python 0x0000000101a49721 call_function + 401
23 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
24 org.python.python 0x0000000101a4aa3d fast_function + 381
25 org.python.python 0x0000000101a49721 call_function + 401
26 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
27 org.python.python 0x0000000101a4ac5c _PyFunction_FastCallDict + 348
28 org.python.python 0x000000010197e6b7 _PyObject_FastCallDict + 247
29 org.python.python 0x000000010197e7d5 _PyObject_Call_Prepend + 149
30 org.python.python 0x000000010197e4f0 PyObject_Call + 96
31 org.python.python 0x00000001019dfadd slot_tp_init + 125
32 org.python.python 0x00000001019dbd09 type_call + 313
33 org.python.python 0x000000010197e685 _PyObject_FastCallDict + 197
34 org.python.python 0x0000000101a49648 call_function + 184
35 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
36 org.python.python 0x0000000101a4aa3d fast_function + 381
37 org.python.python 0x0000000101a49721 call_function + 401
38 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
39 org.python.python 0x0000000101a4ac5c _PyFunction_FastCallDict + 348
40 org.python.python 0x000000010197e6b7 _PyObject_FastCallDict + 247
41 org.python.python 0x000000010197e7d5 _PyObject_Call_Prepend + 149
42 org.python.python 0x000000010197e4f0 PyObject_Call + 96
43 org.python.python 0x0000000101a4619a _PyEval_EvalFrameDefault + 28298
44 org.python.python 0x0000000101a4aa3d fast_function + 381
45 org.python.python 0x0000000101a49721 call_function + 401
46 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
47 org.python.python 0x0000000101a4aa3d fast_function + 381
48 org.python.python 0x0000000101a49721 call_function + 401
49 org.python.python 0x0000000101a45eb7 _PyEval_EvalFrameDefault + 27559
50 org.python.python 0x0000000101a4ac5c _PyFunction_FastCallDict + 348
51 org.python.python 0x000000010197e6b7 _PyObject_FastCallDict + 247
52 org.python.python 0x000000010197e7d5 _PyObject_Call_Prepend + 149
53 org.python.python 0x000000010197e4f0 PyObject_Call + 96
54 org.python.python 0x0000000101a91396 t_bootstrap + 70
55 org.python.python 0x0000000101a8abe9 pythread_wrapper + 25
56 libsystem_pthread.dylib 0x00007fff6ede5109 _pthread_start + 148
57 libsystem_pthread.dylib 0x00007fff6ede0b8b thread_start + 15

Thread 1 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x00000001023aacd8 rcx: 0x67a073f6361200ef rdx: 0x0000000000000001
rdi: 0x0000000107c4dcf0 rsi: 0x00000000000f4241 rbp: 0x000070000b72bdc0 rsp: 0x000070000b72bd90
r8: 0x000070000b72bae0 r9: 0x0000000107c4dcf0 r10: 0x00000001024ac7f0 r11: 0x0000000000000001
r12: 0x0000000000000000 r13: 0x00000001024ac7f0 r14: 0x0000000000000000 r15: 0x00000001024d8000
rip: 0x00000001021ac1e6 rfl: 0x0000000000010202 cr2: 0x000070000bc2fff8

Logical CPU: 0
Error Code: 0x0200001d
Trap Number: 133

Binary Images:
0x10196b000 - 0x10196bff7 +org.python.python (3.6.8 - 3.6.8) /Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python
0x101971000 - 0x101b2aff7 +org.python.python (3.6.8, [c] 2001-2018 Python Software Foundation. - 3.6.8) /Library/Frameworks/Python.framework/Versions/3.6/Python
0x101f71000 - 0x101f72fff +_heapq.cpython-36m-darwin.so (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_heapq.cpython-36m-darwin.so
0x1020c0000 - 0x1020c4ff7 +_struct.cpython-36m-darwin.so (0) <27E4E8D7-B1F1-3F7B-99EA-B7AB43D0A2D4> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_struct.cpython-36m-darwin.so
0x10210d000 - 0x102120fff +_pickle.cpython-36m-darwin.so (0) <604415D5-D401-37AC-83AC-F664F152067D> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_pickle.cpython-36m-darwin.so
0x10212c000 - 0x102135fff +_socket.cpython-36m-darwin.so (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_socket.cpython-36m-darwin.so
0x102141000 - 0x102146fff +math.cpython-36m-darwin.so (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/math.cpython-36m-darwin.so
0x10214d000 - 0x102150fff +select.cpython-36m-darwin.so (0) <51598834-4A42-3CAB-8780-04E370698047> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/select.cpython-36m-darwin.so
0x102156000 - 0x10215bff7 +array.cpython-36m-darwin.so (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/array.cpython-36m-darwin.so
0x1021a4000 - 0x1021a5ff7 +_posixsubprocess.cpython-36m-darwin.so (0) <1A4B9EDF-57D8-33D0-BBD6-D701EA8D5948> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-darwin.so
0x1021a9000 - 0x1021acffb +snaptrace.cpython-36m-darwin.so (0) /Users/USER/Documents/*/snaptrace.cpython-36m-darwin.so
0x1021b5000 - 0x1021bafff +_json.cpython-36m-darwin.so (0) <8F79E674-2D90-3624-B862-88C6617C3308> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_json.cpython-36m-darwin.so
0x1021ff000 - 0x102202ff7 +zlib.cpython-36m-darwin.so (0) <43674D69-1EF0-3ABE-92F4-6BE32AFABD21> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/zlib.cpython-36m-darwin.so
0x102217000 - 0x102218ff7 +_bz2.cpython-36m-darwin.so (0) <7284FE73-5311-3A08-B0ED-7A2442A88DB5> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_bz2.cpython-36m-darwin.so
0x10221c000 - 0x10221cfff +grp.cpython-36m-darwin.so (0) <2FCC7D8C-F776-33BD-991E-D85DE54DC027> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/grp.cpython-36m-darwin.so
0x10221f000 - 0x102221ff7 +readline.cpython-36m-darwin.so (0) <8E54B15E-0710-3C0F-B948-1086AF68C050> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/readline.cpython-36m-darwin.so
0x102228000 - 0x102228ff7 +_bisect.cpython-36m-darwin.so (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_bisect.cpython-36m-darwin.so
0x10222b000 - 0x10222cfff +_speedups.cpython-36m-darwin.so (???) <968062E4-6DA7-3142-BDF5-E5359A262DD8> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/markupsafe/_speedups.cpython-36m-darwin.so
0x10222f000 - 0x102230fff +_random.cpython-36m-darwin.so (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_random.cpython-36m-darwin.so
0x102235000 - 0x1022c6eff dyld (750.5) <1F893B81-89A5-3502-8510-95B97B9F730D> /usr/lib/dyld
0x1023ba000 - 0x1023eaff7 +_lzma.cpython-36m-darwin.so (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_lzma.cpython-36m-darwin.so
0x102434000 - 0x102488ff7 +libncursesw.5.dylib (0) <41392058-3FF5-324A-868F-F7657EC25039> /Library/Frameworks/Python.framework/Versions/3.6/lib/libncursesw.5.dylib
0x107164000 - 0x107166ff7 +_hashlib.cpython-36m-darwin.so (0) <7DD71177-B87A-3EBD-9742-BC29D1BB7352> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_hashlib.cpython-36m-darwin.so
0x10716b000 - 0x1071aeff7 +libssl.1.0.0.dylib (0) <8813DD21-7A83-36B8-97D8-CA86BD9C4D21> /Library/Frameworks/Python.framework/Versions/3.6/lib/libssl.1.0.0.dylib
0x1071ca000 - 0x10737b20f +libcrypto.1.0.0.dylib (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/libcrypto.1.0.0.dylib
0x1073f1000 - 0x1073f6ff7 +_blake2.cpython-36m-darwin.so (0) <70CAB140-4C26-31B8-88A9-B699DA1F1A55> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_blake2.cpython-36m-darwin.so
0x1073fb000 - 0x10740bff7 +_sha3.cpython-36m-darwin.so (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_sha3.cpython-36m-darwin.so
0x1074d1000 - 0x107512fff +_decimal.cpython-36m-darwin.so (0) <9809BDA3-34CB-3BF7-AD11-96F6ECAFE1FB> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_decimal.cpython-36m-darwin.so
0x107571000 - 0x107645fff +unicodedata.cpython-36m-darwin.so (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/unicodedata.cpython-36m-darwin.so
0x10769c000 - 0x1076a9fff +_datetime.cpython-36m-darwin.so (0) <432695CC-941A-36B8-ACB9-3AE713314FE9> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_datetime.cpython-36m-darwin.so
0x107799000 - 0x107799ff7 +_opcode.cpython-36m-darwin.so (0) <529AEBFD-5731-3662-AB4F-53E02258CE3B> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_opcode.cpython-36m-darwin.so
0x10781c000 - 0x10781ffff +binascii.cpython-36m-darwin.so (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/binascii.cpython-36m-darwin.so
0x1078e3000 - 0x1078efff7 +_ssl.cpython-36m-darwin.so (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_ssl.cpython-36m-darwin.so
0x107a9d000 - 0x107a9dff7 +_scproxy.cpython-36m-darwin.so (0) <9520405E-4460-3BC6-8036-97D82D89E6F5> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_scproxy.cpython-36m-darwin.so
0x107b20000 - 0x107b30fff +_ctypes.cpython-36m-darwin.so (0) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so
0x7fff27e08000 - 0x7fff27e17ff7 libSimplifiedChineseConverter.dylib (76) <3A38C5A2-0D75-34F2-A30C-22E346092611> /System/Library/CoreServices/Encodings/libSimplifiedChineseConverter.dylib
0x7fff30a43000 - 0x7fff30a43fff com.apple.Accelerate (1.11 - Accelerate 1.11) <8BE0965F-6A6A-35B0-89D0-F0A75835C2CA> /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate
0x7fff30a5b000 - 0x7fff310b1fef com.apple.vImage (8.1 - 524.2) /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage
0x7fff310b2000 - 0x7fff31319ff7 libBLAS.dylib (1303.60.1) <4E980D6B-4B3A-33D6-B52C-AFC7D120D11A> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
0x7fff3131a000 - 0x7fff317edfef libBNNS.dylib (144.100.2) /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBNNS.dylib
0x7fff317ee000 - 0x7fff31b89fff libLAPACK.dylib (1303.60.1) /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
0x7fff31b8a000 - 0x7fff31b9ffec libLinearAlgebra.dylib (1303.60.1) <79CB28C5-F811-3EAF-AD8E-7D7D879FE662> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLinearAlgebra.dylib
0x7fff31ba0000 - 0x7fff31ba5ff3 libQuadrature.dylib (7) /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libQuadrature.dylib
0x7fff31ba6000 - 0x7fff31c16fff libSparse.dylib (103) <8C55F5F2-6AE3-393C-B2FF-22B8CFCBD7FC> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparse.dylib
0x7fff31c17000 - 0x7fff31c29fef libSparseBLAS.dylib (1303.60.1) <08F6D629-5DAC-3A99-B261-2B6095DD38B4> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparseBLAS.dylib
0x7fff31c2a000 - 0x7fff31e01fd7 libvDSP.dylib (735.100.4) <0744F29B-F822-3571-9B4A-B592146D4E03> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib
0x7fff31e02000 - 0x7fff31ec4fef libvMisc.dylib (735.100.4) /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib
0x7fff31ec5000 - 0x7fff31ec5fff com.apple.Accelerate.vecLib (3.11 - vecLib 3.11) <66282197-81EE-316F-978E-EF1471551DEF> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
0x7fff33626000 - 0x7fff339b4ffd com.apple.CFNetwork (1125.2 - 1125.2) <1D4D81F7-FC48-3588-87FC-481E2586E345> /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
0x7fff34daf000 - 0x7fff3522effb com.apple.CoreFoundation (6.9 - 1675.129) <9E632A1E-9622-33D6-BCCE-23AC16DAA6B7> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x7fff36197000 - 0x7fff36197fff com.apple.CoreServices (1069.22 - 1069.22) <888FE7B9-CE6C-3C7C-BA33-63364462228A> /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
0x7fff36198000 - 0x7fff3621dfff com.apple.AE (838.1 - 838.1) <2BAB1B88-C198-3D20-8DA3-056E66510E7A> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE
0x7fff3621e000 - 0x7fff364ffff7 com.apple.CoreServices.CarbonCore (1217 - 1217) /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
0x7fff36500000 - 0x7fff3654dffd com.apple.DictionaryServices (1.2 - 323.6) <11513ED9-8B4B-39BB-A6B2-AA6AA0A2DF72> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices
0x7fff3654e000 - 0x7fff36556ff7 com.apple.CoreServices.FSEvents (1268.100.1 - 1268.100.1) /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/FSEvents
0x7fff36557000 - 0x7fff36790ffc com.apple.LaunchServices (1069.22 - 1069.22) /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices
0x7fff36791000 - 0x7fff36829ff1 com.apple.Metadata (10.7.0 - 2076.3) /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
0x7fff3682a000 - 0x7fff36857fff com.apple.CoreServices.OSServices (1069.22 - 1069.22) /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
0x7fff36858000 - 0x7fff368bffff com.apple.SearchKit (1.4.1 - 1.4.1) /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
0x7fff368c0000 - 0x7fff368e4ff5 com.apple.coreservices.SharedFileList (131.4 - 131.4) /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList
0x7fff3712a000 - 0x7fff37130fff com.apple.DiskArbitration (2.7 - 2.7) /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration
0x7fff37465000 - 0x7fff3782aff8 com.apple.Foundation (6.9 - 1675.129) <9A74FA97-7F7B-3929-B381-D9514B1E4754> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
0x7fff37b9e000 - 0x7fff37c42ff3 com.apple.framework.IOKit (2.0.2 - 1726.100.16) <3D8BA34A-AAF7-3AF2-9B5B-189AC4755404> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x7fff3b741000 - 0x7fff3b74dffe com.apple.NetFS (6.0 - 4.0) <7A96A8FE-17F3-3850-8E81-9DDDC5A48DDB> /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS
0x7fff3e32f000 - 0x7fff3e34bfff com.apple.CFOpenDirectory (10.15 - 220.40.1) <58835104-9E7A-32E8-862B-530CE899C9B4> /System/Library/Frameworks/OpenDirectory.framework/Versions/A/Frameworks/CFOpenDirectory.framework/Versions/A/CFOpenDirectory
0x7fff3e34c000 - 0x7fff3e357ffd com.apple.OpenDirectory (10.15 - 220.40.1) /System/Library/Frameworks/OpenDirectory.framework/Versions/A/OpenDirectory
0x7fff416f1000 - 0x7fff41a3aff1 com.apple.security (7.0 - 59306.101.1) <430E04FE-F068-3476-9CA2-72CB5F040D1F> /System/Library/Frameworks/Security.framework/Versions/A/Security
0x7fff41a3b000 - 0x7fff41ac3ffb com.apple.securityfoundation (6.0 - 55236.60.1) /System/Library/Frameworks/SecurityFoundation.framework/Versions/A/SecurityFoundation
0x7fff41af2000 - 0x7fff41af6ff8 com.apple.xpc.ServiceManagement (1.0 - 1) /System/Library/Frameworks/ServiceManagement.framework/Versions/A/ServiceManagement
0x7fff427a1000 - 0x7fff4280fff7 com.apple.SystemConfiguration (1.19 - 1.19) <71AC15DE-7018-3D2B-B599-F2972F0288AE> /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
0x7fff4676c000 - 0x7fff46831ff7 com.apple.APFS (1412.101.1 - 1412.101.1) <2F5A48FB-9788-3A24-87FE-C1B7DDBC8A07> /System/Library/PrivateFrameworks/APFS.framework/Versions/A/APFS
0x7fff48533000 - 0x7fff48542fd7 com.apple.AppleFSCompression (119.100.1 - 1.0) /System/Library/PrivateFrameworks/AppleFSCompression.framework/Versions/A/AppleFSCompression
0x7fff49d01000 - 0x7fff49d0aff7 com.apple.coreservices.BackgroundTaskManagement (1.0 - 104) <2088BC70-5329-3390-A851-C4ECF654047C> /System/Library/PrivateFrameworks/BackgroundTaskManagement.framework/Versions/A/BackgroundTaskManagement
0x7fff4cac0000 - 0x7fff4cad0ff3 com.apple.CoreEmoji (1.0 - 107) /System/Library/PrivateFrameworks/CoreEmoji.framework/Versions/A/CoreEmoji
0x7fff4d110000 - 0x7fff4d17aff0 com.apple.CoreNLP (1.0 - 213) <687A4C31-A307-3255-83BE-9B123971FF62> /System/Library/PrivateFrameworks/CoreNLP.framework/Versions/A/CoreNLP
0x7fff4dff5000 - 0x7fff4e023ffd com.apple.CSStore (1069.22 - 1069.22) <39E431F9-3584-34DF-A64D-C5895AA72068> /System/Library/PrivateFrameworks/CoreServicesStore.framework/Versions/A/CoreServicesStore
0x7fff5a238000 - 0x7fff5a306ffd com.apple.LanguageModeling (1.0 - 215.1) <3FAF1700-F7D4-3F92-88AA-A3920702B8BB> /System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling
0x7fff5a307000 - 0x7fff5a34ffff com.apple.Lexicon-framework (1.0 - 72) <212D02CE-11BC-3C7F-BDFD-DF1A0C4017EE> /System/Library/PrivateFrameworks/Lexicon.framework/Versions/A/Lexicon
0x7fff5a356000 - 0x7fff5a35bff3 com.apple.LinguisticData (1.0 - 353.18) /System/Library/PrivateFrameworks/LinguisticData.framework/Versions/A/LinguisticData
0x7fff5b6c2000 - 0x7fff5b70efff com.apple.spotlight.metadata.utilities (1.0 - 2076.3) /System/Library/PrivateFrameworks/MetadataUtilities.framework/Versions/A/MetadataUtilities
0x7fff5c1c3000 - 0x7fff5c1cdfff com.apple.NetAuth (6.2 - 6.2) /System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth
0x7fff6542d000 - 0x7fff6543dff3 com.apple.TCC (1.0 - 1) /System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC
0x7fff68b08000 - 0x7fff68b0aff3 com.apple.loginsupport (1.0 - 1) /System/Library/PrivateFrameworks/login.framework/Versions/A/Frameworks/loginsupport.framework/Versions/A/loginsupport
0x7fff6b623000 - 0x7fff6b657fff libCRFSuite.dylib (48) /usr/lib/libCRFSuite.dylib
0x7fff6b65a000 - 0x7fff6b664fff libChineseTokenizer.dylib (34) /usr/lib/libChineseTokenizer.dylib
0x7fff6b6f0000 - 0x7fff6b6f2ff7 libDiagnosticMessagesClient.dylib (112) /usr/lib/libDiagnosticMessagesClient.dylib
0x7fff6bbc6000 - 0x7fff6bbc7fff libSystem.B.dylib (1281.100.1) /usr/lib/libSystem.B.dylib
0x7fff6bc54000 - 0x7fff6bc55fff libThaiTokenizer.dylib (3) /usr/lib/libThaiTokenizer.dylib
0x7fff6bc6d000 - 0x7fff6bc83fff libapple_nghttp2.dylib (1.39.2) <268F4E3E-95DC-35FB-82DC-5B0D1855A676> /usr/lib/libapple_nghttp2.dylib
0x7fff6bcb8000 - 0x7fff6bd2aff7 libarchive.2.dylib (72.100.1) <65E0870E-02AB-365D-84F9-5800B5BB69FC> /usr/lib/libarchive.2.dylib
0x7fff6bdc8000 - 0x7fff6bdc8ff3 libauto.dylib (187) /usr/lib/libauto.dylib
0x7fff6be8e000 - 0x7fff6be9effb libbsm.0.dylib (60.100.1) /usr/lib/libbsm.0.dylib
0x7fff6be9f000 - 0x7fff6beabfff libbz2.1.0.dylib (44) /usr/lib/libbz2.1.0.dylib
0x7fff6beac000 - 0x7fff6befefff libc++.1.dylib (902.1) <08199809-33CA-321E-9B9D-FD5B2BC64580> /usr/lib/libc++.1.dylib
0x7fff6beff000 - 0x7fff6bf14ffb libc++abi.dylib (902) <1C880020-396D-3F91-BE27-5A09A9239F68> /usr/lib/libc++abi.dylib
0x7fff6bf15000 - 0x7fff6bf15fff libcharset.1.dylib (59) <4E63BA25-04A3-329A-923D-251155C03F30> /usr/lib/libcharset.1.dylib
0x7fff6bf16000 - 0x7fff6bf27fff libcmph.dylib (8) /usr/lib/libcmph.dylib
0x7fff6bf28000 - 0x7fff6bf3ffd7 libcompression.dylib (87) <7F258A06-E01D-32D2-9CD2-6B2931DA5DA7> /usr/lib/libcompression.dylib
0x7fff6c219000 - 0x7fff6c22fff7 libcoretls.dylib (167) /usr/lib/libcoretls.dylib
0x7fff6c230000 - 0x7fff6c231fff libcoretls_cfhelpers.dylib (167) <2E542A2B-7730-33EE-9B3B-154B08608AA6> /usr/lib/libcoretls_cfhelpers.dylib
0x7fff6c93b000 - 0x7fff6c958fff libedit.3.dylib (55) /usr/lib/libedit.3.dylib
0x7fff6c959000 - 0x7fff6c959fff libenergytrace.dylib (21) /usr/lib/libenergytrace.dylib
0x7fff6c980000 - 0x7fff6c982fff libfakelink.dylib (149.1) /usr/lib/libfakelink.dylib
0x7fff6c991000 - 0x7fff6c996fff libgermantok.dylib (24) <8091F952-B592-38E3-982B-7DEA0A44E211> /usr/lib/libgermantok.dylib
0x7fff6c9a1000 - 0x7fff6ca91fff libiconv.2.dylib (59) <9458704B-A702-37CB-9707-66ABBB5DB71E> /usr/lib/libiconv.2.dylib
0x7fff6ca92000 - 0x7fff6cce9fff libicucore.A.dylib (64260.0.1) /usr/lib/libicucore.A.dylib
0x7fff6cd03000 - 0x7fff6cd04fff liblangid.dylib (133) /usr/lib/liblangid.dylib
0x7fff6cd05000 - 0x7fff6cd1dff3 liblzma.5.dylib (16) <0AA1EB11-A433-327E-B8DB-7395CFF06554> /usr/lib/liblzma.5.dylib
0x7fff6cd35000 - 0x7fff6cddcff7 libmecab.dylib (883.10) <13136C11-8763-37BA-AEB2-676092798DAA> /usr/lib/libmecab.dylib
0x7fff6cddd000 - 0x7fff6d03ffe1 libmecabra.dylib (883.10) <6AC22857-F528-35CE-94A9-D70F6F766C15> /usr/lib/libmecabra.dylib
0x7fff6d3ac000 - 0x7fff6d3dbfff libncurses.5.4.dylib (57) <6BD6F430-C8B3-39D8-87B5-2C16E6578FD5> /usr/lib/libncurses.5.4.dylib
0x7fff6d50b000 - 0x7fff6d986ff5 libnetwork.dylib (1880.100.30) <9519B6F8-44E2-3F53-B995-1527C5333240> /usr/lib/libnetwork.dylib
0x7fff6da26000 - 0x7fff6da59fde libobjc.A.dylib (787.1) <20AC082F-2DB7-3974-A2D4-8C5E01787584> /usr/lib/libobjc.A.dylib
0x7fff6da6c000 - 0x7fff6da70fff libpam.2.dylib (25.100.1) /usr/lib/libpam.2.dylib
0x7fff6da73000 - 0x7fff6daa9ff7 libpcap.A.dylib (89.100.1) <171BAAB0-A5C8-32C5-878E-83D46073BF8C> /usr/lib/libpcap.A.dylib
0x7fff6dba1000 - 0x7fff6dd8bff7 libsqlite3.dylib (308.4) /usr/lib/libsqlite3.dylib
0x7fff6dfdc000 - 0x7fff6dfdfffb libutil.dylib (57) <07ED7CF0-1744-3386-B8B2-0DDBD446999E> /usr/lib/libutil.dylib
0x7fff6dfe0000 - 0x7fff6dfedff7 libxar.1.dylib (425.2) <625F24E1-1A0F-3301-9F99-F0F3DADE0287> /usr/lib/libxar.1.dylib
0x7fff6dff3000 - 0x7fff6e0d5ff7 libxml2.2.dylib (33.3) <24147A90-E3EB-3926-BFB0-5F0FC9F706E2> /usr/lib/libxml2.2.dylib
0x7fff6e0d9000 - 0x7fff6e101fff libxslt.1.dylib (16.9) <8C8648B1-F2CA-38EA-A409-D6F19715C6E6> /usr/lib/libxslt.1.dylib
0x7fff6e102000 - 0x7fff6e114ff3 libz.1.dylib (76) <6A449C6A-DF88-36C1-8F2D-DB9A808263B5> /usr/lib/libz.1.dylib
0x7fff6e9c2000 - 0x7fff6e9c7ff3 libcache.dylib (83) <5F90FFCE-403B-3724-991D-BA32401D99C5> /usr/lib/system/libcache.dylib
0x7fff6e9c8000 - 0x7fff6e9d3fff libcommonCrypto.dylib (60165) /usr/lib/system/libcommonCrypto.dylib
0x7fff6e9d4000 - 0x7fff6e9dbfff libcompiler_rt.dylib (101.2) /usr/lib/system/libcompiler_rt.dylib
0x7fff6e9dc000 - 0x7fff6e9e5ff7 libcopyfile.dylib (166.40.1) <1A5270B5-0D97-35DA-9296-4F4A428BC6A2> /usr/lib/system/libcopyfile.dylib
0x7fff6e9e6000 - 0x7fff6ea78fe3 libcorecrypto.dylib (866.100.30) /usr/lib/system/libcorecrypto.dylib
0x7fff6eb85000 - 0x7fff6ebc5ff0 libdispatch.dylib (1173.100.2) /usr/lib/system/libdispatch.dylib
0x7fff6ebc6000 - 0x7fff6ebfcfff libdyld.dylib (750.5) /usr/lib/system/libdyld.dylib
0x7fff6ebfd000 - 0x7fff6ebfdffb libkeymgr.dylib (30) /usr/lib/system/libkeymgr.dylib
0x7fff6ebfe000 - 0x7fff6ec0aff3 libkxld.dylib (6153.101.6) <77282DCB-83D6-3199-874E-9A4A0FD7D4F3> /usr/lib/system/libkxld.dylib
0x7fff6ec0b000 - 0x7fff6ec0bff7 liblaunch.dylib (1738.100.39) /usr/lib/system/liblaunch.dylib
0x7fff6ec0c000 - 0x7fff6ec11ff7 libmacho.dylib (959.0.1) /usr/lib/system/libmacho.dylib
0x7fff6ec12000 - 0x7fff6ec14ff3 libquarantine.dylib (110.40.3) <51E0304F-AB11-3BF7-99DC-BB916CC9088B> /usr/lib/system/libquarantine.dylib
0x7fff6ec15000 - 0x7fff6ec16ff7 libremovefile.dylib (48) <078F29AB-26BA-3493-BCAA-E1E75A187521> /usr/lib/system/libremovefile.dylib
0x7fff6ec17000 - 0x7fff6ec2eff3 libsystem_asl.dylib (377.60.2) <0F1BAC19-2AE0-3F8E-9B90-AACF819B2BF7> /usr/lib/system/libsystem_asl.dylib
0x7fff6ec2f000 - 0x7fff6ec2fff7 libsystem_blocks.dylib (74) <32224AFF-C06F-3279-B753-097194EDEF49> /usr/lib/system/libsystem_blocks.dylib
0x7fff6ec30000 - 0x7fff6ecb7fff libsystem_c.dylib (1353.100.2) <4F5EED22-4D46-3F04-8C64-C492CDAD70EB> /usr/lib/system/libsystem_c.dylib
0x7fff6ecb8000 - 0x7fff6ecbbffb libsystem_configuration.dylib (1061.101.1) <2A2C778D-07EB-35C7-A954-8BF8FD74BD75> /usr/lib/system/libsystem_configuration.dylib
0x7fff6ecbc000 - 0x7fff6ecbffff libsystem_coreservices.dylib (114) /usr/lib/system/libsystem_coreservices.dylib
0x7fff6ecc0000 - 0x7fff6ecc8fff libsystem_darwin.dylib (1353.100.2) /usr/lib/system/libsystem_darwin.dylib
0x7fff6ecc9000 - 0x7fff6ecd0fff libsystem_dnssd.dylib (1096.100.3) <7C690DF5-E119-33FB-85CD-9EFC67A36E40> /usr/lib/system/libsystem_dnssd.dylib
0x7fff6ecd1000 - 0x7fff6ecd2ffb libsystem_featureflags.dylib (17) <415D83EF-084C-3485-B757-53001870EA94> /usr/lib/system/libsystem_featureflags.dylib
0x7fff6ecd3000 - 0x7fff6ed20ff7 libsystem_info.dylib (538) <17049D3F-C798-3651-B391-1551FC699D3E> /usr/lib/system/libsystem_info.dylib
0x7fff6ed21000 - 0x7fff6ed4dff7 libsystem_kernel.dylib (6153.101.6) /usr/lib/system/libsystem_kernel.dylib
0x7fff6ed4e000 - 0x7fff6ed95fff libsystem_m.dylib (3178) <74741FA8-5C29-3241-9046-4FC91C6A6D4A> /usr/lib/system/libsystem_m.dylib
0x7fff6ed96000 - 0x7fff6edbdfff libsystem_malloc.dylib (283.100.5) <97833239-2F83-3AEB-A426-0593997C8A54> /usr/lib/system/libsystem_malloc.dylib
0x7fff6edbe000 - 0x7fff6edcbffb libsystem_networkextension.dylib (1095.100.29) /usr/lib/system/libsystem_networkextension.dylib
0x7fff6edcc000 - 0x7fff6edd5ff7 libsystem_notify.dylib (241.100.2) /usr/lib/system/libsystem_notify.dylib
0x7fff6edd6000 - 0x7fff6eddefef libsystem_platform.dylib (220.100.1) <6EF12F34-C33F-36BF-9A9A-2A35EA19EFE0> /usr/lib/system/libsystem_platform.dylib
0x7fff6eddf000 - 0x7fff6ede9fff libsystem_pthread.dylib (416.100.3) /usr/lib/system/libsystem_pthread.dylib
0x7fff6edea000 - 0x7fff6edeeff3 libsystem_sandbox.dylib (1217.101.2) /usr/lib/system/libsystem_sandbox.dylib
0x7fff6edef000 - 0x7fff6edf1fff libsystem_secinit.dylib (62.100.2) /usr/lib/system/libsystem_secinit.dylib
0x7fff6edf2000 - 0x7fff6edf9ffb libsystem_symptoms.dylib (1238.100.26) <487B92DE-45F9-39F9-A478-89BBD478157D> /usr/lib/system/libsystem_symptoms.dylib
0x7fff6edfa000 - 0x7fff6ee10ff2 libsystem_trace.dylib (1147.100.8) /usr/lib/system/libsystem_trace.dylib
0x7fff6ee12000 - 0x7fff6ee17ff7 libunwind.dylib (35.4) /usr/lib/system/libunwind.dylib
0x7fff6ee18000 - 0x7fff6ee4dffe libxpc.dylib (1738.100.39) <32B0E31E-9DA3-328B-A962-BC9591B93537> /usr/lib/system/libxpc.dylib

External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 1
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 252705
thread_create: 0
thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=463.9M resident=0K(0%) swapped_out_or_unallocated=463.9M(100%)
Writable regions: Total=152.8M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=152.8M(100%)

                            VIRTUAL   REGION 

REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Kernel Alloc Once 8K 1
MALLOC 49.9M 73
MALLOC guard page 16K 4
MALLOC_LARGE (reserved) 76.5M 3 reserved VM address space (unallocated)
STACK GUARD 12K 3
Stack 26.0M 4
VM_ALLOCATE 4K 1
__DATA 7037K 158
__DATA_CONST 20K 1
__LINKEDIT 389.6M 37
__OBJC_RO 32.2M 1
__OBJC_RW 1892K 2
__TEXT 74.3M 156
__UNICODE 564K 1
shared memory 12K 3
=========== ======= =======
TOTAL 657.9M 448
TOTAL, minus reserved VM space 581.4M 448

Model: MacBookPro14,1, BootROM 205.0.0.0.0, 2 processors, Dual-Core Intel Core i5, 2.3 GHz, 8 GB, SMC 2.43f7
Graphics: kHW_IntelIrisGraphics640Item, Intel Iris Plus Graphics 640, spdisplays_builtin
Memory Module: BANK 0/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x80AD, 0x483943434E4E4E424A54414C41522D4E5644
Memory Module: BANK 1/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x80AD, 0x483943434E4E4E424A54414C41522D4E5644
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x170), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1600.4)
Bluetooth: Version 7.0.4f6, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB 3.0 Bus
Thunderbolt Bus: MacBook Pro, Apple Inc., 41.4

Async support

Does it support async python? Does it use cProfile under the hood or use yappi which can deal with async Python?

Figure out a better way to display function name

We use absolute path as title now, which is not horrible. However, the actual function name will be buried in the entry and become very difficult to see. It would be nice if we can make it clear and with enough information.

Combine the entries of trace save

Currently, ReportBuilder has too many entries. When we do tracer.save() and when we try to build the report manually, with --combine or something else, we have different paths. It would be nice to unify this.

Occasional failure on Windows of tests.test_simulator.TestSimulator.test_tid_pid

This occasionally happens on the github validation machine. I do not use Windows native to develop that much and I failed to reproduce this issue on my machine with some efforts.

I suspected that this is a racing issue with multithreads.

This is a branch feature(vdb + multithread) and will not affect the main usage as long as you do not use vdb on multithread logs. However, if you are interested in the error, I would appreciate if you could take a deeper look at this. Either figure out why this happens(even fix it with a PR), or find a reliable way to reproduce this.

If you are a contributor and found this error when you PR, you can ignore it for now and re-run the validations.

Traceback (most recent call last):
  File "c:\hostedtoolcache\windows\python\3.8.6\x64\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\hostedtoolcache\windows\python\3.8.6\x64\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\hostedtoolcache\windows\Python\3.8.6\x64\Scripts\vdb.exe\__main__.py", line 7, in <module>
  File "c:\hostedtoolcache\windows\python\3.8.6\x64\lib\site-packages\viztracer\simulator.py", line 143, in main
    sim = Simulator(s, no_clear=options.no_clear, extra_newline=options.extra_newline)
  File "c:\hostedtoolcache\windows\python\3.8.6\x64\lib\site-packages\viztracer\simulator.py", line 29, in __init__
    self.snapshot = ProgSnapshot(json_string, self.print)
  File "c:\hostedtoolcache\windows\python\3.8.6\x64\lib\site-packages\viztracer\prog_snapshot.py", line 177, in __init__
    if not self.load(json_string):
  File "c:\hostedtoolcache\windows\python\3.8.6\x64\lib\site-packages\viztracer\prog_snapshot.py", line 194, in load
    self.load_event(event)
  File "c:\hostedtoolcache\windows\python\3.8.6\x64\lib\site-packages\viztracer\prog_snapshot.py", line 220, in load_event
    self.func_trees[pid][tid].add_event(event)
  File "c:\hostedtoolcache\windows\python\3.8.6\x64\lib\site-packages\viztracer\functree.py", line 88, in add_event
    self.curr.adopt(node)
  File "c:\hostedtoolcache\windows\python\3.8.6\x64\lib\site-packages\viztracer\functree.py", line 72, in adopt
    self.parent.adopt(other)
AttributeError: 'NoneType' object has no attribute 'adopt'

Viztracer not installling [W10]

Hello,

I am unable to install viztracer on Windows 10 using pip install, see error below. I freshly installed visual studio because it’s a dependency (not noted in the installation instructions).

Is there an easy way to fix it?

With kind regards,

Bram

    ERROR: Command errored out with exit status 1:
     command: 'c:\users\username\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-g9mwbo_z\\viztracer\\setup.py'"'"'; __file__='"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-g9mwbo_z\\viztracer\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\username\AppData\Local\Temp\pip-record-pp85dfqp\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\username\appdata\local\programs\python\python38\Include\viztracer'         cwd: C:\Users\username\AppData\Local\Temp\pip-install-g9mwbo_z\viztracer\
    Complete output (32 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\viztracer
    copying src\viztracer\decorator.py -> build\lib.win-amd64-3.8\viztracer
    copying src\viztracer\event_base.py -> build\lib.win-amd64-3.8\viztracer
    copying src\viztracer\flamegraph.py -> build\lib.win-amd64-3.8\viztracer
    copying src\viztracer\report_builder.py -> build\lib.win-amd64-3.8\viztracer
    copying src\viztracer\tracer.py -> build\lib.win-amd64-3.8\viztracer
    copying src\viztracer\util.py -> build\lib.win-amd64-3.8\viztracer
    copying src\viztracer\vizcounter.py -> build\lib.win-amd64-3.8\viztracer
    copying src\viztracer\vizobject.py -> build\lib.win-amd64-3.8\viztracer
    copying src\viztracer\viztracer.py -> build\lib.win-amd64-3.8\viztracer
    copying src\viztracer\__init__.py -> build\lib.win-amd64-3.8\viztracer
    copying src\viztracer\__main__.py -> build\lib.win-amd64-3.8\viztracer
    creating build\lib.win-amd64-3.8\viztracer\html
    copying src\viztracer\html\flamegraph.html -> build\lib.win-amd64-3.8\viztracer\html
    copying src\viztracer\html\trace_viewer_embedder.html -> build\lib.win-amd64-3.8\viztracer\html
    copying src\viztracer\html\trace_viewer_full.html -> build\lib.win-amd64-3.8\viztracer\html
    running build_ext
    building 'viztracer.snaptrace' extension
    creating build\temp.win-amd64-3.8
    creating build\temp.win-amd64-3.8\Release
    creating build\temp.win-amd64-3.8\Release\src
    creating build\temp.win-amd64-3.8\Release\src\viztracer
    creating build\temp.win-amd64-3.8\Release\src\viztracer\modules
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\username\appdata\local\programs\python\python38\include -Ic:\users\username\appdata\local\programs\python\python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/viztracer/modules/snaptrace.c /Fobuild\temp.win-amd64-3.8\Release\src/viztracer/modules/snaptrace.obj
    snaptrace.c
    src/viztracer/modules/snaptrace.c(9): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\username\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-g9mwbo_z\\viztracer\\setup.py'"'"'; __file__='"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-g9mwbo_z\\viztracer\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\username\AppData\Local\Temp\pip-record-pp85dfqp\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\username\appdata\local\programs\python\python38\Include\viztracer' Check the logs for full command output.

MPI support

With mpi4py you run mpirun python main.py
but mpirun viztracer --log_multiprocess main.py leads to
FileNotFoundError: [Errno 2] No such file or directory: ' ./viztracer_multiprocess_tmp'

The command runs multiple viztracer instances and a result.html is generated.
Can I ignore that error?
What do you think about MPI support?

Frame.show fails with frozen modules

I think the stacktrace explains it:

    bottom_frame.show(perror)
  File "/home/maartenbreddels/miniconda/envs/dev/lib/python3.7/site-packages/viztracer/prog_snapshot.py", line 41, in show
    with open(node.filename) as f:
FileNotFoundError: [Errno 2] No such file or directory: '<frozen importlib._bootstrap_external>'

Profile font is too small

The profile font in the result.html file is barely readable. I tried to directly change the font size on the CSS using chrome's developer tools but I couldn't figure it out.

Is there a way to customize that?

Support for multiprocessing.Pool?

I tried using viztracer with a module of mine that uses multiprocessing.Pool, which resulted in an error -- it apparently has some trouble wrapping the pool_worker:

viztracer --log_multiprocess -m sushy.indexer
date=2020-12-06T12:49:12.350 pid=8953 level=WARNING filename=models.py:129:init_db msg="virtual tables may not be indexed"
date=2020-12-06T12:49:12.360 pid=8953 level=INFO filename=indexer.py:258:<module> msg="Scanning /home/rcarmo/Sites/taoofmac.com/space, static rendering is False"
Loading finish                                        
Loading finish                                        
Saving report to /home/rcarmo/Sync/Development/taoofmac-engine/viztracer_multiprocess_tmp/result_8988.json ...
Saving report to /home/rcarmo/Sync/Development/taoofmac-engine/viztracer_multiprocess_tmp/result_8989.json ...
Dumping trace data to json, total entries: 17, estimated json file size: 2.0KiB
Dumping trace data to json, total entries: 17, estimated json file size: 2.0KiB
Report saved.
Report saved.
Traceback (most recent call last):
  File "/home/rcarmo/.pyenv/versions/3.6.9/bin/viztracer", line 8, in <module>
    sys.exit(main())
  File "/home/rcarmo/.pyenv/versions/3.6.9/lib/python3.6/site-packages/viztracer/main.py", line 378, in main
    success, err_msg = ui.run()
  File "/home/rcarmo/.pyenv/versions/3.6.9/lib/python3.6/site-packages/viztracer/main.py", line 205, in run
    return self.run_module()
  File "/home/rcarmo/.pyenv/versions/3.6.9/lib/python3.6/site-packages/viztracer/main.py", line 270, in run_module
    return self.run_code(code, global_dict)
  File "/home/rcarmo/.pyenv/versions/3.6.9/lib/python3.6/site-packages/viztracer/main.py", line 256, in run_code
    exec(code, global_dict)
  File "<string>", line 1, in <module>
  File "/home/rcarmo/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 208, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/home/rcarmo/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/rcarmo/Sync/Development/taoofmac-engine/sushy/indexer.py", line 260, in <module>
    pool_indexer(STORE_PATH)
  File "/home/rcarmo/Sync/Development/taoofmac-engine/sushy/indexer.py", line 240, in pool_indexer
    for res in pool.imap(pool_worker, gen_pages(path), chunksize=10):
  File "/home/rcarmo/.pyenv/versions/3.6.9/lib/python3.6/multiprocessing/pool.py", line 320, in <genexpr>
    return (item for chunk in result for item in chunk)
  File "/home/rcarmo/.pyenv/versions/3.6.9/lib/python3.6/multiprocessing/pool.py", line 735, in next
    raise value
  File "/home/rcarmo/.pyenv/versions/3.6.9/lib/python3.6/multiprocessing/pool.py", line 424, in _handle_tasks
    put(task)
  File "/home/rcarmo/.pyenv/versions/3.6.9/lib/python3.6/multiprocessing/connection.py", line 206, in send
    self._send_bytes(_ForkingPickler.dumps(obj))
  File "/home/rcarmo/.pyenv/versions/3.6.9/lib/python3.6/multiprocessing/reduction.py", line 51, in dumps
    cls(buf, protocol).dump(obj)
_pickle.PicklingError: Can't pickle <function pool_worker at 0x7f39b6d6a488>: attribute lookup pool_worker on __main__ failed
Loading finish                                        
Saving report to /home/rcarmo/Sync/Development/taoofmac-engine/viztracer_multiprocess_tmp/result_8953.json ...
Dumping trace data to json, total entries: 503870, estimated json file size: 57.7MiB
Report saved.
Saving report to /home/rcarmo/Sync/Development/taoofmac-engine/result.html ...
Dumping trace data to json, total entries: 503904, estimated json file size: 57.7MiB
Generating HTML report
Report saved.

Any ideas?

Remote attach for VizTracer

It would be interesting to have some remote features for VizTracer, so the users can simply run their stuff as normal, and attach VizTracer to it. They can profile when they want, and run at normal speed other times.

There are several ways to do this, and the most promising ones are

  • Install the remote signal handler in the process first, and use signal to enable/disable it
  • use gdb to inject code into the process

Obviously using gdb would be unsafe, but that would also be a more generic solution.

The other tricky part is, if we are dealing with a multi-thread or multi-process system, it's very difficult to enable tracing on all threads/processes in the middle of the code.

We'll probably start with single thread program, having that covers a lot of use cases already.

cannot install viztracer

I upgraded pip and virtualenv to latest version. but still cannot download the viztracer. see the errror below:

(env) yangyi@yangyis-mac bin % python -m pip install viztracer
ERROR: Could not find a version that satisfies the requirement viztracer (from versions: none)
ERROR: No matching distribution found for viztracer

asyncio support?

add one tracer object when loop start and call tracer.stop(),trace.save() when loop stopped

but the generated html don't show any traces but one loop.run_forever

is anything wrong ?
截屏2020-10-26 下午2 00 42

Small annoyance url is not clickable in terminal

The trailing dots cause smart terminal to misread the URL. If a space is between it, users can click it.

Saving report to /Users/maartenbreddels/src/ipython/traitlets/result.html...
Saving report to /Users/maartenbreddels/src/ipython/traitlets/result.html...

E.g.

Saving report to /Users/maartenbreddels/src/ipython/traitlets/result.html ...
Saving report to /Users/maartenbreddels/src/ipython/traitlets/result.html ...

A lot of noise when running with `-m` (as module) compared to a script

Two equivalent methods:

$ viztracer -o example1.html per4m/example1.py                                                                                                                                                                         dev
Loading finish                                        
Saving report to /home/maartenbreddels/github/maartenbreddels/per4m/example1.html ...
Dumping trace data to json, total entries: 94, estimated json file size: 11.0KiB
Generating HTML report
Report saved.

$ viztracer -o example1.html -m per4m.example1                                                                                                                                                                         dev
Loading finish                                        
Saving report to /home/maartenbreddels/github/maartenbreddels/per4m/example1.html ...
Dumping trace data to json, total entries: 488664, estimated json file size: 55.9MiB
Generating HTML report
Report saved.

Where the second generates a huge json/html. The tracing shows all the nice:

image

Timing off?

I have this code in my jupyter notebook:

from viztracer import VizTracer
tracer = VizTracer()
tracer.start()

def go():
    for i in range(1000):
        widgets.Layout()
go()
tracer.stop()
tracer.save()

This results in:
image

Where go gives me:


Start | 13,000 ns-- | --
Wall Duration | 4,297,617,000 ns
Self Time | 3,553,028,000 ns

As if most time is spend in go itself, and only 700msec in the constructor of Button (and the rest), which i find highly unlikely.

However, if I select one of the constructor calls:
image

It shows it takes 3ms, so 1000 calls should take ~3seconds. It seems like this does not add up. Is maybe something like systemtime not taken into account? Or am is making a mistake?

Names instead of tip and pid

Is it possible to use threading.Thread.name and multiprocessing.Process.name instead of tid and pid?

Inspeaction of json files showed that names are not currently saved.

OOM due to json.dumps, use alternative json parser or dump to file directly?

OS: windows 10
Python: Python 3.9.5 64bit
RAM: 16GB
Version: VizTracer 0.13.2

Im trying to run viztracer on a relatively small project, and even this generates a OOM when dumping to html or json

Possible solutions:

  • dont use json.dumps, as this uses extra memory. use json.dump to stream to a file directly
  • Use a more memory efficient json parser
Click to see error message
==================================================
== Starting from version 0.13.0, VizTracer will ==
== use json as the default report file. You can ==
== generate HTML report with "-o result.html"   ==
Dumping trace data, total entries: 2272769
Traceback (most recent call last):
  File "d:\prog\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\prog\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\prog\Python37\Scripts\viztracer.exe\__main__.py", line 7, in <module>
  File "d:\prog\python37\lib\site-packages\viztracer\main.py", line 391, in main
    success, err_msg = ui.run()
  File "d:\prog\python37\lib\site-packages\viztracer\main.py", line 213, in run
    return self.run_command()
  File "d:\prog\python37\lib\site-packages\viztracer\main.py", line 293, in run_command
    return self.run_code(code, main_mod.__dict__)
  File "d:\prog\python37\lib\site-packages\viztracer\main.py", line 246, in run_code
    self.exit_routine()
  File "d:\prog\python37\lib\site-packages\viztracer\main.py", line 377, in exit_routine
    self.save(self.tracer)
  File "d:\prog\python37\lib\site-packages\viztracer\main.py", line 371, in save
    tracer.save(output_file=ofile, save_flamegraph=options.save_flamegraph, file_info=True)
  File "d:\prog\python37\lib\site-packages\viztracer\viztracer.py", line 172, in save
    rb.save(output_file=output_file, file_info=file_info)
  File "d:\prog\python37\lib\site-packages\viztracer\report_builder.py", line 135, in save
    data = self.generate_json(allow_binary=True, file_info=file_info)
  File "d:\prog\python37\lib\site-packages\viztracer\report_builder.py", line 108, in generate_json
    return json.dumps(self.combined_json)
  File "d:\prog\python37\lib\json\__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "d:\prog\python37\lib\json\encoder.py", line 202, in encode
    return ''.join(chunks)
MemoryError

AttributeError: 'NoneType' object has no attribute 'pause'

AttributeError: 'NoneType' object has no attribute 'pause' occured
while using decorator ignore_function as decuments ignore_function suggested.

It seemd that the default tracer was not initialized. And if I pass a tracer as param into ignore_function it worked well.

from viztracer import VizTracer, ignore_function

@ignore_function
def f():
    n = 0
    for i in range(1, 100):
        for o in range(1, 20):
            n += (i+0)
    print(n)

with VizTracer(max_stack_depth=3, ignore_c_function=True):
    f()

traceback error:

Traceback (most recent call last):
  File "C:/Users/PycharmProjects/oneway_test/test.py", line 12, in <module>
    f()
  File "D:\virtual\Envs\venv37\lib\site-packages\viztracer\decorator.py", line 17, in ignore_wrapper
    tracer.pause()
AttributeError: 'NoneType' object has no attribute 'pause'

I'm working with python3.7.7 and platform is [MSC v.1900 64 bit (AMD64)] on win32

viztracer stop monitor script before the script ends

Hello,

I am trying to monitor the an async script with command

viztracer script.py --log_async

The log is shown below:

[I:pyppeteer.launcher] Browser listening on: ws://127.0.0.1:48413/devtools/browser/f55f03f4-d402-468e-a3f5-7c4965c0a12d
title:Example Domain
[I:pyppeteer.launcher] terminate chrome process...
17:27:59,141 INFO: Received exit signal shutdown...
17:27:59,142 INFO: Cancelling 0 outstanding tasks
17:27:59,142 INFO: Gathering 0 tasks
17:27:59,142 INFO: Flushing metrics
Loading finish                                        
==================================================
== Starting from version 0.13.0, VizTracer will ==
== use json as the default report file. You can ==
== generate HTML report with "-o result.html"   ==
==================================================
Dumping trace data, total entries: 517717
Saving report to /mnt/sda1/github-own/python-study/coroutine/result.json ...
Use "vizviewer <your_report>" to open the report
[I:pyppeteer.launcher] terminate chrome process...

The last line was printed by the script, which should have been printed before viztracer exited.

GIL information

Hi,

I was wondering if you thought about visualizing when a thread has or tries to get the GIL?

cheers,

Maarten

`json_tokenizer_failure` in Perfetto

Importing the JSON output fails in Perfetto, showing something like this:

Screen Shot 2021-04-06 at 6 29 22 PM

Here's the JSON produced by viztracer -o test.json vt-test.py:
https://gist.github.com/gjoseph92/f5c21ad1b328c8bed3e472be92a32342

And the contents of vt-test.py (tried a few different scripts; doesn't seem to matter):

x = 0
for i in range(10000):
    x += 1

Note that the JSON loads fine in catapult.

I've replicated this with viztracer==0.11.4, viztracer==0.12.0, viztracer==0.12.1, viztracer==0.12.2, viztracer==0.12.3.

The fact that it replicates even with older versions makes me think it's a Perfetto issue, but I wanted to open the issue here first in case anyone has seen this before, or it's an issue with viztracer's formatting of the JSON. If it's not viztracer's problem, I'm happy to move this to https://github.com/google/perfetto/issues

System:

  • macOS 11.2 (x86)
  • Python 3.8.8

Can't install on LinuxMint 19.3

LinuxMint 19.3 (tricia) 
GNOME: 3.28.2 (Ubuntu)
Kernel version: 5.4.0-53-generic (#59~18.04.1-Ubuntu SMP Wed Oct 21 12:14:56 UTC 2020)
GCC: 7 (x86_64-linux-gnu)
Xorg: 1.19.6 (15 September 2020  07:40:51AM)


xx@xx:~$ pip install viztracer
Collecting viztracer
  Downloading https://files.pythonhosted.org/packages/67/28/a2e5f44447beeb4957f984d3e6f58339d8352a76b71c9a6e670528539795/viztracer-0.10.1.tar.gz (678kB)
    100% |████████████████████████████████| 686kB 818kB/s 
Building wheels for collected packages: viztracer
  Running setup.py bdist_wheel for viztracer ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xmeib9s6/viztracer/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp0f5oxn44pip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/__init__.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/code_monkey.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/vizcounter.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/functree.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/report_builder.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/util.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/prog_snapshot.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/event_base.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/vizobject.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/__main__.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/main.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/flamegraph.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/tracer.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/decorator.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/simulator.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/viztracer.py -> build/lib.linux-x86_64-3.6/viztracer
  copying src/viztracer/vizlogging.py -> build/lib.linux-x86_64-3.6/viztracer
  creating build/lib.linux-x86_64-3.6/viztracer/html
  copying src/viztracer/html/trace_viewer_full.html -> build/lib.linux-x86_64-3.6/viztracer/html
  copying src/viztracer/html/trace_viewer_embedder.html -> build/lib.linux-x86_64-3.6/viztracer/html
  copying src/viztracer/html/flamegraph.html -> build/lib.linux-x86_64-3.6/viztracer/html
  running build_ext
  building 'viztracer.snaptrace' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/src
  creating build/temp.linux-x86_64-3.6/src/viztracer
  creating build/temp.linux-x86_64-3.6/src/viztracer/modules
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c src/viztracer/modules/snaptrace.c -o build/temp.linux-x86_64-3.6/src/viztracer/modules/snaptrace.o
  src/viztracer/modules/snaptrace.c:6:10: fatal error: Python.h: No such file or directory
   #include <Python.h>
            ^~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for viztracer
  Running setup.py clean for viztracer
Failed to build viztracer
Installing collected packages: viztracer
  Running setup.py install for viztracer ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xmeib9s6/viztracer/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-142jjrak-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/__init__.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/code_monkey.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/vizcounter.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/functree.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/report_builder.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/util.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/prog_snapshot.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/event_base.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/vizobject.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/__main__.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/main.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/flamegraph.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/tracer.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/decorator.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/simulator.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/viztracer.py -> build/lib.linux-x86_64-3.6/viztracer
    copying src/viztracer/vizlogging.py -> build/lib.linux-x86_64-3.6/viztracer
    creating build/lib.linux-x86_64-3.6/viztracer/html
    copying src/viztracer/html/trace_viewer_full.html -> build/lib.linux-x86_64-3.6/viztracer/html
    copying src/viztracer/html/trace_viewer_embedder.html -> build/lib.linux-x86_64-3.6/viztracer/html
    copying src/viztracer/html/flamegraph.html -> build/lib.linux-x86_64-3.6/viztracer/html
    running build_ext
    building 'viztracer.snaptrace' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    creating build/temp.linux-x86_64-3.6/src/viztracer
    creating build/temp.linux-x86_64-3.6/src/viztracer/modules
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c src/viztracer/modules/snaptrace.c -o build/temp.linux-x86_64-3.6/src/viztracer/modules/snaptrace.o
    src/viztracer/modules/snaptrace.c:6:10: fatal error: Python.h: No such file or directory
     #include <Python.h>
              ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xmeib9s6/viztracer/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-142jjrak-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-xmeib9s6/viztracer/

Does not work well together with tornado

Hi,

I wanted to see if this util could help me profile voila (which is using Tornado), but it gives me this:

$ viztracer -m voila issue/manywidgets.ipynb                                                        dev
[Voila] Using /var/folders/4h/rklzvjwj08170p1nlsntfdkw0000gn/T to store connection files
[Voila] Storing connection files in /var/folders/4h/rklzvjwj08170p1nlsntfdkw0000gn/T/voila_4mz_vpi6.
[Voila] Serving static files from /Users/maartenbreddels/src/QuantStack/voila/voila/static.
[Voila] The port 8866 is already in use, trying another port.
[Voila] The port 8867 is already in use, trying another port.
[Voila] Voilà is running at:
http://localhost:8868/
ERROR:tornado.general:Uncaught exception, closing connection.
Traceback (most recent call last):
  File "/Users/maartenbreddels/miniconda3/envs/dev/lib/python3.7/site-packages/tornado/iostream.py", line 709, in _handle_events
    self._handle_read()
  File "/Users/maartenbreddels/miniconda3/envs/dev/lib/python3.7/site-packages/tornado/iostream.py", line 853, in _handle_read
    self._read_from_buffer(pos)
  File "/Users/maartenbreddels/miniconda3/envs/dev/lib/python3.7/site-packages/tornado/iostream.py", line 993, in _read_from_buffer
    self._run_read_callback(pos, False)
  File "/Users/maartenbreddels/miniconda3/envs/dev/lib/python3.7/site-packages/tornado/iostream.py", line 878, in _run_read_callback
    result = self._consume(size)
  File "/Users/maartenbreddels/miniconda3/envs/dev/lib/python3.7/site-packages/tornado/iostream.py", line 1106, in _consume
    del self._read_buffer[:self._read_buffer_pos]
BufferError: Existing exports of data: object cannot be re-sized
... repeated 10x times....

Is viztracer doing something that could trigger this?

Regards,

Maarten Breddels

run error

i try to run python -m viztracer --include_files ./config train.py --settings_file config/settings.yaml
but get error: python -m viztracer: error: unrecognized arguments: --settings_file
it seems like the parameters between viztracer and train.py is misunderstand, how can i solve this problem?

Tests and a lightweight framework for testing vdb

We need some testing on vdb. Basically making sure all the commands are working properly. We can test the inner data structure, it's acceptable. It would be nice if we can actually test vdb using unittest with some internal framework to communicate.

I can do this when I need to polish the whole project, but it is a rather straightforward problem to solve(especially just writing tests for the data structure ProgSnapshot). I'll leave this as a good first issue for those who want to contribute to open source software but do not know where to start.

If you have any questions, welcome to ask me in this issue.

Install failed in MacOS 10.13.5 due to "src/viztracer/modules/snaptrace.c:7:10: fatal error: 'snaptrace.h' file not found"

Python version: 3.8
Pip version: 19.2.3

building 'viztracer.snaptrace' extension
creating build/temp.macosx-10.9-x86_64-3.8
creating build/temp.macosx-10.9-x86_64-3.8/src
creating build/temp.macosx-10.9-x86_64-3.8/src/viztracer
creating build/temp.macosx-10.9-x86_64-3.8/src/viztracer/modules
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c src/viztracer/modules/snaptrace.c -o build/temp.macosx-10.9-x86_64-3.8/src/viztracer/modules/snaptrace.o
src/viztracer/modules/snaptrace.c:7:10: fatal error: 'snaptrace.h' file not found
#include "snaptrace.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-pa66p68y/viztracer/setup.py'"'"'; file='"'"'/private/tmp/pip-install-pa66p68y/viztracer/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-sm6349sn/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

Design a plugin architecture for other developers to design their own viztracer plugins

We want a plug-in system, where other developers can design their VizTracer compatible code, and use with VizTracer, while enjoying the features VizTracer already has.

This idea comes from #60. The first candidate is perf on Linux. I'm feeling hesitate to build the whole thing into VizTracer, considering it's pretty large and it's Linux only. However, it would be interesting if we can separate the whole thing to a module, and somehow import it when people wants it. If that went well, it could become an "internal" plug-in, where VizTracer is released with, but not on by default.

The plug-in system needs a base class to inherit from, and probably will use the message system to provide reasonable separation and flexibility. I intend to build it as simple as possible and relatively stable once released.

`datetime.timedelta` Raise Exception

python version: 3.8.5
Run with python -m script.py arg1 arg2

Before scripts:

Exception ignored in: <module 'collections.abc' from '/usr/lib/python3.8/collections/abc.py'>
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "xxx/lib/python3.8/site-packages/codesnap/tracer.py", line 37, in tracer
    name = "{}.{}{}".format(frame.f_globals['__name__'], class_name, frame.f_code.co_name)
KeyError: '__name__'
<frozen importlib._bootstrap>:219: RuntimeWarning: Cython module failed to patch module with custom type

After scripts:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "xxx/lib/python3.8/site-packages/codesnap/__main__.py", line 21, in <module>
    snap.save()
  File "xxx/lib/python3.8/site-packages/codesnap/codesnap.py", line 20, in save
    self.parse()
  File "xxx/lib/python3.8/site-packages/codesnap/tracer.py", line 50, in parse
    self.snaptree.add_exit(data[1], data[2])
  File "xxx/lib/python3.8/site-packages/codesnap/snaptree.py", line 38, in add_exit
    raise Exception("Function Entry/Exit did not match.{} vs {}", name, self.curr.function_name)
Exception: ('Function Entry/Exit did not match.{} vs {}', 'datetime.timedelta.__new__', 'datetime.__new__')

如何在多线程使用 VizCounter

我有一段这样的代码,目的是开启一个线程,在主线程运行阶段采样 GPU loading,但是发现最终使用 vizvierew 来看报告的时候,显式结果并不符合预期,看不到我想要的 GPU loading,如果稍微修改一下代码,不使用多线程,而是直接调用 t1.run(),可以看到 GPU Loading,请问这是为什么呢?

OS:Ubuntu 18.03
viztracer version:0.13.3
python version: 3.6.12

code:

目前代码不使用多线程,如果要用的话,可以吧 t1.run() 注释掉,t1.start() 以及后面的 4 行注释打开,循环那里改为 while true,可以复现出非预期的可视化结果。

import json
import sys
import time
import threading
import os
import pynvml as N

job_dir = "train_log_1"
from viztracer import VizTracer
tracer = VizTracer(output_file=os.path.join(job_dir, 'result_%d.json' % (os.getpid(), )),
        max_stack_depth=7)

from viztracer import get_tracer, VizCounter
tracer = get_tracer()
assert tracer is not None, "Invalid tracer, is None!!!"

class GPUStatWorker(threading.Thread):
    def __init__(self, gpu_id, event):
        threading.Thread.__init__(self, name='gpu_stat')
        N.nvmlInit()
        # self.tracer_obj = VizObject(tracer, "gpu_load")
        self.tracer_counter = VizCounter(tracer, "gpu_load")
        self.gpu_id = gpu_id
        self.event = event

    def run(self):
        handle = N.nvmlDeviceGetHandleByIndex(self.gpu_id)
        cnt = 0
        # while True:
        for i in range(1000):
            if self.event.isSet():
                break
            utilization = N.nvmlDeviceGetUtilizationRates(handle)
            name = N.nvmlDeviceGetName(handle).decode()

            self.tracer_counter.a = utilization.gpu
            time.sleep(0.005)

if __name__ == "__main__":
    tracer.start()
    event = threading.Event()
    t1 = GPUStatWorker(0, event)
    # t1.start()
    t1.run()
    # print('start')
    # time.sleep(5)
    # event.set()
    # t1.join()
    tracer.stop()
    entries = tracer.parse()
    print(entries)
    tracer.save()

多线程的可视化结果:

image

不使用多线程的可视化结果:

image

--max_stack_depth seems to affect forked processes (-log_multiprocess)

Hi,
first of all thank you for creating this tool, it looks very useful! And it might for once fix multiprocessing code being hard to profile for me.

An issue I'm encountering is this:

  • It looks like the --max_stack_depth setting affects the stack in forked processes (--log_multiprocess). Maybe it somehow counts the stack depth of the parent process towards this maximum (?).
  • Example: The visual output shows a depth of 3 for a subprocess, but I've set --max_stack_depth 16. When I increase it to 17, I get one additional stack level in the forked process, but of course that's only 4, not 17.
  • Since multiprocessing itself adds a bunch of stack depth that I can't really predict, it's hard to figure out to what I should set my stack depth.
  • I don't want to look at the stack in the main process so deeply, perfect for me would be seeing a stack depth of about 10 for both the parent process and the forked processes.

Not working with multiprocessing?

Hi,

I'm trying to profile a multiprocessing project I'm working on, but the HTML output of VizTracer only shows the main process.
This is the case even with a simple multiprocessing program:

import multiprocessing as mp
from time import sleep


def worker(rank):
    sleep(3)
    print(rank)


def main():
    worker(0)
    ctx = mp.get_context('spawn')
    processes = []
    for i in range(2):
        p = ctx.Process(target=worker, args=(i,))
        p.start()
        processes.append(p)

    for p in processes:
        p.join()


if __name__ == '__main__':
    main()

To profile this, I'm using: python -m viztracer --log_multiprocess profile_this.py. Below is a screenshot of the HTML output:
image

Here is also a zip file containing the result.html output: result.zip
What's wrong here? Am I missing something?

log_parse能否支持递归展示函数栈?

如下面代码, 我用log_parse想查看hello1的调用, 目前只能看到hello1本身, 看不到hello2的调用, 不知是否可以增加一个--recursive之类的选项, 支持递归查看函数栈. 因为一个常用场景是排查某个函数的调用慢, 如果只能看到hello1而无法看到它所调用的hello2的情况, 则还得给hello2加log_parse, 二分法人工得排查具体哪个函数慢.

from viztracer import log_sparse

def hello2():
    return 'hello2'

@log_sparse
def hello1():
    v = hello2()
    return v + 'hello1'

if __name__ == '__main__':
    hello1()

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.