Mercurial > hg > xemacs-beta
comparison src/frame.c @ 5158:9e0b43d3095c
more cleanups to object-memory-usage stuff
-------------------- ChangeLog entries follow: --------------------
lisp/ChangeLog addition:
2010-03-19 Ben Wing <ben@xemacs.org>
* diagnose.el (show-object-memory-usage-stats):
Rewrite to take into account non-lisp-storage statistics
returned by garbage-collect-1 and friends.
src/ChangeLog addition:
2010-03-19 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (struct):
* alloc.c (tick_lrecord_stats):
* alloc.c (gc_sweep_1):
* alloc.c (finish_object_memory_usage_stats):
* alloc.c (object_memory_usage_stats):
* alloc.c (compute_memusage_stats_length):
Call new memory-usage mechanism at sweep time to compute extra
memory utilization for all objects. Add up the values element-by-
element to get an aggregrate set of statistics, where each is the
sum of the values of a single statistic across different objects
of the same type. At end of sweep time, call
finish_object_memory_usage_stats() to add up all the aggreggrate
stats that are related to non-Lisp memory storage to compute
a single value, and add it to the list of values returned by
`garbage-collect' and `object-memory-usage-stats'.
* buffer.c (compute_buffer_text_usage):
Don't crash on buffers without text (killed buffers?) and don't
double-count indirect buffers.
* elhash.c:
* elhash.c (hash_table_objects_create):
* elhash.c (vars_of_elhash):
* symsinit.h:
Add memory-usage method to count the size of `hentries'.
* emacs.c (main_1):
Call new functions in elhash.c, frame.c at init.
* frame.c:
* frame.c (compute_frame_usage):
* frame.c (frame_memory_usage):
* frame.c (frame_objects_create):
* symsinit.h:
Add memory-usage method to count gutter display structures,
subwindow exposures.
* gc.c (gc_finish):
* lisp.h:
Declare finish_object_memory_usage_stats(), call it in gc_finish().
* lrecord.h (struct lrecord_implementation):
* lrecord.h (INIT_MEMORY_USAGE_STATS):
New value in implementation struct to track number of non-Lisp-memory
statistics. Computed in alloc.c.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Fri, 19 Mar 2010 14:47:44 -0500 |
parents | 88bd4f3ef8e4 |
children | 94982b8f9485 |
comparison
equal
deleted
inserted
replaced
5157:1fae11d56ad2 | 5158:9e0b43d3095c |
---|---|
4062 { | 4062 { |
4063 MARK_ICON_CHANGED; | 4063 MARK_ICON_CHANGED; |
4064 } | 4064 } |
4065 | 4065 |
4066 | 4066 |
4067 #ifdef MEMORY_USAGE_STATS | |
4068 | |
4069 struct frame_stats | |
4070 { | |
4071 struct usage_stats u; | |
4072 Bytecount gutter; | |
4073 Bytecount expose_ignore; | |
4074 Bytecount other; | |
4075 }; | |
4076 | |
4077 static void | |
4078 compute_frame_usage (struct frame *f, struct frame_stats *stats, | |
4079 struct usage_stats *ustats) | |
4080 { | |
4081 enum edge_pos edge; | |
4082 EDGE_POS_LOOP (edge) | |
4083 { | |
4084 stats->gutter += | |
4085 compute_display_line_dynarr_usage (f->current_display_lines[edge], | |
4086 ustats); | |
4087 stats->gutter += | |
4088 compute_display_line_dynarr_usage (f->desired_display_lines[edge], | |
4089 ustats); | |
4090 } | |
4091 { | |
4092 struct expose_ignore *e; | |
4093 | |
4094 for (e = f->subwindow_exposures; e; e = e->next) | |
4095 stats->expose_ignore += malloced_storage_size (e, sizeof (*e), ustats); | |
4096 } | |
4097 | |
4098 #if 0 | |
4099 stats->other += FRAMEMETH (f, frame_memory_usage, (f, ustats)); | |
4100 #endif | |
4101 } | |
4102 | |
4103 static void | |
4104 frame_memory_usage (Lisp_Object frame, struct generic_usage_stats *gustats) | |
4105 { | |
4106 struct frame_stats *stats = (struct frame_stats *) gustats; | |
4107 | |
4108 compute_frame_usage (XFRAME (frame), stats, &stats->u); | |
4109 } | |
4110 | |
4111 #endif /* MEMORY_USAGE_STATS */ | |
4112 | |
4113 | |
4067 /***************************************************************************/ | 4114 /***************************************************************************/ |
4068 /* */ | 4115 /* */ |
4069 /* initialization */ | 4116 /* initialization */ |
4070 /* */ | 4117 /* */ |
4071 /***************************************************************************/ | 4118 /***************************************************************************/ |
4119 | |
4120 void | |
4121 frame_objects_create (void) | |
4122 { | |
4123 #ifdef MEMORY_USAGE_STATS | |
4124 OBJECT_HAS_METHOD (frame, memory_usage); | |
4125 #endif | |
4126 } | |
4072 | 4127 |
4073 void | 4128 void |
4074 init_frame (void) | 4129 init_frame (void) |
4075 { | 4130 { |
4076 #ifndef PDUMP | 4131 #ifndef PDUMP |
4214 } | 4269 } |
4215 | 4270 |
4216 void | 4271 void |
4217 vars_of_frame (void) | 4272 vars_of_frame (void) |
4218 { | 4273 { |
4274 #ifdef MEMORY_USAGE_STATS | |
4275 OBJECT_HAS_PROPERTY | |
4276 (frame, memusage_stats_list, list3 (Qgutter, intern ("expose-ignore"), | |
4277 Qother)); | |
4278 #endif /* MEMORY_USAGE_STATS */ | |
4279 | |
4219 /* */ | 4280 /* */ |
4220 Vframe_being_created = Qnil; | 4281 Vframe_being_created = Qnil; |
4221 staticpro (&Vframe_being_created); | 4282 staticpro (&Vframe_being_created); |
4222 | 4283 |
4223 #ifdef HAVE_CDE | 4284 #ifdef HAVE_CDE |