/[eiffelstudio]/branches/eth/eve/Src/library/memory_analyzer/ma_gc_info_mediator.e
ViewVC logotype

Contents of /branches/eth/eve/Src/library/memory_analyzer/ma_gc_info_mediator.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 83441 - (show annotations)
Sat Jun 5 13:52:53 2010 UTC (9 years, 7 months ago) by jasonw
File size: 11644 byte(s)
Renamed branch eve3 to eve. The eve branch serves as the new branch for the EVE project.
1 note
2 description: "[
3 Mediator of
4 analyze the memory , include: show statistics of garbage
5 collector and memory useage. and draw graph and show texts.
6 ]"
7 legal: "See notice at end of class."
8 status: "See notice at end of class."
9 date: "$Date$"
10 revision: "$Revision$"
11
12 class
13 MA_GC_INFO_MEDIATOR
14 inherit
15 MA_SINGLETON_FACTORY
16
17 create
18 make
19
20 feature {NONE} --Intialization
21
22 make
23 -- Creation method.
24 do
25 eiffel_mem_info := system_util.memory.memory_statistics ({MEM_CONST}.eiffel_memory)
26 c_mem_info := system_util.memory.memory_statistics ({MEM_CONST}.c_memory)
27 total_mem_info := system_util.memory.memory_statistics ({MEM_CONST}.total_memory)
28
29 create histogram_graph.make_default
30 create history_graph_eiffel.make_default
31 create history_graph_c.make_default
32 create history_graph_total.make_default
33 end
34
35 feature -- Command
36
37 show_statistics
38 -- show garbage collection datas to the window
39 -- Update `output_text' with current memory usage.
40 do -- show GC_INFO's content which is used by show_mem_info
41 -- the information of full collector
42 main_window.collected_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).collected.out)
43 main_window.collected_average_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).collected_average.out)
44 main_window.cycle_count_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).cycle_count.out)
45 main_window.memory_used_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).memory_used.out)
46
47 main_window.cpu_interval_time_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).cpu_interval_time.out)
48 main_window.cpu_interval_time_average_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).cpu_interval_time_average.out)
49 main_window.cpu_time_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).cpu_time.out)
50 main_window.cpu_time_average_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).cpu_time_average.out)
51
52 main_window.real_interval_time_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).real_interval_time.out)
53 main_window.real_interval_time_average_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).real_interval_time_average.out)
54 main_window.real_time_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).real_time.out)
55 main_window.real_time_average_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).real_time_average .out)
56
57 main_window.system_interval_time_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).sys_interval_time.out)
58 main_window.system_interval_time_average_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).sys_interval_time_average.out)
59 main_window.system_time_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).sys_time.out)
60 main_window.system_time_average_full.set_text (memory.gc_statistics ({MEMORY}.full_collector).sys_time_average.out)
61
62 -- the information of incremental collector
63 main_window.collected_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).collected.out)
64 main_window.collected_average_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).collected_average.out)
65 main_window.cycle_count_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).cycle_count.out)
66 main_window.memory_used_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).memory_used.out)
67
68 main_window.cpu_interval_time_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).cpu_interval_time.out)
69 main_window.cpu_interval_time_average_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).cpu_interval_time_average.out)
70 main_window.cpu_time_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).cpu_time.out)
71 main_window.cpu_time_average_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).cpu_time_average.out)
72
73 main_window.real_interval_time_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).real_interval_time.out)
74 main_window.real_interval_time_average_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).real_interval_time_average.out)
75 main_window.real_time_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).real_time.out)
76 main_window.real_time_average_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).real_time_average .out)
77
78 main_window.system_interval_time_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).sys_interval_time.out)
79 main_window.system_interval_time_average_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).sys_interval_time_average.out)
80 main_window.system_time_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).sys_time.out)
81 main_window.system_time_average_incre.set_text (memory.gc_statistics ({MEMORY}.incremental_collector).sys_time_average.out)
82
83 -- other informations
84 main_window.chunk_size_other.set_text (memory.chunk_size.out)
85 main_window.largest_coalesced_block_other.set_text (memory.largest_coalesced_block.out)
86 main_window.coalesce_period_other.set_text (memory.coalesce_period.out)
87
88 main_window.scavenge_zone_size_other.set_text (memory.scavenge_zone_size.out)
89 main_window.collection_period_other.set_text (memory.collection_period.out)
90 main_window.tenure_other.set_text (memory.tenure.out)
91
92 main_window.memory_threshold_other.set_text (memory.memory_threshold.out)
93 main_window.generation_object_limit_other.set_text (memory.generation_object_limit.out)
94 main_window.max_memory_other.set_text (memory.max_mem.out)
95 end
96
97 feature -- Implementation for agents
98
99 resize (a_x, a_y, a_width, a_height: INTEGER)
100 -- Things when EV_DRAWABLE resize.
101 do
102 histogram_graph.set_height (a_height)
103 end
104
105 resize_history (a_x, a_y, a_width, a_height: INTEGER)
106 -- Things when EV_DRAWABLE resize.
107 do
108 history_graph_eiffel.set_height (a_height)
109 history_graph_c.set_height (a_height)
110 history_graph_total.set_height (a_height)
111 history_graph_eiffel.set_width (a_width)
112 history_graph_c.set_width (a_width)
113 history_graph_total.set_width (a_width)
114 end
115
116 update_gc_info
117 -- Automatically update the statistics.
118 do
119 draw_graph
120 show_statistics
121 end
122
123 redraw_histogram
124 -- Redraw histogram (left side graph).
125 do
126 draw_eiffel_histogram
127 draw_c_histogram
128 draw_total_histogram
129 end
130
131 redraw_history
132 -- Redraw history (right side graph).
133 do
134 main_window.eiffel_history.draw_pixmap (0, 0, history_graph_eiffel.pixmap)
135 debug ("larry")
136 io.put_string ("%N redraw in MA_GC_INFO_MEDIATOR: pixmap width/height is: " + history_graph_eiffel.pixmap.width.out + " " + history_graph_eiffel.pixmap.height.out)
137 end
138 main_window.c_history.draw_pixmap (0, 0, history_graph_c.pixmap)
139 main_window.total_history.draw_pixmap (0, 0, history_graph_total.pixmap)
140 end
141
142 redraw
143 -- Redraw statistic graph.
144 do
145 redraw_histogram
146 redraw_history
147 show_statistics
148 end
149
150 redraw_for_resize
151 -- First update the figure because window size may changed, then redraw it.
152 do
153 history_graph_eiffel.update_graph
154 history_graph_c.update_graph
155 history_graph_total.update_graph
156 redraw
157 end
158
159
160 feature {NONE} -- Implementaion for draw graphics
161
162 draw_eiffel_histogram
163 -- Draw eiffel historam.
164 do
165 histogram_graph.draw_graph (eiffel_mem_info.used / eiffel_mem_info.total, eiffel_mem_info.overhead / eiffel_mem_info.total)
166 histogram_graph.draw_text (" "+eiffel_mem_info.used.out + "/%N " + eiffel_mem_info.total.out)
167 main_window.eiffel_histogram.draw_pixmap (0, 0, histogram_graph.pixmap)
168 end
169
170 draw_c_histogram
171 -- Draw c histogram.
172 do
173 histogram_graph.draw_graph (c_mem_info.used / c_mem_info.total,c_mem_info.overhead / c_mem_info.total)
174 histogram_graph.draw_text (" "+c_mem_info.used.out + "/%N " + c_mem_info.total.out)
175 main_window.c_histogram.draw_pixmap (0, 0, histogram_graph.pixmap)
176 end
177
178 draw_total_histogram
179 -- Draw histogram.
180 do
181 histogram_graph.draw_graph (total_mem_info.used / total_mem_info.total,total_mem_info.overhead / total_mem_info.total)
182 histogram_graph.draw_text (" "+total_mem_info.used.out + "/%N " + total_mem_info.total.out)
183 main_window.total_histogram.draw_pixmap (0, 0, histogram_graph.pixmap)
184 end
185
186
187 draw_graph
188 -- Draw the statistic graph when time out.
189 do
190 eiffel_mem_info := memory.memory_statistics ({MEM_CONST}.eiffel_memory)
191 c_mem_info := memory.memory_statistics ({MEM_CONST}.c_memory)
192 total_mem_info := memory.memory_statistics ({MEM_CONST}.total_memory)
193
194 history_graph_eiffel.draw_graph (eiffel_mem_info.used / eiffel_mem_info.total, eiffel_mem_info.overhead / eiffel_mem_info.total)
195 history_graph_c.draw_graph (c_mem_info.used / c_mem_info.total, c_mem_info.overhead / c_mem_info.total)
196 history_graph_total.draw_graph (total_mem_info.used / total_mem_info.total, total_mem_info.overhead / total_mem_info.total)
197
198 main_window.eiffel_history.draw_pixmap (0, 0, history_graph_eiffel.pixmap)
199 main_window.c_history.draw_pixmap (0, 0, history_graph_c.pixmap)
200 main_window.total_history.draw_pixmap (0, 0, history_graph_total.pixmap)
201
202 -- If the data changed, draw the new histogram.
203 if last_mem_eiffel_used /= eiffel_mem_info.used or last_mem_eiffel_overhead /= eiffel_mem_info.overhead or
204 last_mem_eiffel_total /= eiffel_mem_info.total then
205 last_mem_eiffel_used := eiffel_mem_info.used
206 last_mem_eiffel_overhead := eiffel_mem_info.overhead
207 last_mem_eiffel_total := eiffel_mem_info.total
208 draw_eiffel_histogram
209 end
210
211 if last_mem_c_used /= c_mem_info.used or last_mem_c_overhead /= c_mem_info.overhead or
212 last_mem_c_total /= c_mem_info.total then
213 last_mem_c_used := c_mem_info.used
214 last_mem_c_overhead := c_mem_info.overhead
215 last_mem_c_total := c_mem_info.total
216 draw_c_histogram
217 end
218
219 if last_mem_total_used /= total_mem_info.used or last_mem_total_overhead /= total_mem_info.overhead or
220 last_mem_total_total /= total_mem_info.total then
221 last_mem_total_used := total_mem_info.used
222 last_mem_total_overhead := total_mem_info.overhead
223 last_mem_total_total := total_mem_info.total
224 draw_total_histogram
225 end
226
227 end
228
229 last_mem_eiffel_used, last_mem_eiffel_overhead, last_mem_eiffel_total: DOUBLE
230 last_mem_c_used, last_mem_c_overhead, last_mem_c_total: DOUBLE
231 last_mem_total_used, last_mem_total_overhead, last_mem_total_total: DOUBLE
232
233 histogram_graph: MA_DRAW_HISTOGRAM
234
235 history_graph_eiffel, history_graph_c, history_graph_total: MA_DRAW_HISTORY
236
237 feature {NONE} -- Implementation
238
239 eiffel_mem_info, c_mem_info, total_mem_info: MEM_INFO
240 -- memory info
241
242 invariant
243
244 histogram_graph_not_void: histogram_graph /= Void
245 history_graph_eiifel_not_void: history_graph_eiffel /= Void
246 history_graph_c_not_void: history_graph_c /= Void
247 history_graph_total_not_void: history_graph_total /= Void
248
249 eiffel_memory_info_not_void: eiffel_mem_info /= Void
250 c_memory_info_not_void: c_mem_info /= Void
251 total_memory_info_not_void: total_mem_info /= Void
252 note
253 copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
254 license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
255 source: "[
256 Eiffel Software
257 356 Storke Road, Goleta, CA 93117 USA
258 Telephone 805-685-1006, Fax 805-685-6869
259 Website http://www.eiffel.com
260 Customer support http://support.eiffel.com
261 ]"
262
263
264
265
266 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23