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