FYI I'd consider py-spy for profiling Python+C extensions: https://github.com/benfred/py-spy#can-py-spy-profile-native-...