Giter Site home page Giter Site logo

Comments (4)

pablogsal avatar pablogsal commented on June 13, 2024 1

Thanks for opening an issue @gibsondan!

We do have the thread name already collected so it should be fairly simple to pass it through the layers and display it in the TUI

from memray.

godlygeek avatar godlygeek commented on June 13, 2024

Each thread has a string name

Can you clarify which string name you're referring to, @gibsondan ?

from memray.

gibsondan avatar gibsondan commented on June 13, 2024

@godlygeek when you create a thread in python, you can supply a name: https://docs.python.org/3/library/threading.html#thread-objects

(Or a threadpoolexecutor can specify a prefix which is applied to all threads created in that pool)

I don't know offhand how that is translated into the operating system internals but I suspect it's through something like this: https://man7.org/linux/man-pages/man3/pthread_setname_np.3.html

py-spy, for example, includes these names in its output via commands like py-spy dump or the flamegraph produced by py-spy record:

Thread 41 (idle): "schedule_daemon_worker_7"

from memray.

godlygeek avatar godlygeek commented on June 13, 2024

We do have access to the name set through pthread_setname_np, but we don't have access to the name set using threading.Thread.name, and setting the name on a Python Thread object doesn't automatically cause pthread_setname_np to be called with the same name (or even a leading prefix of it).

That said, it would be interesting to try to collect the name attribute set on a threading.Thread... I wonder if we're able to...

from memray.

Related Issues (20)

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.