Granulate / gprofiler

gProfiler is a system-wide profiler, combining multiple sampling profilers to produce unified visualization of what your CPU is spending time on.
https://profiler.granulate.io
Apache License 2.0
746 stars 54 forks source link

python: Support Python 3.11 in PyPerf #727

Closed Jongy closed 1 year ago

Jongy commented 1 year ago

py-spy support for 3.11 was added in https://github.com/benfred/py-spy/commit/fb6515de6834aa45633a7fb9fc49c7ba6357e872. It appears to be only offset changes, so the same can be done for PyPerf quite easily without changing the logic, I think.

See commit which added 3.10 support for PyPerf: https://github.com/Granulate/bcc/commit/75582e0d1861f3c9cf091fe7c88279ae85f9e858

Make sure to unskip/unxfail Python 3.11 tests after applying the fix (and make sure they pass :sweat_smile: ).

Jongy commented 1 year ago

@marcin-ol , failures to unwind might look like the failure I gave in https://github.com/Granulate/gprofiler/issues/502.

Basically, PyPerf unwinds 3 types of things:

If all tests pass when PyPerf is tested on 3.11, I'd say we're good. If we're seeing [Error ...] frames, offsets are bad. You can see the particular extra tests done on PyPerf results: https://github.com/Granulate/gprofiler/blob/02c6d589f014261bb57c9b5f3da3fca40c25632a/tests/test_python.py#L116-L126 (specifically the classmethod & instancemethod calls).