Mercurial > hg > xemacs-beta
comparison src/profile.h @ 5118:e0db3c197671 ben-lisp-object
merge up to latest default branch, doesn't compile yet
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 26 Dec 2009 21:18:49 -0600 |
parents | 8f6a825eb3d3 |
children | 308d34e9f07d |
comparison
equal
deleted
inserted
replaced
5117:3742ea8250b5 | 5118:e0db3c197671 |
---|---|
45 | 45 |
46 /* As just mentioned, we rely on the dynamic value of profiling_active. | 46 /* As just mentioned, we rely on the dynamic value of profiling_active. |
47 This ensures correct behavior (e.g. we never modify the profiling info | 47 This ensures correct behavior (e.g. we never modify the profiling info |
48 when profiling is not active) because we seed and reap all functions | 48 when profiling is not active) because we seed and reap all functions |
49 currently on the stack when starting and stopping. See | 49 currently on the stack when starting and stopping. See |
50 `start-profiling'. */ | 50 `start-profiling'. |
51 | |
52 We check do_backtrace to make sure that the backtrace structure is | |
53 initialised. If it isn't, we can enter a function with profiling turned | |
54 off, and exit it with it turned on, with the consequence that an | |
55 unitialised backtrace structure is passed to | |
56 profile_record_just_called. Since do_backtrace is function-local (apart | |
57 from in the garbage collector) this avoids that. */ | |
51 #define PROFILE_ENTER_FUNCTION() \ | 58 #define PROFILE_ENTER_FUNCTION() \ |
52 do \ | 59 do \ |
53 { \ | 60 { \ |
54 if (profiling_active) \ | 61 if (profiling_active && do_backtrace) \ |
55 profile_record_about_to_call (&backtrace); \ | 62 profile_record_about_to_call (&backtrace); \ |
56 } \ | 63 } \ |
57 while (0) | 64 while (0) |
58 | 65 |
59 #define PROFILE_EXIT_FUNCTION() \ | 66 #define PROFILE_EXIT_FUNCTION() \ |
60 do \ | 67 do \ |
61 { \ | 68 { \ |
62 if (profiling_active) \ | 69 if (profiling_active && do_backtrace) \ |
63 profile_record_just_called (&backtrace); \ | 70 profile_record_just_called (&backtrace); \ |
64 } \ | 71 } \ |
65 while (0) | 72 while (0) |
66 | 73 |
67 /* We are entering a section that we would like to record profile information | 74 /* We are entering a section that we would like to record profile information |
111 | 118 |
112 #define RETURN_LISP_EXIT_PROFILING(tag, expr) \ | 119 #define RETURN_LISP_EXIT_PROFILING(tag, expr) \ |
113 RETURN_EXIT_PROFILING (tag, Lisp_Object, expr) | 120 RETURN_EXIT_PROFILING (tag, Lisp_Object, expr) |
114 | 121 |
115 #define RETURN_UNGCPRO_EXIT_PROFILING(tag, expr) \ | 122 #define RETURN_UNGCPRO_EXIT_PROFILING(tag, expr) \ |
123 do \ | |
116 { \ | 124 { \ |
117 Lisp_Object ret_ungc_val = (expr); \ | 125 Lisp_Object ret_ungc_val = (expr); \ |
118 UNGCPRO; \ | 126 UNGCPRO; \ |
119 PROFILE_RECORD_EXITING_SECTION (tag); \ | 127 PROFILE_RECORD_EXITING_SECTION (tag); \ |
120 RETURN_SANS_WARNINGS ret_ungc_val; \ | 128 RETURN_SANS_WARNINGS ret_ungc_val; \ |