Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Display native code frames.#41

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
markdewing wants to merge1 commit intovmprof:master
base:master
Choose a base branch
Loading
frommarkdewing:native_frames

Conversation

markdewing
Copy link

This is useful for profiling extension modules and Cython. Support for Numba is coming (need to resolve the JIT addresses)

Filter out native code frames inside the Python library.
Eventually other libraries may be filtered out as well (ctypes.so, etc.)

The default for 'vmprofshow' is now to show native frames (except under PyPy,
in order to preserve existing behavior). The command line flag '--python_only'
will limit the display to only the Python frames.

Add a simple extension module for testing mixed Python and native stacks. These are not connected to the test system.

Untested with vmprof-server, but the upload options are unchanged, so it should be okay.

Filter out native code frames inside the Python library.Eventually other libraries may be filtered out as well (ctypes.so, etc.)The default for 'vmprofshow' is now to show native frames (except under PyPy,in order to preserve existing behavior).  The command line flag '--python_only'will limit the display to only the Python frames.Add a simple extension module for testing mixed Python and native stacks.
@fijal
Copy link
Member

Hi Mark

After a massive rewrite, we decided to completely drop support for C frames together with libunwind due to libunwind problems. However, there is a path towards supporting libunwind "optionally", that is, when available on the platform. Would you be willing to help with such transition?

@markdewing
Copy link
Author

Yes, I am willing to look into it.
I assume you still need to walk the native stack at each sample to get to the Python stacks ? Are you using something other than libunwind, or do you have another way to get the Python part of the stack info?

@fijal
Copy link
Member

We use PyThreadState_Current to walk the python stack and we would need libunwind to read the C stack

@giraldeau
Copy link

For some bits of the implementation, I did a module for perf sampling of Python code. The interesting function is record_traceback() inhttps://github.com/giraldeau/python-profile-ust/blob/master/ext/sampling.c

@fijal
Copy link
Member

vmprof does essentially the same thing (with the additional support for multiple operating systems and multuple VMs). Note that some of the functions you call might not be signal-handler-friendly

@giraldeau
Copy link

Hum, does vmprof does record cache misses and instructions? I know that the prototype I did was limited in various ways, but it was for research/graduating purposes. Anyway, if you want to know more about the project, here is the (unpublished) paper:http://secretaire.dorsal.polymtl.ca/~fgiraldeau/misc/execution-path-profiling-wiley.pdf

For the signal safety, the strings are saved only if they are already in UTF-8, and no memory allocation occurs, which should be signal safe (the signal handler only reads memory). The only thing that bothers me is that pointer assignment to the frame structure can be reordered by the compiler, making visible (for instance) f_code before co_name is set. However, since the code is loaded upfront and we assumes that strings are in UTF-8, this situation should not occur un practice.

Anyway, I do not intend to maintain the prototype I did and if the good pieces (if such thing exists) can be ported to vmprof, then it's cool. Cheers!

@planrich
Copy link
Contributor

As far as I know, vmprof does not make use of hardware performance counters. If you ask me, vmprof is be the right platform for gathering and displaying such information. Pull requests welcome, I'm happy to review them.

@boxed
Copy link

So from this conversation I get that native stacks are a pain to parse properly, but could we at least keep them in the output and just write "" or something? Because just dropping them will skew the profiling result, but showing them unparsed is still pretty useful I believe.

@rlamy
Copy link
Member

@boxed Native frames are supported now.

I think this whole discussion is obsolete.

@boxed
Copy link

Oh. Cool.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@markdewing@fijal@giraldeau@planrich@boxed@rlamy

[8]ページ先頭

©2009-2025 Movatter.jp