comparison src/lisp.h @ 5160:ab9ee10a53e4

fix various problems with allocation statistics, track overhead properly -------------------- ChangeLog entries follow: -------------------- lisp/ChangeLog addition: 2010-03-20 Ben Wing <ben@xemacs.org> * diagnose.el (show-memory-usage): * diagnose.el (show-object-memory-usage-stats): Further changes to correspond with changes in the C code; add an additional column showing the overhead used with each type, and add it into the grand total memory usage. src/ChangeLog addition: 2010-03-20 Ben Wing <ben@xemacs.org> * alloc.c: * alloc.c (init_lrecord_stats): * alloc.c (free_normal_lisp_object): * alloc.c (struct): * alloc.c (clear_lrecord_stats): * alloc.c (tick_lrecord_stats): * alloc.c (COUNT_FROB_BLOCK_USAGE): * alloc.c (COPY_INTO_LRECORD_STATS): * alloc.c (sweep_strings): * alloc.c (UNMARK_string): * alloc.c (gc_sweep_1): * alloc.c (finish_object_memory_usage_stats): * alloc.c (object_memory_usage_stats): * alloc.c (object_dead_p): * alloc.c (fixed_type_block_overhead): * alloc.c (lisp_object_storage_size): * emacs.c (main_1): * lisp.h: * lrecord.h: Export lisp_object_storage_size() and malloced_storage_size() even when not MEMORY_USAGE_STATS, to get the non-MEMORY_USAGE_STATS build to compile. Don't export fixed_type_block_overhead() any more. Some code cleanup, rearrangement, add some section headers. Clean up various bugs especially involving computation of overhead and double-counting certain usage in total_gc_usage. Add statistics computing the overhead used by all types. Don't add a special entry for string headers in the object-memory-usage-stats because it's already present as just "string". But do count the overhead used by long strings. Don't try to call the memory_usage() methods when NEW_GC because there's nowhere obvious in the sweep stage to make the calls. * marker.c (compute_buffer_marker_usage): Just use lisp_object_storage_size() rather than trying to reimplement it.
author Ben Wing <ben@xemacs.org>
date Sat, 20 Mar 2010 20:20:30 -0500
parents 9e0b43d3095c
children cf900a2f1fa3
comparison
equal deleted inserted replaced
5159:cb303ff63e76 5160:ab9ee10a53e4
1590 1590
1591 /* ------------------------------- */ 1591 /* ------------------------------- */
1592 /* misc */ 1592 /* misc */
1593 /* ------------------------------- */ 1593 /* ------------------------------- */
1594 1594
1595 #ifdef MEMORY_USAGE_STATS
1596
1597 /* This structure is used to keep statistics on the amount of memory 1595 /* This structure is used to keep statistics on the amount of memory
1598 in use. 1596 in use.
1599 1597
1600 WAS_REQUESTED stores the actual amount of memory that was requested 1598 WAS_REQUESTED stores the actual amount of memory that was requested
1601 of the allocation function. The *_OVERHEAD fields store the 1599 of the allocation function. The *_OVERHEAD fields store the
1624 struct generic_usage_stats 1622 struct generic_usage_stats
1625 { 1623 {
1626 struct usage_stats u; 1624 struct usage_stats u;
1627 Bytecount othervals[32]; 1625 Bytecount othervals[32];
1628 }; 1626 };
1629
1630 #endif /* MEMORY_USAGE_STATS */
1631 1627
1632 1628
1633 /************************************************************************/ 1629 /************************************************************************/
1634 /* Definition of Lisp_Object data type */ 1630 /* Definition of Lisp_Object data type */
1635 /************************************************************************/ 1631 /************************************************************************/
4837 extern MODULE_API int need_to_check_c_alloca; 4833 extern MODULE_API int need_to_check_c_alloca;
4838 extern int need_to_signal_post_gc; 4834 extern int need_to_signal_post_gc;
4839 extern Lisp_Object Qpost_gc_hook, Qgarbage_collecting; 4835 extern Lisp_Object Qpost_gc_hook, Qgarbage_collecting;
4840 void recompute_funcall_allocation_flag (void); 4836 void recompute_funcall_allocation_flag (void);
4841 4837
4842 #ifdef MEMORY_USAGE_STATS
4843 Bytecount malloced_storage_size (void *, Bytecount, struct usage_stats *); 4838 Bytecount malloced_storage_size (void *, Bytecount, struct usage_stats *);
4844 Bytecount fixed_type_block_overhead (Bytecount);
4845 #endif
4846 4839
4847 #ifdef EVENT_DATA_AS_OBJECTS 4840 #ifdef EVENT_DATA_AS_OBJECTS
4848 Lisp_Object make_key_data (void); 4841 Lisp_Object make_key_data (void);
4849 Lisp_Object make_button_data (void); 4842 Lisp_Object make_button_data (void);
4850 Lisp_Object make_motion_data (void); 4843 Lisp_Object make_motion_data (void);
5933 void set_marker_position (Lisp_Object, Charbpos); 5926 void set_marker_position (Lisp_Object, Charbpos);
5934 void unchain_marker (Lisp_Object); 5927 void unchain_marker (Lisp_Object);
5935 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object); 5928 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object);
5936 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); 5929 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object);
5937 #ifdef MEMORY_USAGE_STATS 5930 #ifdef MEMORY_USAGE_STATS
5938 int compute_buffer_marker_usage (struct buffer *, struct usage_stats *); 5931 Bytecount compute_buffer_marker_usage (struct buffer *, struct usage_stats *);
5939 #endif 5932 #endif
5940 void init_buffer_markers (struct buffer *b); 5933 void init_buffer_markers (struct buffer *b);
5941 void uninit_buffer_markers (struct buffer *b); 5934 void uninit_buffer_markers (struct buffer *b);
5942 5935
5943 /* Defined in menubar.c */ 5936 /* Defined in menubar.c */