annotate src/profile.c @ 4952:19a72041c5ed

Mule-izing, various fixes related to char * arguments -------------------- ChangeLog entries follow: -------------------- modules/ChangeLog addition: 2010-01-26 Ben Wing <ben@xemacs.org> * postgresql/postgresql.c: * postgresql/postgresql.c (CHECK_LIVE_CONNECTION): * postgresql/postgresql.c (print_pgresult): * postgresql/postgresql.c (Fpq_conn_defaults): * postgresql/postgresql.c (Fpq_connectdb): * postgresql/postgresql.c (Fpq_connect_start): * postgresql/postgresql.c (Fpq_result_status): * postgresql/postgresql.c (Fpq_res_status): Mule-ize large parts of it. 2010-01-26 Ben Wing <ben@xemacs.org> * ldap/eldap.c (print_ldap): * ldap/eldap.c (allocate_ldap): Use write_ascstring(). src/ChangeLog addition: 2010-01-26 Ben Wing <ben@xemacs.org> * alloc.c: * alloc.c (build_ascstring): * alloc.c (build_msg_cistring): * alloc.c (staticpro_1): * alloc.c (staticpro_name): * alloc.c (staticpro_nodump_1): * alloc.c (staticpro_nodump_name): * alloc.c (unstaticpro_nodump_1): * alloc.c (mcpro_1): * alloc.c (mcpro_name): * alloc.c (object_memory_usage_stats): * alloc.c (common_init_alloc_early): * alloc.c (init_alloc_once_early): * buffer.c (print_buffer): * buffer.c (vars_of_buffer): * buffer.c (common_init_complex_vars_of_buffer): * buffer.c (init_initial_directory): * bytecode.c (invalid_byte_code): * bytecode.c (print_compiled_function): * bytecode.c (mark_compiled_function): * chartab.c (print_table_entry): * chartab.c (print_char_table): * config.h.in: * console-gtk.c: * console-gtk.c (gtk_device_to_console_connection): * console-gtk.c (gtk_semi_canonicalize_console_connection): * console-gtk.c (gtk_canonicalize_console_connection): * console-gtk.c (gtk_semi_canonicalize_device_connection): * console-gtk.c (gtk_canonicalize_device_connection): * console-stream.c (stream_init_frame_1): * console-stream.c (vars_of_console_stream): * console-stream.c (init_console_stream): * console-x.c (x_semi_canonicalize_console_connection): * console-x.c (x_semi_canonicalize_device_connection): * console-x.c (x_canonicalize_device_connection): * console-x.h: * data.c (eq_with_ebola_notice): * data.c (Fsubr_interactive): * data.c (Fnumber_to_string): * data.c (digit_to_number): * device-gtk.c (gtk_init_device): * device-msw.c (print_devmode): * device-x.c (x_event_name): * dialog-msw.c (handle_directory_dialog_box): * dialog-msw.c (handle_file_dialog_box): * dialog-msw.c (vars_of_dialog_mswindows): * doc.c (weird_doc): * doc.c (Fsnarf_documentation): * doc.c (vars_of_doc): * dumper.c (pdump): * dynarr.c: * dynarr.c (Dynarr_realloc): * editfns.c (Fuser_real_login_name): * editfns.c (get_home_directory): * elhash.c (print_hash_table_data): * elhash.c (print_hash_table): * emacs.c (main_1): * emacs.c (vars_of_emacs): * emodules.c: * emodules.c (_emodules_list): * emodules.c (Fload_module): * emodules.c (Funload_module): * emodules.c (Flist_modules): * emodules.c (find_make_module): * emodules.c (attempt_module_delete): * emodules.c (emodules_load): * emodules.c (emodules_doc_subr): * emodules.c (emodules_doc_sym): * emodules.c (syms_of_module): * emodules.c (vars_of_module): * emodules.h: * eval.c (print_subr): * eval.c (signal_call_debugger): * eval.c (build_error_data): * eval.c (signal_error): * eval.c (maybe_signal_error): * eval.c (signal_continuable_error): * eval.c (maybe_signal_continuable_error): * eval.c (signal_error_2): * eval.c (maybe_signal_error_2): * eval.c (signal_continuable_error_2): * eval.c (maybe_signal_continuable_error_2): * eval.c (signal_ferror): * eval.c (maybe_signal_ferror): * eval.c (signal_continuable_ferror): * eval.c (maybe_signal_continuable_ferror): * eval.c (signal_ferror_with_frob): * eval.c (maybe_signal_ferror_with_frob): * eval.c (signal_continuable_ferror_with_frob): * eval.c (maybe_signal_continuable_ferror_with_frob): * eval.c (syntax_error): * eval.c (syntax_error_2): * eval.c (maybe_syntax_error): * eval.c (sferror): * eval.c (sferror_2): * eval.c (maybe_sferror): * eval.c (invalid_argument): * eval.c (invalid_argument_2): * eval.c (maybe_invalid_argument): * eval.c (invalid_constant): * eval.c (invalid_constant_2): * eval.c (maybe_invalid_constant): * eval.c (invalid_operation): * eval.c (invalid_operation_2): * eval.c (maybe_invalid_operation): * eval.c (invalid_change): * eval.c (invalid_change_2): * eval.c (maybe_invalid_change): * eval.c (invalid_state): * eval.c (invalid_state_2): * eval.c (maybe_invalid_state): * eval.c (wtaerror): * eval.c (stack_overflow): * eval.c (out_of_memory): * eval.c (print_multiple_value): * eval.c (issue_call_trapping_problems_warning): * eval.c (backtrace_specials): * eval.c (backtrace_unevalled_args): * eval.c (Fbacktrace): * eval.c (warn_when_safe): * event-Xt.c (modwarn): * event-Xt.c (modbarf): * event-Xt.c (check_modifier): * event-Xt.c (store_modifier): * event-Xt.c (emacs_Xt_format_magic_event): * event-Xt.c (describe_event): * event-gtk.c (dragndrop_data_received): * event-gtk.c (store_modifier): * event-gtk.c (gtk_reset_modifier_mapping): * event-msw.c (dde_eval_string): * event-msw.c (Fdde_alloc_advise_item): * event-msw.c (mswindows_dde_callback): * event-msw.c (FROB): * event-msw.c (emacs_mswindows_format_magic_event): * event-stream.c (external_debugging_print_event): * event-stream.c (execute_help_form): * event-stream.c (vars_of_event_stream): * events.c (print_event_1): * events.c (print_event): * events.c (event_equal): * extents.c (print_extent_1): * extents.c (print_extent): * extents.c (vars_of_extents): * faces.c (print_face): * faces.c (complex_vars_of_faces): * file-coding.c: * file-coding.c (print_coding_system): * file-coding.c (print_coding_system_in_print_method): * file-coding.c (default_query_method): * file-coding.c (find_coding_system): * file-coding.c (make_coding_system_1): * file-coding.c (chain_print): * file-coding.c (undecided_print): * file-coding.c (gzip_print): * file-coding.c (vars_of_file_coding): * file-coding.c (complex_vars_of_file_coding): * fileio.c: * fileio.c (report_file_type_error): * fileio.c (report_error_with_errno): * fileio.c (report_file_error): * fileio.c (barf_or_query_if_file_exists): * fileio.c (vars_of_fileio): * floatfns.c (matherr): * fns.c (print_bit_vector): * fns.c (Fmapconcat): * fns.c (add_suffix_to_symbol): * fns.c (add_prefix_to_symbol): * frame-gtk.c: * frame-gtk.c (Fgtk_window_id): * frame-x.c (def): * frame-x.c (x_cde_transfer_callback): * frame.c: * frame.c (Fmake_frame): * gc.c (show_gc_cursor_and_message): * gc.c (vars_of_gc): * glyphs-eimage.c (png_instantiate): * glyphs-eimage.c (tiff_instantiate): * glyphs-gtk.c (gtk_print_image_instance): * glyphs-msw.c (mswindows_print_image_instance): * glyphs-x.c (x_print_image_instance): * glyphs-x.c (update_widget_face): * glyphs.c (make_string_from_file): * glyphs.c (print_image_instance): * glyphs.c (signal_image_error): * glyphs.c (signal_image_error_2): * glyphs.c (signal_double_image_error): * glyphs.c (signal_double_image_error_2): * glyphs.c (xbm_mask_file_munging): * glyphs.c (pixmap_to_lisp_data): * glyphs.h: * gui.c (gui_item_display_flush_left): * hpplay.c (player_error_internal): * hpplay.c (myHandler): * intl-win32.c: * intl-win32.c (langcode_to_lang): * intl-win32.c (sublangcode_to_lang): * intl-win32.c (Fmswindows_get_locale_info): * intl-win32.c (lcid_to_locale_mule_or_no): * intl-win32.c (mswindows_multibyte_to_unicode_print): * intl-win32.c (complex_vars_of_intl_win32): * keymap.c: * keymap.c (print_keymap): * keymap.c (ensure_meta_prefix_char_keymapp): * keymap.c (Fkey_description): * keymap.c (Ftext_char_description): * lisp.h: * lisp.h (struct): * lisp.h (DECLARE_INLINE_HEADER): * lread.c (Fload_internal): * lread.c (locate_file): * lread.c (read_escape): * lread.c (read_raw_string): * lread.c (read1): * lread.c (read_list): * lread.c (read_compiled_function): * lread.c (init_lread): * lrecord.h: * marker.c (print_marker): * marker.c (marker_equal): * menubar-msw.c (displayable_menu_item): * menubar-x.c (command_builder_operate_menu_accelerator): * menubar.c (vars_of_menubar): * minibuf.c (reinit_complex_vars_of_minibuf): * minibuf.c (complex_vars_of_minibuf): * mule-charset.c (Fmake_charset): * mule-charset.c (complex_vars_of_mule_charset): * mule-coding.c (iso2022_print): * mule-coding.c (fixed_width_query): * number.c (bignum_print): * number.c (ratio_print): * number.c (bigfloat_print): * number.c (bigfloat_finalize): * objects-msw.c: * objects-msw.c (mswindows_color_to_string): * objects-msw.c (mswindows_color_list): * objects-tty.c: * objects-tty.c (tty_font_list): * objects-tty.c (tty_find_charset_font): * objects-xlike-inc.c (xft_find_charset_font): * objects-xlike-inc.c (endif): * print.c: * print.c (write_istring): * print.c (write_ascstring): * print.c (Fterpri): * print.c (Fprint): * print.c (print_error_message): * print.c (print_vector_internal): * print.c (print_cons): * print.c (print_string): * print.c (printing_unreadable_object): * print.c (print_internal): * print.c (print_float): * print.c (print_symbol): * process-nt.c (mswindows_report_winsock_error): * process-nt.c (nt_canonicalize_host_name): * process-unix.c (unix_canonicalize_host_name): * process.c (print_process): * process.c (report_process_error): * process.c (report_network_error): * process.c (make_process_internal): * process.c (Fstart_process_internal): * process.c (status_message): * process.c (putenv_internal): * process.c (vars_of_process): * process.h: * profile.c (vars_of_profile): * rangetab.c (print_range_table): * realpath.c (vars_of_realpath): * redisplay.c (vars_of_redisplay): * search.c (wordify): * search.c (Freplace_match): * sheap.c (sheap_adjust_h): * sound.c (report_sound_error): * sound.c (Fplay_sound_file): * specifier.c (print_specifier): * symbols.c (Fsubr_name): * symbols.c (do_symval_forwarding): * symbols.c (set_default_buffer_slot_variable): * symbols.c (set_default_console_slot_variable): * symbols.c (store_symval_forwarding): * symbols.c (default_value): * symbols.c (defsymbol_massage_name_1): * symbols.c (defsymbol_massage_name_nodump): * symbols.c (defsymbol_massage_name): * symbols.c (defsymbol_massage_multiword_predicate_nodump): * symbols.c (defsymbol_massage_multiword_predicate): * symbols.c (defsymbol_nodump): * symbols.c (defsymbol): * symbols.c (defkeyword): * symbols.c (defkeyword_massage_name): * symbols.c (check_module_subr): * symbols.c (deferror_1): * symbols.c (deferror): * symbols.c (deferror_massage_name): * symbols.c (deferror_massage_name_and_message): * symbols.c (defvar_magic): * symeval.h: * symeval.h (DEFVAR_SYMVAL_FWD): * sysdep.c: * sysdep.c (init_system_name): * sysdll.c: * sysdll.c (MAYBE_PREPEND_UNDERSCORE): * sysdll.c (dll_function): * sysdll.c (dll_variable): * sysdll.c (dll_error): * sysdll.c (dll_open): * sysdll.c (dll_close): * sysdll.c (image_for_address): * sysdll.c (my_find_image): * sysdll.c (search_linked_libs): * sysdll.h: * sysfile.h: * sysfile.h (DEFAULT_DIRECTORY_FALLBACK): * syswindows.h: * tests.c (DFC_CHECK_LENGTH): * tests.c (DFC_CHECK_CONTENT): * tests.c (Ftest_hash_tables): * text.c (vars_of_text): * text.h: * tooltalk.c (tt_opnum_string): * tooltalk.c (tt_message_arg_ival_string): * tooltalk.c (Ftooltalk_default_procid): * tooltalk.c (Ftooltalk_default_session): * tooltalk.c (init_tooltalk): * tooltalk.c (vars_of_tooltalk): * ui-gtk.c (Fdll_load): * ui-gtk.c (type_to_marshaller_type): * ui-gtk.c (Fgtk_import_function_internal): * ui-gtk.c (emacs_gtk_object_printer): * ui-gtk.c (emacs_gtk_boxed_printer): * unicode.c (unicode_to_ichar): * unicode.c (unicode_print): * unicode.c (unicode_query): * unicode.c (vars_of_unicode): * unicode.c (complex_vars_of_unicode): * win32.c: * win32.c (mswindows_report_process_error): * window.c (print_window): * xemacs.def.in.in: BASIC IDEA: Further fixing up uses of char * and CIbyte * to reflect their actual semantics; Mule-izing some code; redoing of the not-yet-working code to handle message translation. Clean up code to handle message-translation (not yet working). Create separate versions of build_msg_string() for working with Ibyte *, CIbyte *, and Ascbyte * arguments. Assert that Ascbyte * arguments are pure-ASCII. Make build_msg_string() be the same as build_msg_ascstring(). Create same three versions of GETTEXT() and DEFER_GETTEXT(). Also create build_defer_string() and variants for the equivalent of DEFER_GETTEXT() when building a string. Remove old CGETTEXT(). Clean up code where GETTEXT(), DEFER_GETTEXT(), build_msg_string(), etc. was being called and introduce some new calls to build_msg_string(), etc. Remove GETTEXT() from calls to weird_doc() -- we assume that the message snarfer knows about weird_doc(). Remove uses of DEFER_GETTEXT() from error messages in sysdep.c and instead use special comments /* @@@begin-snarf@@@ */ and /* @@@end-snarf@@@ */ that the message snarfer presumably knows about. Create build_ascstring() and use it in many instances in place of build_string(). The purpose of having Ascbyte * variants is to make the code more self-documenting in terms of what sort of semantics is expected for char * strings. In fact in the process of looking for uses of build_string(), much improperly Mule-ized was discovered. Mule-ize a lot of code as described in previous paragraph, e.g. in sysdep.c. Make the error functions take Ascbyte * strings and fix up a couple of places where non-pure-ASCII strings were being passed in (file-coding.c, mule-coding.c, unicode.c). (It's debatable whether we really need to make the error functions work this way. It helps catch places where code is written in a way that message translation won't work, but we may well never implement message translation.) Make staticpro() and friends take Ascbyte * strings instead of raw char * strings. Create a const_Ascbyte_ptr dynarr type to describe what's held by staticpro_names[] and friends, create pdump descriptions for const_Ascbyte_ptr dynarrs, and use them in place of specially-crafted staticpro descriptions. Mule-ize certain other functions (e.g. x_event_name) by correcting raw use of char * to Ascbyte *, Rawbyte * or another such type, and raw use of char[] buffers to another type (usually Ascbyte[]). Change many uses of write_c_string() to write_msg_string(), write_ascstring(), etc. Mule-ize emodules.c, emodules.h, sysdll.h. Fix some un-Mule-ized code in intl-win32.c. A comment in event-Xt.c and the limitations of the message snarfer (make-msgfile or whatever) is presumably incorrect -- it should be smart enough to handle function calls spread over more than one line. Clean up code in event-Xt.c that was written awkwardly for this reason. In config.h.in, instead of NEED_ERROR_CHECK_TYPES_INLINES, create a more general XEMACS_DEFS_NEEDS_INLINE_DECLS to indicate when inlined functions need to be declared in xemacs.defs.in.in, and make use of it in xemacs.defs.in.in. We need to do this because postgresql.c now calls qxestrdup(), which is an inline function. Make nconc2() and other such functions MODULE_API and put them in xemacs.defs.in.in since postgresql.c now uses them. Clean up indentation in lread.c and a few other places. In text.h, document ASSERT_ASCTEXT_ASCII() and ASSERT_ASCTEXT_ASCII_LEN(), group together the stand-in encodings and add some more for DLL symbols, function and variable names, etc.
author Ben Wing <ben@xemacs.org>
date Tue, 26 Jan 2010 23:22:30 -0600
parents e6854ec89f8e
children ae48681c47fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Why the hell is XEmacs so fucking slow?
2514
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
2 Copyright (C) 1996, 2002, 2003, 2004 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1998 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 #include "backtrace.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 #include "bytecode.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include "elhash.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include "hash.h"
1315
70921960b980 [xemacs-hg @ 2003-02-20 08:19:28 by ben]
ben
parents: 1292
diff changeset
29 #include "profile.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include "syssignal.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include "systime.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 458
diff changeset
34 #ifndef HAVE_SETITIMER
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 458
diff changeset
35 #error Sorry charlie. We need a scalpel and all we have is a lawnmower.
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 458
diff changeset
36 #endif
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 458
diff changeset
37
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
38 #ifdef WIN32_ANY
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
39 int mswindows_is_blocking;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
40 #endif
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
41
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
42 /* Written by Ben Wing. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
44 /*
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
46 Documented in
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
48 (Info-goto-node "(internals)Profiling")
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
49 */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
50
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
51 /* We use a plain table here because we're recording inside of a signal
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
52 handler. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 static struct hash_table *big_profile_table;
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
54 Lisp_Object Vtotal_timing_profile_table;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 Lisp_Object Vcall_count_profile_table;
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
56 Lisp_Object Vtotal_gc_usage_profile_table;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
57 Lisp_Object Vgc_usage_profile_table;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
58
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
59 extern int lisp_eval_depth;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
60
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
61 extern EMACS_UINT total_consing;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
62 static volatile EMACS_UINT total_ticks;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63
458
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 442
diff changeset
64 Fixnum default_profiling_interval;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 int profiling_active;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
68 static Lisp_Object QSprocessing_events_at_top_level;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
69 static Lisp_Object QSunknown, QSprofile_overhead;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
70
2514
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
71 #ifdef DEBUG_XEMACS
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
72 /* For temporary profiling */
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
73 Lisp_Object QSin_temp_spot_1;
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
74 Lisp_Object QSin_temp_spot_2;
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
75 Lisp_Object QSin_temp_spot_3;
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
76 Lisp_Object QSin_temp_spot_4;
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
77 Lisp_Object QSin_temp_spot_5;
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
78 #endif /* DEBUG_XEMACS */
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
79
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
80 static Lisp_Object Qtiming, Qtotal_timing, Qcall_count;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
81 static Lisp_Object Qgc_usage, Qtotal_gc_usage;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
82
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
83 /* This needs to be >= the total number of defined internal sections,
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
84 plus 1 or 2?? Set it extra big just to be ultra-paranoid. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
85 #define EXTRA_BREATHING_ROOM 100
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
87 /* We use profiling_lock to prevent the signal handler from writing to
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
88 the table while another routine is operating on it. We also set
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
89 profiling_lock in case the timeout between signal calls is short
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
90 enough to catch us while we're already in there. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
91 static volatile int profiling_lock;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
93 /* Whether we're in the process of doing *any* profiling-related stuff.
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
94 Used to indicate amount of time spent profiling. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
95 static int in_profiling;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
96
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
97 #if 0 /* #### for KKCC, eventually */
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
98
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
99 static const struct memory_description hentry_description_1[] = {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
100 { XD_LISP_OBJECT, offsetof (hentry, key) },
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
101 { XD_END }
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
102 };
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
103
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
104 static const struct sized_memory_description hentry_description = {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
105 sizeof (hentry),
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
106 hentry_description_1
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
107 };
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
109 static const struct memory_description plain_hash_table_description_1[] = {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
110 { XD_ELEMCOUNT, offsetof (struct hash_table, size) },
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
111 { XD_BLOCK_PTR, offsetof (struct hash_table, harray), XD_INDIRECT (0, 0),
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2514
diff changeset
112 { &hentry_description } },
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
113 { XD_END }
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
114 };
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
115
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
116 static const struct sized_memory_description plain_hash_table_description = {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
117 sizeof (struct hash_table),
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
118 plain_hash_table_description_1
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
119 };
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
120
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
121 #endif /* 0 */
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
122
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
123 static void
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
124 create_timing_profile_table (void)
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
125 {
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
126 /* The hash code can safely be called from a signal handler except when
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
127 it has to grow the hash table. In this case, it calls realloc(),
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
128 which is not (in general) re-entrant. The way we deal with this is
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
129 documented at the top of this file. */
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
130 if (!big_profile_table)
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
131 big_profile_table = make_hash_table (2000);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
132 }
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
133
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
134 static void
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
135 create_profile_tables (void)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
136 {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
137 create_timing_profile_table ();
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
138 if (NILP (Vtotal_timing_profile_table))
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
139 Vtotal_timing_profile_table =
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
140 make_lisp_hash_table (1000, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
141 if (NILP (Vcall_count_profile_table))
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
142 Vcall_count_profile_table =
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
143 make_lisp_hash_table (1000, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
144 if (NILP (Vgc_usage_profile_table))
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
145 Vgc_usage_profile_table =
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
146 make_lisp_hash_table (1000, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
147 if (NILP (Vtotal_gc_usage_profile_table))
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
148 Vtotal_gc_usage_profile_table =
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
149 make_lisp_hash_table (1000, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
150 }
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
151
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
152 static Lisp_Object
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
153 current_profile_function (void)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
154 {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
155 Lisp_Object fun;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
156 struct backtrace *bt = backtrace_list;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
157
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
158 /* 2 because we set in_profiling when we entered the current routine. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
159 if (in_profiling >= 2)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
160 return QSprofile_overhead;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
161
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
162 /* Find a function actually being called. Potentially (?) there could be
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
163 a number of non-calling funs -- calling foo autoloads, which tries to
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
164 call bar, but requires evalling its args first, which calls baz, ...
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
165 If profiling was not enabled when the function was called, just treat
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
166 the function as actually called, because the info about whether we've
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
167 finished the preamble will not have been recorded. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
168 for (; bt && !bt->function_being_called; bt = bt->next)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
169 ;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
170
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
171 if (bt)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
172 {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
173 fun = *bt->function;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
174
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
175 if (!SYMBOLP (fun)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
176 && !COMPILED_FUNCTIONP (fun)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
177 && !SUBRP (fun)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
178 && !CONSP (fun)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
179 && !STRINGP (fun))
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
180 fun = QSunknown;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
181 }
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
182 else
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
183 fun = QSprocessing_events_at_top_level;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
184 return fun;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
185 }
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
186
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
187 void
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
188 profile_record_consing (EMACS_INT size)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
189 {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
190 in_profiling++;
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
191 inchash_eq (current_profile_function (), Vgc_usage_profile_table, size);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
192 in_profiling--;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
193 }
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
194
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
195 void
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
196 profile_record_unconsing (EMACS_INT size)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
197 {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
198 /* If we don't want to record values less than 0, change this; but then
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
199 the totals won't be accurate. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
200 profile_record_consing (-size);
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
201 }
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
202
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
203 inline static void
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
204 profile_sow_backtrace (struct backtrace *bt)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 {
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
206 bt->current_total_timing_val =
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
207 XINT (Fgethash (*bt->function, Vtotal_timing_profile_table, Qzero));
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
208 bt->current_total_gc_usage_val =
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
209 XINT (Fgethash (*bt->function, Vtotal_gc_usage_profile_table, Qzero));
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
210 bt->function_being_called = 1;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
211 /* Need to think carefully about the exact order of operations here
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
212 so that we don't end up with totals being less than function-only
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
213 values; */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
214 bt->total_consing_at_start = total_consing;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
215 /* Order of operation is tricky here because we want the total function
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
216 time to be as close as possible to (and absolutely not less than) the
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
217 function-only time. From the sigprof-handler's perspective, the
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
218 function is "entered" the moment we finish executing the
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
219 in_profiling-- statement below, and ends the moment we finish
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
220 executing the in_profiling++ statement in
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
221 profile_record_just_called(). By recording the tick value as close as
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
222 possible to the "in-function" window but not in it, we satisfy the
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
223 conditions just mentioned. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
224 bt->total_ticks_at_start = total_ticks;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
225 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
227 void
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
228 profile_record_about_to_call (struct backtrace *bt)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
229 {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
230 in_profiling++;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
231 profiling_lock = 1;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
232 /* See comments in create_timing_profile_table(). */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
233 pregrow_hash_table_if_necessary (big_profile_table, EXTRA_BREATHING_ROOM);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
234 profiling_lock = 0;
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
235 inchash_eq (*bt->function, Vcall_count_profile_table, 1);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
236 /* This may be set if the function was in its preamble at the time that
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
237 `start-profiling' was called. If so, we shouldn't reset the values
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
238 because we may get inconsistent results, since we have already started
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
239 recording ticks and consing for the function. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
240 if (!bt->function_being_called)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
241 profile_sow_backtrace (bt);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
242 in_profiling--;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
243 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
245 inline static void
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
246 profile_reap_backtrace (struct backtrace *bt)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
247 {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
248 EMACS_UINT ticks;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
249 /* The following statement *MUST* come directly after the preceding one!
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
250 See the comment above. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
251 ticks = total_ticks;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
252 /* We need to reset the "in-function" flag here. Otherwise the sigprof
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
253 handler will record more ticks for the function while the post-amble
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
254 is executing, and its value will be > our total value. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
255 bt->function_being_called = 0;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
256 Fputhash (*bt->function,
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
257 /* This works even when the total_ticks value has overwrapped.
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
258 Same for total_consing below. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
259 make_int ((EMACS_INT) (ticks - bt->total_ticks_at_start)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
260 + bt->current_total_timing_val),
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
261 Vtotal_timing_profile_table);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
262 Fputhash (*bt->function,
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
263 make_int ((EMACS_INT)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
264 (total_consing - bt->total_consing_at_start)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
265 + bt->current_total_gc_usage_val),
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
266 Vtotal_gc_usage_profile_table);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
267 }
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
268
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
269 void
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
270 profile_record_just_called (struct backtrace *bt)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
271 {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
272 in_profiling++;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
273 profile_reap_backtrace (bt);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
274 in_profiling--;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
275 }
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
276
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
277 /* Called when unwinding the catch stack after a throw or signal, to
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
278 note that we are exiting the function. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
279 void
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
280 profile_record_unwind (struct backtrace *bt)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
281 {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
282 /* We may have thrown while still in a function's preamble. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
283 if (bt->function_being_called)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
284 profile_record_just_called (bt);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 static SIGTYPE
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1598
diff changeset
288 sigprof_handler (int UNUSED (signo))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 {
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
290 #ifdef WIN32_ANY
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
291 /* Windows unfortunately does not have any such thing as setitimer
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
292 (ITIMER_PROF, ...), which runs in process time. Everything is real
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
293 time. So to get slightly more reasonable results, ignore completely
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
294 the times when we're blocking. Same applies, of course, to Cygwin. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
295 if (mswindows_is_blocking)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
296 return;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
297 #endif
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
298
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
299 in_profiling++;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
300 total_ticks++;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
301
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 /* Don't do anything if we are shutting down, or are doing a maphash
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 or clrhash on the table. */
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
304 if (!profiling_lock && !preparing_for_armageddon)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 {
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
306 Lisp_Object fun = current_profile_function ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 /* If something below causes an error to be signaled, we'll
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 not correctly reset this flag. But we'll be in worse shape
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 than that anyways, since we'll longjmp back to the last
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 condition case. */
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
312 profiling_lock = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 long count;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
316 const void *vval;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 if (gethash (LISP_TO_VOID (fun), big_profile_table, &vval))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 count = (long) vval;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 count = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 count++;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
323 vval = (const void *) count;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 puthash (LISP_TO_VOID (fun), (void *) vval, big_profile_table);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
327 profiling_lock = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 }
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
329 in_profiling--;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
332 DEFUN ("start-profiling", Fstart_profiling, 0, 1, "", /*
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 Start profiling, with profile queries every MICROSECS.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 If MICROSECS is nil or omitted, the value of `default-profiling-interval'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 is used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
337 Information on function timings and call counts is currently recorded.
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
338 You can retrieve the recorded profiling info using `get-profiling-info',
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
339 or the higher-level function `profile-results'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 Starting and stopping profiling does not clear the currently recorded
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 info. Thus you can start and stop as many times as you want and everything
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
343 will be properly accumulated. (To clear, use `clear-profiling-info'.)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 (microsecs))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 int msecs;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 struct itimerval foo;
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
350 int depth;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
352 if (profiling_active)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
353 return Qnil;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
354 depth = internal_bind_int (&in_profiling, 1 + in_profiling);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
355
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
356 create_profile_tables ();
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
357 /* See comments at top of file and in create_timing_profile_table().
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
358 We ensure enough breathing room for all entries currently on the
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
359 stack. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
360 pregrow_hash_table_if_necessary (big_profile_table,
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
361 EXTRA_BREATHING_ROOM + lisp_eval_depth);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 if (NILP (microsecs))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 msecs = default_profiling_interval;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 CHECK_NATNUM (microsecs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 msecs = XINT (microsecs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 if (msecs <= 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 msecs = 1000;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
373 set_timeout_signal (SIGPROF, sigprof_handler);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
374 {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
375 struct backtrace *bt = backtrace_list;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
376
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
377 /* When we begin profiling, pretend like we just entered all the
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
378 functions currently on the stack. When we stop profiling, do the
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
379 opposite. This ensures consistent values being recorded for both
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
380 function-only and total in such cases. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
381 for (; bt; bt = bt->next)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
382 profile_sow_backtrace (bt);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
383 }
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
384 profiling_active = 1;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
385 profiling_lock = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 foo.it_value.tv_sec = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 foo.it_value.tv_usec = msecs;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 EMACS_NORMALIZE_TIME (foo.it_value);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 foo.it_interval = foo.it_value;
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 458
diff changeset
390 qxe_setitimer (ITIMER_PROF, &foo, 0);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
391 unbind_to (depth);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
395 DEFUN ("stop-profiling", Fstop_profiling, 0, 0, "", /*
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 Stop profiling.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 ())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 /* This function does not GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 struct itimerval foo;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
403 if (!profiling_active)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
404 return Qnil;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
405 in_profiling++;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 foo.it_value.tv_sec = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 foo.it_value.tv_usec = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 foo.it_interval = foo.it_value;
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 458
diff changeset
409 qxe_setitimer (ITIMER_PROF, &foo, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 profiling_active = 0;
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
411 {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
412 struct backtrace *bt = backtrace_list;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
413
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
414 for (; bt; bt = bt->next)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
415 profile_reap_backtrace (bt);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
416 }
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
417 set_timeout_signal (SIGPROF, fatal_error_signal);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
418 in_profiling--;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
422 DEFUN ("clear-profiling-info", Fclear_profiling_info, 0, 0, "", /*
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
423 Clear out the recorded profiling info.
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
424 This clears both the internal timing information and the call counts in
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
425 `call-count-profile-table'.
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
426 */
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
427 ())
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
428 {
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
429 in_profiling++;
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
430 /* This function does not GC */
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
431 if (big_profile_table)
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
432 {
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
433 profiling_lock = 1;
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
434 clrhash (big_profile_table);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
435 profiling_lock = 0;
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
436 }
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
437 if (!NILP (Vtotal_timing_profile_table))
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
438 Fclrhash (Vtotal_timing_profile_table);
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
439 if (!NILP (Vcall_count_profile_table))
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
440 Fclrhash (Vcall_count_profile_table);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
441 if (!NILP (Vgc_usage_profile_table))
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
442 Fclrhash (Vgc_usage_profile_table);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
443 if (!NILP (Vtotal_gc_usage_profile_table))
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
444 Fclrhash (Vtotal_gc_usage_profile_table);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
445 in_profiling--;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
446
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
447 return Qnil;
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
448 }
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
449
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 struct get_profiling_info_closure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 {
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
452 Lisp_Object timing;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 static int
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
456 get_profiling_info_timing_maphash (const void *void_key,
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
457 void *void_val,
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
458 void *void_closure)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 /* This function does not GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 Lisp_Object key;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 struct get_profiling_info_closure *closure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 = (struct get_profiling_info_closure *) void_closure;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 EMACS_INT val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 771
diff changeset
466 key = VOID_TO_LISP (void_key);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 val = (EMACS_INT) void_val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
469 Fputhash (key, make_int (val), closure->timing);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
473 static Lisp_Object
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
474 copy_hash_table_or_blank (Lisp_Object table)
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
475 {
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
476 return !NILP (table) ? Fcopy_hash_table (table) :
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
477 make_lisp_hash_table (100, HASH_TABLE_NON_WEAK,
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
478 HASH_TABLE_EQ);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
479 }
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
480
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 DEFUN ("get-profiling-info", Fget_profiling_info, 0, 0, 0, /*
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
482 Return the currently recorded profiling info.
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
483 The format is a plist of symbols describing type of info recorded and
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
484 an associated type-specific entry. Currently, the following info types
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
485 are recorded
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
486
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
487 `timing'
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
488 A hash table of function descriptions (funcallable objects or strings
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
489 describing internal processing operations -- redisplay, garbage
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
490 collection, etc.), along with associated tick counts (the frequency of
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
491 ticks is controlled by `default-profiling-interval' or the argument to
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
492 `start-profiling').
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
493
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
494 `total-timing'
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
495 A hash table of function descriptions and associated timing count for
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
496 the function and all descendants.
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
497
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
498 `call-count'
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
499 A hash table of function descriptions and associated call counts.
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
500
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
501 `gc-usage'
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
502 A hash table of function descriptions and associated amount of consing.
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
503
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
504 `total-gc-usage'
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
505 A hash table of function descriptions and associated amount of consing
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
506 in the function and all descendants.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 ())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 /* This function does not GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 struct get_profiling_info_closure closure;
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
512 Lisp_Object retv;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
513 int depth = internal_bind_int (&in_profiling, 1 + in_profiling);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
514 const void *overhead;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
516 closure.timing =
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
517 make_lisp_hash_table (100, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL);
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
518
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 if (big_profile_table)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 {
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
521 int count = internal_bind_int ((int *) &profiling_lock, 1);
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
522 maphash (get_profiling_info_timing_maphash, big_profile_table, &closure);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
523
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
524 /* OK, OK ... the total-timing table is not going to have an entry
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
525 for profile overhead, and it looks strange for it to come out 0,
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
526 so make sure it looks reasonable. */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
527 if (!gethash (LISP_TO_VOID (QSprofile_overhead), big_profile_table,
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
528 &overhead))
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
529 overhead = 0;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
530 Fputhash (QSprofile_overhead, make_int ((EMACS_INT) overhead),
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
531 Vtotal_timing_profile_table);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
532
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 613
diff changeset
533 unbind_to (count);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 }
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
535
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
536 retv = nconc2 (list6 (Qtiming, closure.timing, Qtotal_timing,
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
537 copy_hash_table_or_blank (Vtotal_timing_profile_table),
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
538 Qcall_count,
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
539 copy_hash_table_or_blank (Vcall_count_profile_table)),
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
540 list4 (Qgc_usage,
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
541 copy_hash_table_or_blank (Vgc_usage_profile_table),
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
542 Qtotal_gc_usage,
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
543 copy_hash_table_or_blank (Vtotal_gc_usage_profile_table
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
544 )));
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
545 unbind_to (depth);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
546 return retv;
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
547 }
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
548
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
549 static int
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
550 set_profiling_info_timing_maphash (Lisp_Object key,
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
551 Lisp_Object val,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1598
diff changeset
552 void *UNUSED (void_closure))
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
553 {
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
554 /* This function does not GC */
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
555 if (!INTP (val))
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
556 invalid_argument_2
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
557 ("Function timing count is not an integer in given entry",
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
558 key, val);
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
559
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
560 puthash (LISP_TO_VOID (key), (void *) XINT (val), big_profile_table);
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
561
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
562 return 0;
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
563 }
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
564
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
565 DEFUN ("set-profiling-info", Fset_profiling_info, 1, 1, 0, /*
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
566 Set the currently recorded profiling info.
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
567 INFO should be in the same format returned by `get-profiling-info',
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
568 as described there.
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
569 */
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
570 (info))
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
571 {
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
572 int depth;
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
573 /* This function does not GC */
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
574 Fclear_profiling_info ();
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
575
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
576 depth = internal_bind_int (&in_profiling, 1 + in_profiling);
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
577 {
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
578 EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, info)
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
579 {
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
580 if (EQ (key, Qtiming))
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
581 {
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
582 CHECK_HASH_TABLE (value);
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
583 create_timing_profile_table ();
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
584 profiling_lock = 1;
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
585 elisp_maphash_unsafe (set_profiling_info_timing_maphash, value,
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
586 NULL);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
587 profiling_lock = 0;
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
588 }
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
589 else if (EQ (key, Qcall_count))
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
590 Vcall_count_profile_table = Fcopy_hash_table (value);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
591 else if (EQ (key, Qtotal_timing))
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
592 Vtotal_timing_profile_table = Fcopy_hash_table (value);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
593 else if (EQ (key, Qgc_usage))
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
594 Vgc_usage_profile_table = Fcopy_hash_table (value);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
595 else if (EQ (key, Qtotal_gc_usage))
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
596 Vtotal_gc_usage_profile_table = Fcopy_hash_table (value);
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
597 else
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
598 invalid_constant ("Unrecognized profiling-info keyword", key);
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
599 }
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
600 }
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
601
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
602 unbind_to (depth);
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
603 return Qnil;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 static int
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
607 mark_profiling_info_maphash (const void *void_key,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1598
diff changeset
608 void *UNUSED (void_val),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1598
diff changeset
609 void *UNUSED (void_closure))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 {
1598
ac1be85b4a5f [xemacs-hg @ 2003-07-31 13:32:24 by crestani]
crestani
parents: 1346
diff changeset
611 #ifdef USE_KKCC
2645
e6854ec89f8e [xemacs-hg @ 2005-03-10 09:12:36 by crestani]
crestani
parents: 2551
diff changeset
612 kkcc_gc_stack_push_lisp_object (VOID_TO_LISP (void_key), 0, -1);
1598
ac1be85b4a5f [xemacs-hg @ 2003-07-31 13:32:24 by crestani]
crestani
parents: 1346
diff changeset
613 #else /* NOT USE_KKCC */
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
614 mark_object (VOID_TO_LISP (void_key));
1598
ac1be85b4a5f [xemacs-hg @ 2003-07-31 13:32:24 by crestani]
crestani
parents: 1346
diff changeset
615 #endif /* NOT USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 mark_profiling_info (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 /* This function does not GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 if (big_profile_table)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 {
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
625 profiling_lock = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 maphash (mark_profiling_info_maphash, big_profile_table, 0);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
627 profiling_lock = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 DEFUN ("profiling-active-p", Fprofiling_active_p, 0, 0, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 Return non-nil if profiling information is currently being recorded.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 ())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 return profiling_active ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 syms_of_profile (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 DEFSUBR (Fstart_profiling);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 DEFSUBR (Fstop_profiling);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 DEFSUBR (Fget_profiling_info);
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
645 DEFSUBR (Fset_profiling_info);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 DEFSUBR (Fclear_profiling_info);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 DEFSUBR (Fprofiling_active_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 vars_of_profile (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 DEFVAR_INT ("default-profiling-interval", &default_profiling_interval /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 Default CPU time in microseconds between profiling sampling.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655 Used when the argument to `start-profiling' is nil or omitted.
1346
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1315
diff changeset
656 Under Unix, the time in question is CPU time (when the program is executing
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1315
diff changeset
657 or the kernel is executing on behalf of the program) and not real time.
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1315
diff changeset
658 Under MS Windows and Cygwin, the time is real time, but time spent blocking
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1315
diff changeset
659 while waiting for an event is ignored, to get more accurate results.
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1315
diff changeset
660 Note that there is usually a machine-dependent limit on how small this
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1315
diff changeset
661 value can be.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 default_profiling_interval = 1000;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
665 staticpro (&Vcall_count_profile_table);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 Vcall_count_profile_table = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
668 staticpro (&Vgc_usage_profile_table);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
669 Vgc_usage_profile_table = Qnil;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
670
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
671 staticpro (&Vtotal_gc_usage_profile_table);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
672 Vtotal_gc_usage_profile_table = Qnil;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
673
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
674 staticpro (&Vtotal_timing_profile_table);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
675 Vtotal_timing_profile_table = Qnil;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
677 #if 0
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
678 /* #### This is supposed to be for KKCC but KKCC doesn't use this stuff
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
679 currently. */
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
680 dump_add_root_block_ptr (&big_profile_table, &plain_hash_table_description);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
681 #endif /* 0 */
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
682
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
683 profiling_lock = 0;
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
684
2514
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
685 #ifdef DEBUG_XEMACS
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 2645
diff changeset
686 QSin_temp_spot_1 = build_defer_string ("(in temp spot 1)");
2514
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
687 staticpro (&QSin_temp_spot_1);
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
688
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 2645
diff changeset
689 QSin_temp_spot_2 = build_defer_string ("(in temp spot 2)");
2514
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
690 staticpro (&QSin_temp_spot_2);
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
691
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 2645
diff changeset
692 QSin_temp_spot_3 = build_defer_string ("(in temp spot 3)");
2514
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
693 staticpro (&QSin_temp_spot_3);
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
694
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 2645
diff changeset
695 QSin_temp_spot_4 = build_defer_string ("(in temp spot 4)");
2514
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
696 staticpro (&QSin_temp_spot_4);
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
697
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 2645
diff changeset
698 QSin_temp_spot_5 = build_defer_string ("(in temp spot 5)");
2514
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
699 staticpro (&QSin_temp_spot_5);
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
700 #endif /* DEBUG_XEMACS */
b49d38bc659d [xemacs-hg @ 2005-01-26 10:09:19 by ben]
ben
parents: 2421
diff changeset
701
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 2645
diff changeset
702 QSunknown = build_defer_string ("(unknown)");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 staticpro (&QSunknown);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 QSprocessing_events_at_top_level =
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 2645
diff changeset
705 build_defer_string ("(processing events at top level)");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 staticpro (&QSprocessing_events_at_top_level);
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 2645
diff changeset
707 QSprofile_overhead = build_defer_string ("(profile overhead)");
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
708 staticpro (&QSprofile_overhead);
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
709
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
710 DEFSYMBOL (Qtiming);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
711 DEFSYMBOL (Qtotal_timing);
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 853
diff changeset
712 DEFSYMBOL (Qcall_count);
1292
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
713 DEFSYMBOL (Qgc_usage);
f3437b56874d [xemacs-hg @ 2003-02-13 09:57:04 by ben]
ben
parents: 1123
diff changeset
714 DEFSYMBOL (Qtotal_gc_usage);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 }