summaryrefslogtreecommitdiff
path: root/src/profiler.c
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright year to 2018Paul Eggert2018-01-011-1/+1
| | | | Run admin/update-copyright.
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-131-1/+1
| | | | | | | | | | | | | Most of this change is to boilerplate commentary such as license URLs. This change was prompted by ftp://ftp.gnu.org's going-away party, planned for November. Change these FTP URLs to https://ftp.gnu.org instead. Make similar changes for URLs to other organizations moving away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and fsf.org when this works, as this will further help defend against man-in-the-middle attacks (for this part I omitted the MS-DOS and MS-Windows sources and the test tarballs to keep the workload down). HTTPS is not fully working to lists.gnu.org so I left those URLs alone for now.
* Use float instead of Lisp_Object for rehash_sizePaul Eggert2017-02-211-3/+2
| | | | | | | | | | | | | | | | | | * src/alloc.c (purecopy_hash_table): * src/fns.c (maybe_resize_hash_table, Fmake_hash_table): (Fhash_table_rehash_size): * src/lisp.h (struct Lisp_Hash_Table.rehash_size): The rehash_size member of struct Lisp_Hash_Table is now a float, not a Lisp_Object. * src/alloc.c (purecopy_hash_table): Assign members in order. * src/fns.c (make_hash_table): Use EMACS_INT for size and float for rehash_size, instead of Lisp_Object for both. All callers changed. * src/lisp.h (DEFAULT_REHASH_SIZE): Now float, not double, and 1 smaller. * src/print.c (print_object): Simplify by calling Fhash_table_rehash_size and Fhash_table_rehash_threshold. Avoid unnecessary NILP.
* Use ptrdiff_t instead of Lisp_Object for collisionPaul Eggert2017-02-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (purecopy_hash_table): Assign, don’t purecopy. * src/fns.c (set_hash_next_slot, set_hash_index_slot): Hash index arg is now ptrdiff_t index (or -1 if empty), not Lisp_Object integer (or Qnil if empty). All callers changed. (larger_vecalloc): New static function. (larger_vector): Use it. (HASH_NEXT, HASH_INDEX): Move here from lisp.h. Return ptrdiff_t index (or -1) not Lisp_Object integer (or Qnil). All callers changed. * src/fns.c (make_hash_table, maybe_resize_hash_table, hash_lookup) (hash_put, hash_remove_from_table, hash_clear, sweep_weak_table): * src/profiler.c (evict_lower_half, record_backtrace): -1, not nil, is now the convention for end of collision list. * src/fns.c (maybe_resize_hash_table): Avoid double-initialization of the free list. Reallocate H->next last, in case other reallocations exhaust memory. * src/lisp.h (struct Lisp_Hash_Table): ‘next_free’ is now ptrdiff_t, not Lisp_Object. Adjust commentary for ‘next’ and ‘index’, which no longer contain nil. (HASH_NEXT, HASH_INDEX): Move to src/fns.c.
* Change type of `rehash_threshold' and `pure' fields in hash-tablesStefan Monnier2017-02-181-2/+2
| | | | | | | | | | | | * src/lisp.h (struct Lisp_Hash_Table): Change type of `rehash_threshold' and `pure' fields and move them after `count'. * src/fns.c (make_hash_table): Change type of `rehash_threshold' and `pure'. (Fmake_hash_table, Fhash_table_rehash_threshold): * src/category.c (hash_get_category_set): * src/xterm.c (syms_of_xterm): * src/profiler.c (make_log): * src/print.c (print_object): * src/alloc.c (purecopy_hash_table, purecopy): Adjust accordingly.
* Fix hash tables not being purified correctly.Vibhav Pant2017-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (purecopy_hash_table) New function, makes a copy of the given hash table in pure storage. Add new struct `pinned_object' and `pinned_objects' linked list for pinning objects. (Fpurecopy) Allow purifying hash tables (purecopy) Pin hash tables that are either weak or not declared with `:purecopy t`, use purecopy_hash_table otherwise. (marked_pinned_objects) New function, marks all objects in pinned_objects. (garbage_collect_1) Use it. Mark all pinned objects before sweeping. * src/lisp.h Add new field `pure' to struct `Lisp_Hash_Table'. * src/fns.c: Add `purecopy' parameter to hash tables. (Fmake_hash_table): Check for a `:purecopy PURECOPY' argument, pass it to make_hash_table. (make_hash_table): Add `pure' parameter, set h->pure to it. (Fclrhash, Fremhash, Fputhash): Enforce that the table is impure with CHECK_IMPURE. * src/lread.c: (read1) Parse for `purecopy' parameter while reading hash tables. * src/print.c: (print_object) add the `purecopy' parameter while printing hash tables. * src/category.c, src/emacs-module.c, src/image.c, src/profiler.c, src/xterm.c: Use new (make_hash_table).
* Replace QUIT with maybe_quitPaul Eggert2017-01-251-2/+2
| | | | | | | | There’s no longer need to have QUIT stand for a slug of C statements. Use the more-obvious function-call syntax instead. Also, use true and false when setting immediate_quit. These changes should not affect the generated machine code. * src/lisp.h (QUIT): Remove. All uses replaced by maybe_quit.
* Merge from origin/emacs-25Paul Eggert2017-01-011-1/+1
|\ | | | | | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
| * Update copyright year to 2017Paul Eggert2016-12-311-1/+1
| | | | | | | | Run admin/update-copyright.
* | Fix compiler warnings in the MinGW buildEli Zaretskii2016-05-211-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac [mingw32]: Don't add -Wpointer-sign, and add -Wno-pointer-sign, to keep the noise level down. * nt/mingw-cfg.site (gl_cv_warn_c__Wredundant_decls): Disable -Wredundant-decls, as that produces a lot of noise due to redeclaration of time-related functions by gnulib. * nt/runemacs.c (set_user_model_id): Fix argument type of 'SetCurrentProcessExplicitAppUserModelID'. * src/image.c (x_create_bitmap_from_file) [HAVE_NTGUI]: Don't declare 'dpyinfo', as it is unused. (xpm_load): Fix warnings about pointer signedness. * src/w32proc.c (IsValidLocale, init_winsock): Remove redundant prototypes. (sys_spawnve): Avoid warnings about discarding 'const' qualifier. (sys_select): Provide prototype. (g_b_init_compare_string_w): Move declaration to file scope. * src/w32heap.c (dumped_data_commit): Now static. (FREEABLE_P): Avoid warnings about pointer comparison with integer. (mmap_realloc): Cast to 'char *' for arithmetics on void pointers. * src/w32console.c (ctrl_c_handler, sys_tputs, sys_tgetstr) (evalcost, cmputc, cmcheckmagic, cmcostinit, cmgoto, Wcm_clear): Provide prototypes. * src/w32.c (globals_of_w32, conv_sockaddr_to_lisp): Remove redundant prototypes. (w32_get_internal_run_time, map_w32_filename): Provide prototype. (init_environment, sys_ctime): Avoid warnings about discarding 'const' qualifier. Include utimens.h. (sys_ctime, sys_chdir, sys_creat, sys_fopen, sys_mkdir) (sys_open, sys_rename, sys_rmdir, is_slow_fs, term_winsock) (sys_close, sys_dup2, sys_read, sys_write, sys_localtime): Provide prototypes. (sys_rename_replace): Use %d to avoid compiler warnings. (_wsa_errlist): Make the message text 'const char *', to avoid compilation warnings. (dynlib_reset_last_error): Move prototype to file scope. (w32_get_resource): First argument is now 'const char *'. * src/w32uniscribe.c (syms_of_w32uniscribe): Provide prototype. (otf_features): Second argument is no 'const char *'. * src/w32term.c (free_frame_menubar, x_wm_set_size_hint) (x_set_window_size): Remove redundant prototypes. (XChangeGC, XGetGCValues, w32_draw_underwave) (w32_draw_rectangle, w32_shift_glyphs_for_insert, x_mouse_leave) (x_calc_absolute_position, x_destroy_window): Now static. (menubar_selection_callback): Move prototype to file scope. * src/w32font.c (g_b_init_get_glyph_outline_w): Remove redundant declaration. (w32_to_x_charset): Fix warnings about discarding 'const' qualifier. (w32font_full_name): Fix warnings about implicit conversion of 'float' to 'double'. * src/w32reg.c (w32_get_rdb_resource): Fix warnings about discarding 'const' qualifier. * src/w32menu.c (syms_of_w32menu, globals_of_w32menu) (set_frame_menubar): Remove redundant prototypes. (menubar_selection_callback, w32_menu_display_help): Provide prototypes. (simple_dialog_show): Avoid warnings about discarding 'const' qualifier. * src/w32fns.c (syms_of_w32fns, globals_of_w32fns) (free_frame_menubar, w32_strerror, x_set_menu_bar_lines) (x_set_tool_bar_lines, x_set_internal_border_width): Remove redundant prototypes. (current_popup_menu): Remove redundant declaration. (colormap_t): Member 'name' is now 'const char *'. (add_system_logical_colors_to_map): Fix signed/unsigned warnings. (x_decode_color, x_set_border_pixel) (x_clear_under_internal_border, x_set_name, hook_w32_key) (reset_w32_kbdhook_state, deliver_wm_chars, w32_backtrace): Now static. (w32_load_cursor, w32_key_to_modifier, map_keypad_keys) (w32_msg_worker, w32_last_error): Provide prototypes. (funhook, lookup_vk_code): Avoid warnings about missing parentheses. (x_default_font_parameter, Fw32_notification_notify): Avoid warnings about discarding 'const' qualifier. (Fx_create_frame): Avoid warnings about empty body of 'else'. (x_screen_planes): Ifdef away unused function. (Fx_show_tip): Remove unused variables. (Fw32_battery_status): Avoid warnings about implicit promotion from float to double. (Fw32_notification_notify): Initialize 'timeout'. * src/profiler.c (profiler_cpu_running) [HAVE_ITIMERSPEC]: Only define the TIMER_SETTIME_RUNNING value if it will be used. * src/w32notify.c (send_notifications): Ifdef away an empty if clause. Remove unused variable. (watch_end, watch_completion): Provide prototypes. * src/sound.c (sound_warning) [WINDOWSNT]: Don't define: unused. * src/callproc.c (child_setup, getenv_internal_1) [WINDOWSNT]: Fix warning with pointer signedness. * src/gnutls.c (gnutls_x509_crt_get_signature) (gnutls_alert_send_appropriate) [WINDOWSNT]: Don't define, and don't load them from the GnuTLS library, as they are no longer used. * src/process.c (DATAGRAM_CHAN_P) [!DATAGRAM_SOCKETS]: Don't define, as it's unused. * src/unexw32.c (open_input_file, open_output_file) (close_file_data): Remove redundant prototypes. (_start): provide prototype. (mainCRTStartup): Move prototype to file level. (find_section): Use type-cast to shut up compiler warnings. (offset_to_section, relocate_offset): Now static. (find_section): First argument is now a 'const char *'. (offset_to_section): Ifdef away, as it's unused. * src/w32heap.h (find_section): Adjust prototype. * src/dynlib.c (dynlib_reset_last_error): Provide prototype. * src/dired.c (directory_files_internal_w32_unwind): Avoid warnings about missing prototypes. (is_slow_fs) [WINDOWSNT]: Provide prototype at file level. (directory_files_internal) [WINDOWSNT]: Fix warnings about pointer signedness. * src/fileio.c (Ffile_writable_p, Ffile_regular_p) [WINDOWSNT]: Fix warnings about pointer signedness. * src/filelock.c (WTMP_FILE) [WINDOWSNT]: Don't define, it's unused. * src/sysdep.c (_getpid): Remove redundant prototype. (sys_subshell) [DOS_NT]: Don't define 'status', it's unused. [!MSDOS]: Don't define 'st', it's unused. (init_sys_modes) [DOS_NT]: Don't define 'terminal', it's unused. (str_collate) [WINDOWSNT]: Avoid warnings about pointer signedness. * src/keyboard.c (tty_read_avail_input) [WINDOWSNT]: Don't define n_to_read, as it is not used. (MAX_ENCODED_BYTES) [WINDOWSNT]: Don't define, as it's unused. * src/w32font.h (syms_of_w32font): Remove redundant prototype. * src/xfaces.c (x_display_info) [HAVE_NTGUI]: Remove unused macro. * src/term.c (init_tty) [DOS_NT]: Ifdef away variables that are not used by DOS_NT builds, to avoid compiler warnings. * src/menu.c (current_popup_menu) [HAVE_NTGUI]: Remove redundant declaration. * src/dispnew.c (init_display) [WINDOWSNT]: Use type-cast to shut up compiler warnings. * src/w32term.h (x_set_window_size, x_get_focus_frame) (x_make_frame_visible, x_make_frame_invisible, x_iconify_frame) (x_set_frame_alpha, x_activate_menubar, x_bitmap_icon) (x_free_frame_resources, x_real_positions) (display_x_get_resource): Remove redundant prototypes. * lib-src/ntlib.c (sys_ctime, sys_fopen, sys_chdir, mkostemp) (sys_rename, gettimeofday): Provide prototypes. * lib-src/ntlib.h (getuid, geteuid, mkostemp): Remove redundant declarations. * lib-src/emacsclient.c (w32_getenv): Argument is now 'const char *'. (xstrdup, w32_get_resource, w32_window_app, w32_execvp, ttyname) (close_winsock, initialize_sockets, w32_set_user_model_id) (w32_find_emacs_process, w32_give_focus) [WINDOWSNT]: Add prototypes. (w32_get_resource) [WINDOWSNT]: Fix a warning about signedness difference. (w32_set_user_model_id): Update prototype of SetCurrentProcessExplicitAppUserModelID to avoid compiler warnings. (start_daemon_and_retry_set_socket) [WINDOWSNT]: Use type-cast to shut up compiler warnings. * lib-src/etags.c (MAXPATHLEN) [WINDOWSNT]: Remove unused macro.
* | Rename C names to match Lisp symbols betterPaul Eggert2016-03-271-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was inspired by commit e65c3079c65595d95749348366af9811fafff062, which fixed a bug where the C name for a symbol disagreed with the symbol name itself. Fix other instances of disagreements that I found. Although this doesn’t fix a bug, it should make code easier to follow. The remaining disagreements are idiosyncratic: Qminus, Qplus, Qsans__serif, Qbackquote, Qcomma, Qcomma_at, Qcomma_dot. All uses changed. * src/alloc.c (QAutomatic_GC): Rename from Qautomatic_gc. * src/dbusbind.c (QCsystem): Rename from QCdbus_system_bus. (QCsession): Rename from QCdbus_session_bus. (QCtimeout): Rename from QCdbus_timeout. (QCbyte): Rename from QCdbus_type_byte. (QCboolean): Rename from QCdbus_type_boolean. (QCint16): Rename from QCdbus_type_int16. (QCuint16): Rename from QCdbus_type_uint16. (QCint32): Rename from QCdbus_type_int32. (QCuint32): Rename from QCdbus_type_uint32. (QCint64): Rename from QCdbus_type_int64. (QCuint64): Rename from QCdbus_type_uint64. (QCdouble): Rename from QCdbus_type_double. (QCstring): Rename from QCdbus_type_string. (QCobject_path): Rename from QCdbus_type_object_path. (QCsignature): Rename from QCdbus_type_signature. (QCunix_fd): Rename from QCdbus_type_unix_fd. (QCarray): Rename from QCdbus_type_array. (QCvariant): Rename from QCdbus_type_variant. (QCstruct): Rename from QCdbus_type_struct. (QCdict_entry): Rename from QCdbus_type_dict_entry. (QCserial): Rename from QCdbus_registered_serial. (QCmethod): Rename from QCdbus_registered_method. (QCsignal): Rename from QCdbus_registered_signal. * src/emacs-module.c (Qinternal__module_call): Rename from Qinternal_module_call. * src/frame.c (Qwindow__pixel_to_total): Rename from Qwindow_pixel_to_total. * src/gnutls.c (QChostname): Rename from QCgnutls_bootprop_hostname. (QCpriority): Rename from QCgnutls_bootprop_priority. (QCtrustfiles): Rename from QCgnutls_bootprop_trustfiles. (QCkeylist): Rename from QCgnutls_bootprop_keylist. (QCcrlfiles): Rename from QCgnutls_bootprop_crlfiles. (QCmin_prime_bits): Rename from QCgnutls_bootprop_min_prime_bits. (QCloglevel): Rename from QCgnutls_bootprop_loglevel. (QCcomplete_negotiation): Rename from QCgnutls_complete_negotiation. (QCverify_flags): Rename from QCgnutls_bootprop_verify_flags. (QCverify_error): Rename from QCgnutls_bootprop_verify_error. * src/w32fns.c (Qfont_parameter): Rename from Qfont_param. (Qgnutls): Rename from Qgnutls_dll. (Qlibxml2): Rename from Qlibxml2_dll. (Qzlib): Rename from Qzlib_dll. * src/w32select.c (Qutf_16le_dos): Rename from QUNICODE. * src/window.c (Qwindow__resize_root_window): Rename from Qwindow_resize_root_window. (Qwindow__resize_root_window_vertically): Rename from Qwindow_resize_root_window_vertically. (Qwindow__sanitize_window_sizes): Rename from Qwindow_sanitize_window_sizes. (Qwindow__pixel_to_total): Rename from Qwindow_pixel_to_total. * src/xdisp.c (Qredisplay_internal_xC_functionx): Rename from Qredisplay_internal. * src/xfns.c (Qfont_parameter): Rename from Qfont_param. * src/xselect.c (Q_EMACS_TMP_): Rename from QEMACS_TMP.
* Rework C source files to avoid ^(Paul Eggert2016-03-101-2/+2
| | | | | | | | Work around Bug#22884 by rewording comments and strings to avoid ‘(’ at the start of a line unless it starts a function. This change is a short-term hack; in the longer run we plan to fix cc-mode’s performance for C files that have ‘(’ at the start of a line in a comment or string.
* Update copyright year to 2016Paul Eggert2016-01-011-1/+1
| | | | Run admin/update-copyright.
* Fix some int overflows in profiler.cPaul Eggert2015-07-311-10/+8
| | | | | | | * src/profiler.c (make_log): Make args EMACS_INT, not int, to avoid unwanted behavior on 'int' overflow. (make_log, evict_lower_half, record_backtrace): Use ptrdiff_t, not int, for object indexes.
* Enable CPU profiling on CygwinKen Brown2015-06-221-0/+6
| | | | | | | | * src/syssignal.h [CYGWIN] (PROFILER_CPU_SUPPORT): Revert previous change that undefined this. (SIGEV_SIGNAL): Ensure that this is defined as a macro. * src/profiler.c [CYGWIN] (timer_getoverrun): Define as a macro on Cygwin.
* Improve diagnostics of profiler-cpu-startKen Brown2015-06-221-5/+14
| | | | | | | * src/profiler.c (setup_cpu_timer): Change return type to 'int'; return -1 if the sampling interval is invalid. (Fprofiler_cpu_start): Improve error message if 'setup_cpu_timer' fails. (Bug#20843)
* Compute C decls for DEFSYMs automaticallyPaul Eggert2015-01-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes Bug#15880. This patch also makes Q constants (e.g., Qnil) constant addresses from the C point of view. * make-docfile.c: Revamp to generate table of symbols, too. Include <stdbool.h>. (xstrdup): New function. (main): Don't process the same file twice. (SYMBOL): New constant in enum global_type. (struct symbol): Turn 'value' member into a union, either v.value for int or v.svalue for string. All uses changed. (add_global): New arg svalue, which overrides value, so that globals can have a string value. (close_emacs_global): New arg num_symbols; all uses changed. Output lispsym decl. (write_globals): Output symbol globals too. Output more ATTRIBUTE_CONST, now that Qnil etc. are C constants. Output defsym_name table. (scan_c_file): Move most of guts into ... (scan_c_stream): ... new function. Scan for DEFSYMs and record symbols found. Don't read past EOF if file doesn't end in newline. * alloc.c, bidi.c, buffer.c, bytecode.c, callint.c, casefiddle: * casetab.c, category.c, ccl.c, charset.c, chartab.c, cmds.c, coding.c: * composite.c, data.c, dbusbind.c, decompress.c, dired.c, dispnew.c: * doc.c, editfns.c, emacs.c, eval.c, fileio.c, fns.c, font.c, fontset.c: * frame.c, fringe.c, ftfont.c, ftxfont.c, gfilenotify.c, gnutls.c: * image.c, inotify.c, insdel.c, keyboard.c, keymap.c, lread.c: * macfont.m, macros.c, minibuf.c, nsfns.m, nsfont.m, nsimage.m: * nsmenu.m, nsselect.m, nsterm.m, print.c, process.c, profiler.c: * search.c, sound.c, syntax.c, term.c, terminal.c, textprop.c, undo.c: * window.c, xdisp.c, xfaces.c, xfns.c, xftfont.c, xmenu.c, xml.c: * xselect.c, xsettings.c, xterm.c: Remove Q vars that represent symbols (e.g., Qnil, Qt, Qemacs). These names are now defined automatically by make-docfile. * alloc.c (init_symbol): New function. (Fmake_symbol): Use it. (c_symbol_p): New function. (valid_lisp_object_p, purecopy): Use it. * alloc.c (marked_pinned_symbols): Use make_lisp_symbol instead of make_lisp_ptr. (garbage_collect_1): Mark lispsym symbols. (CHECK_ALLOCATED_AND_LIVE_SYMBOL): New macro. (mark_object): Use it. (sweep_symbols): Sweep lispsym symbols. (symbol_uses_obj): New function. (which_symbols): Use it. Work for lispsym symbols, too. (init_alloc_once): Initialize Vpurify_flag here; no need to wait, since Qt's address is already known now. (syms_of_alloc): Add lispsym count to symbols_consed. * buffer.c (init_buffer_once): Compare to Qnil, not to make_number (0), when testing whether storage is all bits zero. * dispextern (struct image_type): * font.c (font_property_table): * frame.c (struct frame_parm_table, frame_parms): * keyboard.c (scroll_bar_parts, struct event_head): * xdisp.c (struct props): Use XSYMBOL_INIT (Qfoo) and struct Lisp_Symbol * rather than &Qfoo and Lisp_Object *, since Qfoo is no longer an object whose address can be taken. All uses changed. * eval.c (run_hook): New function. Most uses of Frun_hooks changed to use it, so that they no longer need to take the address of a Lisp sym. (syms_of_eval): Don't use DEFSYM on Vrun_hooks, as it's a variable. * frame.c (syms_of_frame): Add defsyms for the frame_parms table. * keyboard.c (syms_of_keyboard): Don't DEFSYM Qmenu_bar here. DEFSYM Qdeactivate_mark before the corresponding var. * keymap.c (syms_of_keymap): Use DEFSYM for Qmenu_bar and Qmode_line instead of interning their symbols; this avoids duplicates. (LISP_INITIALLY, TAG_PTR) (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END, XSYMBOL_INIT): New macros. (LISP_INITIALLY_ZERO): Use it. (enum symbol_interned, enum symbol_redirect, struct Lisp_Symbol) (EXFUN, DEFUN_ARGS_MANY, DEFUN_ARGS_UNEVALLED, DEFUN_ARGS_*): Move decls up, to avoid forward uses. Include globals.h earlier, too. (make_lisp_symbol): New function. (XSETSYMBOL): Use it. (DEFSYM): Now just a placeholder for make-docfile. * lread.c (DEFINE_SYMBOLS): Define, for globals.h. (intern_sym): New function, with body taken from old intern_driver. (intern_driver): Use it. Last arg is now Lisp integer, not ptrdiff_t. All uses changed. (define_symbol): New function. (init_obarray): Define the C symbols taken from lispsym. Use plain DEFSYM for Qt and Qnil. * syntax.c (init_syntax_once): No need to worry about Qchar_table_extra_slots.
* Update copyright year to 2015Paul Eggert2015-01-011-1/+1
| | | | Run admin/update-copyright.
* Merge from emacs-24; up to 2014-05-04T21:18:30Z!eggert@cs.ucla.eduPaul Eggert2014-05-041-1/+1
|\
| * Doc fixesGlenn Morris2014-05-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/misc/autotype.texi (Skeleton Language): * doc/misc/message.texi (Header Commands): * lisp/allout-widgets.el (allout-widgets-tally) (allout-decorate-item-guides): * lisp/menu-bar.el (menu-bar-positive-p): * lisp/minibuffer.el (completion-pcm-complete-word-inserts-delimiters): * lisp/cedet/ede.el (ede-project-directories, ede-check-project-directory): * lisp/cedet/semantic/ia-sb.el (semantic-ia-sb-show-doc): * lisp/cedet/semantic/tag.el (semantic-tag-in-buffer-p): * lisp/cedet/semantic/bovine/c.el (semantic-tag-abstract-p): * lisp/gnus/gnus-registry.el (gnus-registry-install-p): Doc fix. * lisp/progmodes/gdb-mi.el (gdbmi-same-start, gdbmi-is-number): * lisp/progmodes/js.el (js--inside-param-list-p) (js--inside-dojo-class-list-p, js--forward-destructuring-spec): * lisp/progmodes/prolog.el (region-exists-p): * lisp/progmodes/verilog-mode.el (verilog-scan-cache-ok-p): * lisp/textmodes/reftex-parse.el (reftex-using-biblatex-p): * lisp/url/url-parse.el (url-generic-parse-url): * src/floatfns.c (Fisnan): * src/profiler.c (Fprofiler_cpu_running_p): Doc fixes (replace `iff'). Fixes: debbugs:17309
* | Prefer 'ARRAYELTS (x)' to 'sizeof x / sizeof *x'.Paul Eggert2014-04-051-1/+1
|/ | | | | | | | | | | | | | | | * alloc.c (memory_full): * charset.c (syms_of_charset): * doc.c (Fsnarf_documentation): * emacs.c (main): * font.c (BUILD_STYLE_TABLE): * keyboard.c (make_lispy_event): * profiler.c (setup_cpu_timer): * xgselect.c (xg_select): * xterm.c (record_event, STORE_KEYSYM_FOR_DEBUG): Use ARRAYELTS. * font.c (FONT_PROPERTY_TABLE_SIZE): Remove. Replace the only use with ARRAYELTS (font_property_table). * xfaces.c (DIM): Remove. All uses replaced by ARRAYELTS.
* Update copyright year to 2014 by running admin/update-copyright.Paul Eggert2014-01-011-1/+1
|
* Simplify EMACS_TIME-related code.Paul Eggert2013-08-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This portability layer is no longer needed, since Emacs has been using struct timespec as a portability layer for some time. Merge from gnulib, incorporating: 2013-08-27 timespec: new convenience constants and function * src/atimer.h, src/buffer.h, src/dispextern.h, src/xgselect.h: Include <time.h> rather than "systime.h"; that's all that's needed now. * src/dispnew.c: Include <timespec.h> rather than "systime.h"; that's all that's needed now. * src/systime.h (EMACS_TIME): Remove. All uses changed to struct timespec. (EMACS_TIME_RESOLUTION): Remove. All uses changed to TIMESPEC_RESOLUTION. (LOG10_EMACS_TIME_RESOLUTION): Remove. All uses changed to LOG10_TIMESPEC_RESOLUTION. (EMACS_SECS, emacs_secs_addr): Remove. All uses changed to tv_sec. (EMACS_NSECS): Remove. All uses changed to tv_nsec. (make_emacs_time): Remove. All used changed to make_timespec. (invalid_timespec): Rename from invalid_emacs_time. All uses changed. (current_timespec): Rename from current_emacs_time. All uses changed. (add_emacs_time): Remove. All uses changed to timespec_add. (sub_emacs_time): Remove. All uses change dot timespec_sub. (EMACS_TIME_SIGN): Remove. All uses changed to timespec_sign. (timespec_valid_p): Rename from EMACS_TIME_VALID_P. All uses changed. (EMACS_TIME_FROM_DOUBLE): Remove. All uses changed to dtotimespec. (EMACS_TIME_TO_DOUBLE): Remove. All uses changed to timespectod. (current_timespec): Rename from current_emacs_time. All uses changed. (EMACS_TIME_EQ, EMACS_TIME_LT, EMACS_TIME_LE): Remove. All uses changed to timespec_cmp. * src/xgselect.c: Include <timespec.h>, since our .h files don't.
* Port to C89.Paul Eggert2013-07-101-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib-src/ebrowse.c (USAGE): Remove macro with too-long string literal ... (usage_message): ... and replace it with this new static constant containing multiple literals. All uses changed. * lib-src/emacsclient.c (print_help_and_exit): Rewrite to avoid string literals longer than the C89 limits. (start_daemon_and_retry_set_socket): Rewrite to avoid non-constant array initializer. * lib-src/make-docfile.c (enum global_type): Omit trailing comma. * src/bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__. (B__dummy__): New dummy symbol, to pacify C89. * src/dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since they can't grok varargs macros. * src/dispnew.c (add_window_display_history) (add_frame_display_history): * src/print.c (print_object): * src/xdisp.c (debug_method_add): Use %p printf format only for void pointers. * src/emacs.c (usage_message): New constant, replacing ... (USAGE1, USAGE2, USAGE3): Remove; they were too long for C89. (main): Adjust to usage reorg. * src/fns.c (syms_of_fns): * src/profiler.c (syms_of_profiler): Don't use non-constant struct initializers. * src/gnutls.h (gnutls_initstage_t): * src/lisp.h (enum Lisp_Fwd_Type): * src/lread.c (lisp_file_lexically_bound_p): * src/xsettings.c (anonymous enum): Remove trailing comma. * src/xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism. * src/lisp.h (ENUM_BF): Use unsigned if pedantic. (DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99. (DEFUN): Use it. * src/regex.c (const_re_char): New type, to pacify strict C89. All uses of 'const re_char' replaced to use it. * src/regex.h (_Restrict_): Rename from __restrict, to avoid clash with glibc when strict C89. This change is imported from gnulib. All uses changed. (_Restrict_arr_): Rename from __restrict_arr, similarly. * src/sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]: Omit GNU_LINUX implementation, since it requires long long. * src/xterm.c (x_draw_underwave): Do not assume the traditional order of struct's members. (x_term_init): Rewrite to avoid the need for non-constant structure initializers.
* Merge the specpdl and backtrace stacks. Make the structure of theStefan Monnier2013-06-031-14/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | specpdl entries more obvious via a tagged union of structs. * src/lisp.h (BITS_PER_PTRDIFF_T): New constant. (enum specbind_tag): New enum. (struct specbinding): Make it a tagged union of structs. Add a case for backtrace records. (specpdl_symbol, specpdl_old_value, specpdl_where, specpdl_arg) (specpdl_func, backtrace_function, backtrace_nargs, backtrace_args) (backtrace_debug_on_exit): New accessors. (struct backtrace): Remove. (struct catchtag): Remove backlist field. * src/data.c (let_shadows_buffer_binding_p, let_shadows_global_binding_p): Move to eval.c. (Flocal_variable_p): Speed up the common case where the binding is already loaded. * src/eval.c (backtrace_list): Remove. (set_specpdl_symbol, set_specpdl_old_value): Remove. (set_backtrace_args, set_backtrace_nargs) (set_backtrace_debug_on_exit, backtrace_p, backtrace_top) (backtrace_next): New functions. (Fdefvaralias, Fdefvar): Adjust to new specpdl format. (unwind_to_catch, internal_lisp_condition_case) (internal_condition_case, internal_condition_case_1) (internal_condition_case_2, internal_condition_case_n): Don't bother with backtrace_list any more. (Fsignal): Adjust to new backtrace format. (grow_specpdl): Move up. (record_in_backtrace): New function. (eval_sub, Ffuncall): Use it. (apply_lambda): Adjust to new backtrace format. (let_shadows_buffer_binding_p, let_shadows_global_binding_p): Move from data.c. (specbind): Adjust to new specpdl format. Simplify. (record_unwind_protect, unbind_to): Adjust to new specpdl format. (Fbacktrace_debug, Fbacktrace, Fbacktrace_frame): Adjust to new backtrace format. (mark_backtrace): Remove. (mark_specpdl, get_backtrace, backtrace_top_function): New functions. * src/xdisp.c (redisplay_internal): Use record_in_backtrace. * src/alloc.c (Fgarbage_collect): Use record_in_backtrace. Use mark_specpdl. * src/profiler.c (record_backtrace): Use get_backtrace. (handle_profiler_signal): Use backtrace_top_function. * src/.gdbinit (xbacktrace, hookpost-backtrace): Use new backtrace accessor functions.
* Reorder conditions that are written backwardsAndreas Schwab2013-03-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * alloc.c (xpalloc, Fgarbage_collect): Reorder conditions that are written backwards. * blockinput.h (input_blocked_p): Likewise. * bytecode.c (exec_byte_code): Likewise. * callproc.c (call_process_kill, call_process_cleanup) (Fcall_process): Likewise. * ccl.c (ccl_driver, resolve_symbol_ccl_program) (Fccl_execute_on_string): Likewise. * character.c (string_escape_byte8): Likewise. * charset.c (read_hex): Likewise. * cm.c (calccost): Likewise. * data.c (cons_to_unsigned): Likewise. * dired.c (directory_files_internal, file_name_completion): Likewise. * dispnew.c (scrolling_window, update_frame_1, Fsleep_for) (sit_for): Likewise. * doc.c (Fsubstitute_command_keys): Likewise. * doprnt.c (doprnt): Likewise. * editfns.c (hi_time, decode_time_components, Fformat): Likewise. * emacsgtkfixed.c: Likewise. * fileio.c (file_offset, Fwrite_region): Likewise. * floatfns.c (Fexpt, fmod_float): Likewise. * fns.c (larger_vector, make_hash_table, Fmake_hash_table): Likewise. * font.c (font_intern_prop): Likewise. * frame.c (x_set_alpha): Likewise. * gtkutil.c (get_utf8_string): Likewise. * indent.c (check_display_width): Likewise. * intervals.c (create_root_interval, rotate_right, rotate_left) (split_interval_right, split_interval_left) (adjust_intervals_for_insertion, delete_node) (interval_deletion_adjustment, adjust_intervals_for_deletion) (merge_interval_right, merge_interval_left, copy_intervals) (set_intervals_multibyte_1): Likewise. * keyboard.c (gobble_input, append_tool_bar_item): Likewise. * keymap.c (Fkey_description): Likewise. * lisp.h (FIXNUM_OVERFLOW_P, vcopy): Likewise. * lread.c (openp, read_integer, read1, string_to_number): Likewise. * menu.c (ensure_menu_items): Likewise. * minibuf.c (read_minibuf_noninteractive): Likewise. * print.c (printchar, strout): Likewise. * process.c (create_process, Faccept_process_output) (wait_reading_process_output, read_process_output, send_process) (wait_reading_process_output): Likewise. * profiler.c (make_log, handle_profiler_signal): Likewise. * regex.c (re_exec): Likewise. * regex.h: Likewise. * search.c (looking_at_1, Freplace_match): Likewise. * sysdep.c (get_child_status, procfs_ttyname) (procfs_get_total_memory): Likewise. * systime.h (EMACS_TIME_VALID_P): Likewise. * term.c (dissociate_if_controlling_tty): Likewise. * window.c (get_phys_cursor_glyph): Likewise. * xdisp.c (init_iterator, redisplay_internal, redisplay_window) (try_window_reusing_current_matrix, try_window_id, pint2hrstr): Likewise. * xfns.c (Fx_window_property): Likewise. * xmenu.c (set_frame_menubar): Likewise. * xselect.c (x_get_window_property, x_handle_dnd_message): Likewise. * xsmfns.c (smc_save_yourself_CB): Likewise. * xterm.c (x_scroll_bar_set_handle): Likewise.
* Minor hashing refactoring.Paul Eggert2013-02-091-1/+1
| | | | | | | | | | | * fns.c (SXHASH_REDUCE): Move to lisp.h. (sxhash_float): Return EMACS_UINT, for consistency with the other hash functions. * lisp.h (INTMASK): Now a macro, since SXHASH_REDUCE is now a non-static inline function and therefore can't use static vars. (SXHASH_REDUCE): Move here from fns.c, and make it inline. * profiler.c (hashfn_profiler): Use SXHASH_REDUCE, to be consistent with the other hash functions.
* Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.caPaul Eggert2013-01-021-1/+1
|\
| * Update copyright notices for 2013.Paul Eggert2013-01-011-1/+1
| |
* | * src/lisp.h (XHASH): Redefine to be imperfect and fit in a Lisp int.Stefan Monnier2012-11-081-3/+3
| | | | | | | | | | | | * src/fns.c (hashfn_eq, hashfn_eql, sxhash): * src/profiler.c (hashfn_profiler): Don't use XUINT on non-integers. * src/buffer.c (compare_overlays): Use XLI rather than XHASH.
* | Use same hash function for hashfn_profiler as for hash_string etc.Paul Eggert2012-11-081-1/+1
| | | | | | | | | | | | | | | | * fns.c (SXHASH_COMBINE): Remove. All uses replaced by sxhash_combine. * lisp.h (sxhash_combine): New inline function, with the contents of the old SXHASH_COMBINE. * profiler.c (hashfn_profiler): Use it, instead of having a special hash function containing a comparison that always yields 1.
* | Use ad-hoc comparison function for the profiler's hash-tables.Stefan Monnier2012-11-081-15/+76
|/ | | | | | | | | | | | | | | | | | | | | | | | | | * src/profiler.c (Qprofiler_backtrace_equal, hashtest_profiler): New vars. (make_log): Use them. (handle_profiler_signal): Don't inhibit quit any longer since we don't call Fequal any more. (Ffunction_equal): New function. (cmpfn_profiler, hashfn_profiler): New functions. (syms_of_profiler): Initialize them. * src/lisp.h (struct hash_table_test): New struct. (struct Lisp_Hash_Table): Use it. * src/alloc.c (mark_object): Mark hash_table_test fields of hash tables. * src/fns.c (make_hash_table): Take a struct to describe the test. (cmpfn_eql, cmpfn_equal, cmpfn_user_defined, hashfn_eq, hashfn_eql) (hashfn_equal, hashfn_user_defined): Adjust to new calling convention. (hash_lookup, hash_remove_from_table): Move assertion checking of hashfn result here. Check hash-equality before calling cmpfn. (Fmake_hash_table): Adjust call to make_hash_table. (hashtest_eq, hashtest_eql, hashtest_equal): New structs. (syms_of_fns): Initialize them. * src/emacs.c (main): Move syms_of_fns earlier. * src/xterm.c (syms_of_xterm): * src/category.c (hash_get_category_set): Adjust call to make_hash_table. * src/print.c (print_object): Adjust to new hash-table struct. * src/composite.c (composition_gstring_put_cache): Adjust to new hashfn.
* * profiler.c (handle_profiler_signal): Inhibit pending signals too,Paul Eggert2012-10-031-0/+4
| | | | | to avoid similar races. * keyboard.c (pending_signals): Now bool, not int.
* Port timers to OpenBSD, plus check for timer failures.Paul Eggert2012-10-031-8/+14
| | | | | | | | | | | | OpenBSD problem reported by Han Boetes. * profiler.c (setup_cpu_timer): Check for failure of timer_settime and/or setitimer. (Fprofiler_cpu_stop): Don't assume HAVE_SETITIMER. * syssignal.h (HAVE_ITIMERSPEC): New macro. This is for platforms like OpenBSD, which has timer_settime but does not declare it. OpenBSD does not define SIGEV_SIGNAL, so use that when deciding whether to use itimerspec-related primitives. All uses of HAVE_TIMER_SETTIME replaced with HAVE_ITIMERSPEC.
* * profiler.c (handle_profiler_signal): Fix a malloc racePaul Eggert2012-10-021-0/+9
| | | | that caused Emacs to hang on Fedora 17 when profiling Lisp.
* Count overruns when profiling; change units to ns.Paul Eggert2012-10-011-10/+21
| | | | | | | | | | | | | | | | | | * lisp/profiler.el (profiler-sampling-interval): Change units from ms to ns, multiplying the default by 1000000 so that it remains 1 ms. (profiler-report-cpu-line-format): Give enough room for the maximum counters on 64-bit hosts. (profiler-report-render-calltree-1): Call them "CPU samples", not "Time (ms)", since they are not milliseconds now (and never really were). * src/profiler.c (handle_profiler_signal): Count sampling intervals, not ms. Give extra weight to samples after overruns, to attempt to count the time more accurately. (setup_cpu_timer): Change sampling interval units from ms to ns, since the underlying primitives nominally do ns. (Fprofiler_cpu_start): Document the change. Mention that the sampling intervals are only approximate.
* * profiler.el (profiler-sampling-interval): Rename fromTomohiro Matsuyama2012-10-011-16/+16
| | | | | | | | | profiler-sample-interval. (profiler-sampling-interval): Default to 10. (profiler-find-profile): New command (was profiler-find-log). (profiler-find-profile-other-window): New command. (profiler-find-profile-other-frame): New command. (profiler-profile): Introduce API-level data structure.
* Support atimers and CPU profiler via profile.c on MS-Windows.Eli Zaretskii2012-09-301-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/w32proc.c (sig_mask, crit_sig): New static variables. (sys_signal): Support SIGALRM and SIGPROF. (sigemptyset, sigaddset, sigfillset, sigprocmask) (pthread_sigmask, setpgrp): Moved here from w32.c. sigaddset, sigfillset, and sigprocmask are no longer no-ops. (sigismember): New function. (struct itimer_data): New definition. (ticks_now, real_itimer, prof_itimer, clocks_min, crit_real) (crit_prof): New static variables. (MAX_SINGLE_SLEEP): New definition. (timer_loop, stop_timer_thread, term_timers, init_timers) (start_timer_thread, getitimer, setitimer): New functions. (alarm): No longer a no-op, calls setitimer. src/w32.c (term_ntproc): Call term_timers. (init_ntproc): Make sure all signals are unblocked at startup, to erase any traces of dumping. Call init_timers. src/w32fns.c (hourglass_timer, HOURGLASS_ID): Remove. Windows-specific code to display the hourglass mouse pointer is no longer used. (w32_wnd_proc): Remove code that handled the WM_TIMER message due to hourglass timer expiration. (start_hourglass, cancel_hourglass, DEFAULT_HOURGLASS_DELAY): Remove, no longer used. (w32_note_current_window, show_hourglass, hide_hourglass): New functions, in support of hourglass cursor display similar to other window systems. (syms_of_w32fns): Don't initialize hourglass_timer. src/xdisp.c (start_hourglass, cancel_hourglass): Now used on WINDOWSNT as well. (start_hourglass) [WINDOWSNT]: Call w32_note_current_window. src/w32.h (init_timers, term_timers): Add prototypes. nt/inc/sys/time.h (ITIMER_REAL, ITIMER_PROF): Define. (struct itimerval): Define. (getitimer, setitimer): Add prototypes. nt/inc/ms-w32.h <sigset_t> [_MSVC_VER]: Make the typedef consistent with MinGW. (SA_RESTART, SIGPROF): Define. nt/config.nt (HAVE_SETITIMER): Define to 1.
* Fix compilation failure introduced in 2012-09-30T06:19:33Z!eggert@cs.ucla.edu.Eli Zaretskii2012-09-301-0/+2
| | | | | src/profiler.c (Fprofiler_cpu_stop): Use timer_settime only if HAVE_TIMER_SETTIME is defined.
* Profiler improvements: more-accurate timers, overflow checks.Paul Eggert2012-09-291-53/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * profiler.c: Don't include stdio.h, limits.h, sys/time.h, signal.h, setjmp.h. Include systime.h instead. (saturated_add): New function. (record_backtrace, current_sample_interval): Use EMACS_INT, not size_t. (record_backtrace, handle_profiler_signal): Saturate on fixnum overflow. (profiler_timer, profiler_timer_ok) [HAVE_TIMER_SETTIME]: New static vars. (enum profiler_cpu_running): New enumn. (profiler_cpu_running): Now of that enum type, not bool. All uses changed to store the new value. (handle_profiler_signal): Rename from sigprof_handler_1, for consistency with other handlers. Do not check whether cpu_log is a hash-table if garbage collecting, since it doesn't matter in that case. (deliver_profiler_signal): Rename from sigprof_handler, for consistency with other handlers. (setup_cpu_timer): New function, with much of what used to be in Fprofiler_cpu_start. Check for out-of-range argument. Prefer timer_settime if available, and prefer thread cputime clocks, then process cputime clocks, then monotonic clocks, to the old realtime clock. Use make_timeval to round more-correctly when falling back to setitimer. (Fprofiler_cpu_start): Use it. (Fprofiler_cpu_stop): Prefer timer_settime if available. Don't assume that passing NULL as the 2nd argument of setitimer is the same as passing a pointer to all-zero storage. Ignore SIGPROF afterwards. (malloc_probe): Saturate at MOST_POSITIVE_FIXNUM. * sysdep.c (emacs_sigaction_init): Also mask out SIGPROF in non-fatal signal handlers. Ignore SIGPROF on startup. * syssignal.h (PROFILER_CPU_SUPPORT): Define this macro here, not in profiler.c, since sysdep.c now uses it.
* * src/lisp.h (struct backtrace): Remove indirection for `function' field.Stefan Monnier2012-09-281-2/+2
| | | | | | | | * src/xdisp.c (redisplay_internal): * src/profiler.c (record_backtrace, sigprof_handler_1): * src/alloc.c (Fgarbage_collect): * src/eval.c (interactive_p, Fsignal, eval_sub, Ffuncall, Fbacktrace) (Fbacktrace_frame): Adjust accordingly.
* * profiler.c (sigprof_handler): Fix race condition.Tomohiro Matsuyama2012-09-281-1/+8
|
* * profiler.c (Fprofiler_cpu_start): Remove unnecessary flag SA_SIGINFO.Tomohiro Matsuyama2012-09-271-3/+3
|
* Merge profiler branchStefan Monnier2012-09-261-0/+4
|
* * lisp/profiler.el (profiler-start): Don't prompt for choice when thereold-branches/profilerStefan Monnier2012-09-261-9/+12
| | | | | | | | | | isn't any. (profiler-stop): Use new semantics of profiler-*-stop. (profiler-reset, profiler--report-cpu): Don't signal an error if the cpu profiler is not available. * src/profiler.c (Fprofiler_cpu_stop, Fprofiler_memory_stop): Return whether the profiler was running, instead of signaling an error if it wasn't.
* * src/makefile.w32-in (OBJ2, GLOBAL_SOURCES): Add profiler.c.Juanma Barranquero2012-09-251-1/+15
| | | | ($(BLD)/profiler.$(O)): New target.
* * src/profiler.c: Rename sample_profiler_* to profiler_cpu_* andStefan Monnier2012-09-241-88/+89
| | | | | memory_profiler_* to profiler_memory_*. Move sigprof_handler before its first use, inside the PROFILER_CPU_SUPPORT conditional.
* Try to let it compile on other platformsStefan Monnier2012-09-241-10/+13
| | | | | | | | | * src/profiler.c (evict_lower_half): Fix typo. (PROFILER_CPU_SUPPORT): Check and define if cpu-profiler is supported. Don't compile the cpu-profiler code, if not supported. (malloc_probe): Presume memory_log is non-nil. (syms_of_profiler): Don't defsubr functions when they aren't defined. * src/lisp.h (sample_profiler_running, gc_probe): Don't declare.
* Rewrite sampler to use Elisp hash-tables.Stefan Monnier2012-09-241-866/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/profiler.c: Remove filtering functionality. (is_in_trace, Qgc): Remove vars. (make_log, record_backtrace, Fsample_profiler_log): Rewrite, using Elisp hash-tables. (approximate_median, evict_lower_half): New functions. (cpu_log): Rename from sample_log. (cpu_gc_count): New var. (Fsample_profiler_reset, Fmemory_profiler_reset): Remove. (sigprof_handler): Add count to cpu_gc_count during GC, detected via backtrace_list. (block_sigprof, unblock_sigprof): Remove. (gc_probe, mark_profiler): Remove functions. (syms_of_profiler): Staticpro cpu_log and memory_log. * lisp/profiler.el (profiler-sample-interval): Move before first use. Change default to 1ms. (profiler-entry=, profiler-backtrace-reverse, profiler-log-fixup-slot) (profiler-calltree-elapsed<, profiler-calltree-elapsed>): Remove functions. (profiler-entry-format): Don't use type-of. (profiler-slot, profiler-log): Remove structs. (profiler-log-timestamp, profiler-log-type, profiler-log-diff-p): Redefine for new log representation. (profiler-log-diff, profiler-log-fixup, profiler-calltree-build-1): Rewrite for new log representation. (profiler-calltree): Remove `elapsed' fields. (profiler-calltree-count<, profiler-report-make-entry-part): Remove gc special case. (profiler-calltree-find): Use equal. (profiler-calltree-walk): Remove `args'; rely on closures instead. (profiler-calltree-compute-percentages-1): Remove; inlined. (profiler-calltree-compute-percentages): Simplify. (profiler-report-log, profiler-report-reversed) (profiler-report-order): Use defvar-local. (profiler-report-line-format): Remove `elapsed', do a bit of CSE. (profiler-report-mode-map): Remove up/down bindings. (profiler-report-make-buffer-name): Simplify by CSE. (profiler-report-mode): Remove redundant code. (profiler-report-expand-entry, profiler-report-collapse-entry): Use inhibit-read-only. (profiler-report-render-calltree-1): Simplify by CSE. (profiler-reset): Rewrite for new subroutines. (profiler--report-cpu): Rename from sample-profiler-report. (profiler--report-memory): Rename from memory-profiler-report. * src/alloc.c (Fgarbage_collect): Record itself in backtrace_list. Don't set is_in_trace any more. Don't call mark_profiler. Only call gc_probe for the memory profiler. (syms_of_alloc): Define Qautomatic_gc. * src/lisp.h (SXHASH_COMBINE): Move back to... * src/fns.c (SXHASH_COMBINE): ...here. * src/xdisp.c (Qautomatic_redisplay): New constant. (redisplay_internal): Record itself in backtrace_list. (syms_of_xdisp): Define Qautomatic_redisplay. * .dir-locals.el (indent-tabs-mode): Remove personal preference.
* profiler: Refactoring and documentation.Tomohiro Matsuyama2012-08-231-38/+153
|