Closed daf closed 12 years ago
Seems fine to me. I don't use attach
directly in applications that I profile, instead using attach_on_signal
which takes the profile duration as an argument. I suppose the signal-based trigger only makes sense if you're profiling a large amount of short tasks, rather than one long-running task.
So, the _attach_duration global was there only to allow attach_on_signal
to work. Setting the duration makes way more sense as an argument to attach.
Take a look at the no_global_duration branch -- if that will work for you use case, I think I'd prefer to go that route, getting rid of _attach_duration
and set_attach_duration
.
Yes, that looks great to me. Seems to be working fine here.
I ran into some problems while trying to profile long-running operations - whenever my code eventually got to the
detach
method, it would just throw a python error. Tracing the steps, I figured it out there is a timeout involved, by default set to 60 seconds.This patch does a few things:
detach
when there isn't an activeattach
session is not an errorset_attach_duration
- set to0
to disable.