I've been attempting to profile code that uses the
PyOpenGL bindings. Essentially I've got a program with
that calls glutMainLoop - which is said to never return.
The problem is that since this really envokes some C
code that calls "exit" the profiler does not catch a
"SystemExit" exception, because this is never thrown.
If there was a way to get the profiler to dump state on
demand, I could do this in an "onExit" event handler,
and then restart python with the pstats module to have
a look-see.
Alternatively the profiler could use some OS provided
exit handler - or something simliar.
Also, running the main loop in a thread does not seem
to work (the video memory used by GLUT) is corrupted.
So, this isn't a fair test on which to profile.
I suspect that the ability to dump profile stats to
disk could also be useful for other folks.
|