austin icon indicating copy to clipboard operation
austin copied to clipboard

Feature Request: Call Austin programmatically

Open davidandreoletti opened this issue 1 year ago • 1 comments

Description

Problem:

A python program runs and gets stuck somewhere (except main thread). I would like to send a signal (eg USR2) to the python process which then calls Austin programmatically to produce a sample to see all stack frame at the time of the signal is received.

Workaround Right now, Austin is cli program. It requires:

  • to know where austin is installed (pip cannot be called programmatically as far as I know)
  • to launch austin as an external process.

A python programming interface handling these would facilitate embedding Austin in applications directly:

signal.signal(signal.SIGUSR2, lambda sig, frame: austin.sample(max_sample=1,where=os.getpid(),children=True,...., to=/tmp/sample.out))

Additional Information

Your project is fantastic, well written, clean and useful. Thank you.

davidandreoletti avatar Jul 02 '24 07:07 davidandreoletti

@davidandreoletti thanks for your request. This is perhaps something that can be baked into austin-python. It would still be the process you described, but it would be done automatically when a signal is sent to the process. In the meantime, echion already implements this, so perhaps you can give that a try 🙂 .

P403n1x87 avatar Jul 02 '24 07:07 P403n1x87