From 8c6932136c009ed5b947c0cc2fb405f4f7020377 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Tue, 7 Jan 1997 16:19:42 +0000 Subject: Added profiler initialization/finalization code (if __profile__ is defined) --- Mac/Python/macmain.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Mac/Python/macmain.c b/Mac/Python/macmain.c index dc14e7c..583ed1a 100644 --- a/Mac/Python/macmain.c +++ b/Mac/Python/macmain.c @@ -41,6 +41,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef __MWERKS__ #include #define USE_SIOUX +#if __profile__ == 1 +#include +#endif #endif #ifdef THINK_C @@ -244,6 +247,10 @@ init_common(int *argcp, char ***argvp) setvbuf(stderr, (char *)NULL, _IOLBF, BUFSIZ); #endif } +#if __profile__ == 1 + /* collectSummary or collectDetailed, timebase, #routines, max stack depth */ + ProfilerInit(collectSummary, bestTimeBase, 2000, 150); +#endif } /* @@ -412,7 +419,11 @@ PyMac_Exit(status) int status; { int keep; - + +#if __profile__ == 1 + ProfilerDump("\pPython Profiler Results"); + ProfilerTerm(); +#endif if ( status ) keep = options.keep_error; else -- cgit v0.12