Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded Python seems not possible to resolve "native" functions #236

Open
kayhayen opened this issue Jul 2, 2021 · 5 comments
Open

Embedded Python seems not possible to resolve "native" functions #236

kayhayen opened this issue Jul 2, 2021 · 5 comments

Comments

@kayhayen
Copy link

kayhayen commented Jul 2, 2021

Hello,

this is Linux with Python2 and Python3 both.

git clone --branch factory https://github.com/Nuitka/Nuitka.git
python2 ./bin/nuitka-run --profile tests/benchmarks/pystone.py 500000 && python -m vmprof.show nuitka-performance.dat
#or if you prefer:
python3 ./bin/nuitka-run --profile tests/benchmarks/pystone3.py 500000 && python3 -m vmprof.show nuitka-performance.dat

I am getting purely native symbols with plausible time distribution. Nuitka is embedding Python here. I am doing this on Debian Linux with both installed Python2 and Python3 with same results. This used to work years ago. When you look at pystone.bin you will find it's not stripped, has debug symbols, and objdump disassambles it just fine with symbols. It writes "nuitka-performance.dat" hard coded.

The way I am implementing it is here: https://github.com/Nuitka/Nuitka/blob/factory/nuitka/build/static_src/HelpersProfiling.c

Basically I am just calling enable with a file number and default arguments. My checking of vmprof code says that on Linux "native" resolution is automatically enabled by default.

Can you tell me what I am doing wrong, or give me a pointer, to where it's attempted to resolve, so I might debug this? My current best guess is that it might be using sys.exectable, which would not be the binary, something like this. Is embedding of Python supported at all anymore? Was it ever, maybe I always used extension modules, not sure now.

Yours,
Kay

@kayhayen

This comment has been minimized.

@kayhayen

This comment has been minimized.

@kayhayen

This comment has been minimized.

@kayhayen

This comment has been minimized.

@kayhayen
Copy link
Author

kayhayen commented Jul 3, 2021

Ok, when I did that, I found it never recorded what I was having on the stack. It seems to have some severe regressions for mixing C code and Python stacks. At the end, after recording the all C stack, it would unconditionally record the Python stack only, unless in the middle, it encounter a frame evaluation, when it does that sooner.

Still no idea why these came out as native functions. Probably because I barely have any Python stacks, and there are functions on the stack before entering main. When I find the time, I am goingto make a PR out of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant