]> granicus.if.org Git - python/commitdiff
Added profiler initialization/finalization code (if __profile__ is defined)
authorJack Jansen <jack.jansen@cwi.nl>
Tue, 7 Jan 1997 16:19:42 +0000 (16:19 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Tue, 7 Jan 1997 16:19:42 +0000 (16:19 +0000)
Mac/Python/macmain.c

index dc14e7ccd3981adf309760e0bf1da2812a8a7dd9..583ed1ae4b7931d5b4bcdf6c26cab2dc9e65934f 100644 (file)
@@ -41,6 +41,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #ifdef __MWERKS__
 #include <SIOUX.h>
 #define USE_SIOUX
+#if __profile__ == 1
+#include <profiler.h>
+#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