Giter Club home page Giter Club logo

Comments (6)

evanhempel avatar evanhempel commented on July 22, 2024

This profiler should profile functions inside imported python modules. If you can give me an example where it isn't doing this I'll be happy to investigate.

from python-flamegraph.

test-account-0 avatar test-account-0 commented on July 22, 2024

Ok, maybe I'm just missing something.

Let's look at a simle script test.py:

#!/usr/bin/env python

import math

def calculate_something(lst):
    for element in lst:
        math.sqrt(element)

calculate_something([x for x in xrange(1,10000000)])

When I run something like that:

python -m flamegraph -o perf.log test.py

I just get:

MainThread`_run_code;MainThread`<module>;MainThread`main;MainThread`<module> 484
MainThread`_run_code;MainThread`<module>;MainThread`main;MainThread`<module>;MainThread`calculate_something 35
MainThread`_run_code;MainThread`<module>;MainThread`main;MainThread`start;MainThread`wait;MainThread`wait 1

Where is the number for math.sqrt? Hot to get it?

from python-flamegraph.

evanhempel avatar evanhempel commented on July 22, 2024

It looks like you're on to something, it looks like my approach is unable to sample stackframes inside native c modules.

This module should work ok on pure python, but I need to figure out an approach for native code...

from python-flamegraph.

evanhempel avatar evanhempel commented on July 22, 2024

Take a look at Aaron Solowski's version: https://github.com/asokoloski/python-flamegraph

He's added support using signal.setitimer that will profile inside of c modules. The downside is you lose thread information, but depending on your use-case that's probably a good trade-off.

from python-flamegraph.

jcea avatar jcea commented on July 22, 2024

Any progress?

from python-flamegraph.

evanhempel avatar evanhempel commented on July 22, 2024

No, haven't been working in python recently. Pull requests would be considered. Have you checked out Aaron Solowski's version (linked in Jul 21 comment)?

from python-flamegraph.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.