2014-11-22 7:44 GMT-05:00 Julian Taylor <jtaylor.deb...@googlemail.com>:

> On 17.11.2014 23:09, Francis Giraldeau wrote:
> > Hi,
> > ...
> > The PEP-418 is about performance counters, but there is no mention o
> > Anyway, I think we must change CPython to support tools such as perf.
> > Any thoughts?
> >
>
> there are some patches available adding systemtap and dtrace probes,
> which should at least help getting function level profiles:
>
> http://bugs.python.org/issue21590


Thanks for these links, the patches looks interesting.

As Jonas mentioned, Perf should be able to unwind a Python stack. It does
at the interpreter level, and the frame info is scattered in virtual
memory. It needs to be access offline.

I think it could be possible to use the function entry and exit hooks in
the interpreter to save important frame info, such as function name, file
and line number, in a memory map known to perf. Then, we can tell Perf to
record this compact zone of data in the sample as "extra" field for offline
use. Then, at the analysis time, each ELF interpreter frame could be
matched with the corresponding Python frame info. I think the perf handler
can't sleep, and accesses on each function entry/exit will also ensure the
page is present in main memory when the sample is recorded.

Thanks again for your inputs, I'll post any further developments.

Cheers,

Francis
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to