comparison src/profile.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 376386a54a3c
children 8d2a9b52c682
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
95 vval = (CONST void *) count; 95 vval = (CONST void *) count;
96 puthash (LISP_TO_VOID (fun), (void *) vval, big_profile_table); 96 puthash (LISP_TO_VOID (fun), (void *) vval, big_profile_table);
97 } 97 }
98 } 98 }
99 99
100 DEFUN ("start-profiling", Fstart_profiling, Sstart_profiling, 0, 1, 0 /* 100 DEFUN ("start-profiling", Fstart_profiling, 0, 1, 0, /*
101 Start profiling, with profile queries every MICROSECS. 101 Start profiling, with profile queries every MICROSECS.
102 If MICROSECS is nil or omitted, the value of `default-profiling-interval' 102 If MICROSECS is nil or omitted, the value of `default-profiling-interval'
103 is used. 103 is used.
104 104
105 You can retrieve the recorded profiling info using `get-profiling-info'. 105 You can retrieve the recorded profiling info using `get-profiling-info'.
106 106
107 Starting and stopping profiling does not clear the currently recorded 107 Starting and stopping profiling does not clear the currently recorded
108 info. Thus you can start and stop as many times as you want and everything 108 info. Thus you can start and stop as many times as you want and everything
109 will be properly accumulated. 109 will be properly accumulated.
110 */ ) 110 */
111 (microsecs) 111 (microsecs))
112 Lisp_Object microsecs;
113 { 112 {
114 int msecs; 113 int msecs;
115 struct itimerval foo; 114 struct itimerval foo;
116 115
117 /* #### The hash code can safely be called from a signal handler 116 /* #### The hash code can safely be called from a signal handler
139 profiling_active = 1; 138 profiling_active = 1;
140 setitimer (ITIMER_PROF, &foo, 0); 139 setitimer (ITIMER_PROF, &foo, 0);
141 return Qnil; 140 return Qnil;
142 } 141 }
143 142
144 DEFUN ("stop-profiling", Fstop_profiling, Sstop_profiling, 0, 0, 0 /* 143 DEFUN ("stop-profiling", Fstop_profiling, 0, 0, 0, /*
145 Stop profiling. 144 Stop profiling.
146 */ ) 145 */
147 () 146 ())
148 { 147 {
149 struct itimerval foo; 148 struct itimerval foo;
150 149
151 foo.it_value.tv_sec = 0; 150 foo.it_value.tv_sec = 0;
152 foo.it_value.tv_usec = 0; 151 foo.it_value.tv_usec = 0;
177 176
178 closure->accum = Fcons (Fcons (key, make_int (val)), 177 closure->accum = Fcons (Fcons (key, make_int (val)),
179 closure->accum); 178 closure->accum);
180 } 179 }
181 180
182 DEFUN ("get-profiling-info", Fget_profiling_info, Sget_profiling_info, 181 DEFUN ("get-profiling-info", Fget_profiling_info, 0, 0, 0, /*
183 0, 0, 0 /*
184 Return the profiling info as an alist. 182 Return the profiling info as an alist.
185 */ ) 183 */
186 () 184 ())
187 { 185 {
188 struct get_profiling_info_closure closure; 186 struct get_profiling_info_closure closure;
189 187
190 closure.accum = Qnil; 188 closure.accum = Qnil;
191 if (big_profile_table) 189 if (big_profile_table)
219 closure.markfun = markfun; 217 closure.markfun = markfun;
220 if (big_profile_table) 218 if (big_profile_table)
221 maphash (mark_profiling_info_maphash, big_profile_table, &closure); 219 maphash (mark_profiling_info_maphash, big_profile_table, &closure);
222 } 220 }
223 221
224 DEFUN ("clear-profiling-info", Fclear_profiling_info, Sclear_profiling_info, 222 DEFUN ("clear-profiling-info", Fclear_profiling_info, 0, 0, 0, /*
225 0, 0, 0 /*
226 Clear out the recorded profiling info. 223 Clear out the recorded profiling info.
227 */ ) 224 */
228 () 225 ())
229 { 226 {
230 if (big_profile_table) 227 if (big_profile_table)
231 clrhash (big_profile_table); 228 clrhash (big_profile_table);
232 return Qnil; 229 return Qnil;
233 } 230 }
234 231
235 DEFUN ("profiling-active-p", Fprofiling_active_p, Sprofiling_active_p, 232 DEFUN ("profiling-active-p", Fprofiling_active_p, 0, 0, 0, /*
236 0, 0, 0 /*
237 Return non-nil if profiling information is currently being recorded. 233 Return non-nil if profiling information is currently being recorded.
238 */ ) 234 */
239 () 235 ())
240 { 236 {
241 return profiling_active ? Qt : Qnil; 237 return profiling_active ? Qt : Qnil;
242 } 238 }
243 239
244 void 240 void
245 syms_of_profile (void) 241 syms_of_profile (void)
246 { 242 {
247 defsubr (&Sstart_profiling); 243 DEFSUBR (Fstart_profiling);
248 defsubr (&Sstop_profiling); 244 DEFSUBR (Fstop_profiling);
249 defsubr (&Sget_profiling_info); 245 DEFSUBR (Fget_profiling_info);
250 defsubr (&Sclear_profiling_info); 246 DEFSUBR (Fclear_profiling_info);
251 defsubr (&Sprofiling_active_p); 247 DEFSUBR (Fprofiling_active_p);
252 } 248 }
253 249
254 void 250 void
255 vars_of_profile (void) 251 vars_of_profile (void)
256 { 252 {