Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

423
Visualizações
Statistical Profiling in Python

I would like to know that the Python interpreter is doing in my production environments.

Some time ago I wrote a simple tool called live-trace which runs a daemon thread which collects stacktraces every N milliseconds.

But signal handling in the interpreter itself has one disadvantage:

Although Python signal handlers are called asynchronously as far as the Python user is concerned, they can only occur between the “atomic” instructions of the Python interpreter. This means that signals arriving during long calculations implemented purely in C (such as regular expression matches on large bodies of text) may be delayed for an arbitrary amount of time.

Source: https://docs.python.org/2/library/signal.html

How could I work around above constraint and get a stacktrace, even if the interpreter is in some C code for several seconds?

Related: https://github.com/23andMe/djdt-flamegraph/issues/5

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

I use py-spy with speedscope now. It is a very cool combination.

speedscope-view-of-py-spy-data

py-spy works on Windows/Linux/macOS, can output flame graphs by its own and is actively deployed, eg. subprocess profiling support was added in October 2019.

over 4 years ago · Santiago Trujillo Relatório

0

Have you tried Pyflame? It's based on ptrace, so it shouldn't be affected by CPython's signal handling subtleties.

over 4 years ago · Santiago Trujillo Relatório

0

Maybe the perf-tool from Brendan Gregg can help

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda