py-spy icon indicating copy to clipboard operation
py-spy copied to clipboard

py-spy cost too much cpu when enable --gil

Open zdyj3170101136 opened this issue 1 year ago • 3 comments

when i use py-spy, i find it cost too much cpu. the process only cost cpu less than 1%, but py-spy cost cpu more than 20%.

 py-spy  record --nonblocking  --format raw --threads --pid 18024

python version:

[root@plat-sh-data-testing-common-pic-infer-demo001 test]# /proc/18024/exe -V
Python 3.7.7

截屏2023-09-05 下午4 00 35

zdyj3170101136 avatar Sep 05 '23 08:09 zdyj3170101136

@benfred

zdyj3170101136 avatar Sep 05 '23 08:09 zdyj3170101136

here is flamegraph of perf record -g py-spy:

a

zdyj3170101136 avatar Sep 05 '23 08:09 zdyj3170101136

when i use --gil, the issue disapppear.

zdyj3170101136 avatar Sep 05 '23 08:09 zdyj3170101136