/[eiffelstudio]/FreeELKS/trunk/library/kernel/gc_info.e
ViewVC logotype

Contents of /FreeELKS/trunk/library/kernel/gc_info.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91477 - (show annotations)
Sun Jan 14 09:47:13 2007 UTC (13 years ago) by ericb
File size: 8224 byte(s)
Synchronized with ISE 6.0.65740
1 indexing
2
3 description: "[
4 Garbage collector statistics.
5 This class may be used as ancestor by classes needing its facilities.
6 Time accounting is relevant only if `enable_time_accounting'
7 (from MEMORY) has been called.
8 ]"
9 library: "Free implementation of ELKS library"
10 copyright: "Copyright (c) 1986-2004, Eiffel Software and others"
11 license: "Eiffel Forum License v2 (see forum.txt)"
12 date: "$Date$"
13 revision: "$Revision$"
14
15 class GC_INFO
16
17 inherit
18 MEMORY_STRUCTURE
19 rename
20 make as structure_make
21 export
22 {NONE} make_by_pointer, structure_make, item, shared
23 end
24
25 MEM_CONST
26
27 create
28 make
29
30 feature -- Initialization
31
32 make (memory: INTEGER) is
33 -- Fill in statistics for `memory' type
34 require
35 memory_valid: memory = Incremental_collector or memory = Full_collector
36 do
37 structure_make
38 update (memory)
39 ensure
40 type_set: type = memory
41 end
42
43 update (memory: INTEGER) is
44 -- Fill in statistics for `memory' type
45 require
46 memory_valid: memory = Incremental_collector or memory = Full_collector
47 do
48 gc_stat (item, memory)
49 type := memory
50 ensure
51 type_set: type = memory
52 end
53
54 feature -- Access
55
56 type: INTEGER
57 -- Collector type (Full, Collect),
58 -- for `type' before last call to `update'
59
60 cycle_count: INTEGER is
61 -- Number of collection cycles for `type'
62 -- before last call to `update'
63 do
64 Result := c_count (item)
65 end
66
67 memory_used: INTEGER is
68 -- Total number of bytes used (counting overhead)
69 -- after last cycle for `type' before last
70 -- call to `update'
71 do
72 Result := c_mem_used (item)
73 end
74
75 collected: INTEGER is
76 -- Number of bytes collected by the last cycle,
77 -- for `type' before last call to `update'
78 do
79 Result := c_mem_collect (item)
80 end
81
82 collected_average: INTEGER is
83 -- Average number of bytes collected by a cycle,
84 -- for `type' before last call to `update'
85 do
86 Result := c_mem_avg (item)
87 end
88
89 real_time: INTEGER is
90 -- Real time in centi-seconds used by last cycle
91 -- for `type', before last call to `update';
92 -- this may not be accurate on systems which do not
93 -- provide a sub-second accuracy clock (typically
94 -- provided on BSD).
95 do
96 Result := c_real_time (item)
97 end
98
99 real_time_average: INTEGER is
100 -- Average amount of real time, in centi-seconds,
101 -- spent in collection cycle,
102 -- for `type' before last call to `update'
103 do
104 Result := c_real_avg (item)
105 end
106
107 real_interval_time: INTEGER is
108 -- Real interval time (as opposed to CPU time) between
109 -- two automatically raised cycles, in centi-seconds,
110 -- for `type' before last call to `update'
111 do
112 Result := c_real_itime (item)
113 end
114
115 real_interval_time_average: INTEGER is
116 -- Average real interval time between two automatic
117 -- cycles, in centi-seconds,
118 -- for `type' before last call to `update'
119 do
120 Result := c_real_iavg (item)
121 end
122
123 cpu_time: DOUBLE is
124 -- Amount of CPU time, in seconds, spent in cycle,
125 -- for `type' before last call to `update'
126 do
127 Result := c_cpu_time (item)
128 end
129
130 cpu_time_average: DOUBLE is
131 -- Average amount of CPU time spent in cycle,
132 -- in seconds, for `type' before last call to `update'
133 do
134 Result := c_cpu_avg (item)
135 end
136
137 cpu_interval_time: DOUBLE is
138 -- Amount of CPU time elapsed since between last
139 -- and penultimate cycles for `type' before
140 -- last call to `update'
141 do
142 Result := c_cpu_itime (item)
143 end
144
145 cpu_interval_time_average: DOUBLE is
146 -- Average amount of CPU time between two cycles,
147 -- for `type' before last call to `update'
148 do
149 Result := c_cpu_iavg (item)
150 end
151
152 sys_time: DOUBLE is
153 -- Amount of kernel time, in seconds, spent in cycle,
154 -- for `type' before last call to `update'
155 do
156 Result := c_sys_time (item)
157 end
158
159 sys_time_average: DOUBLE is
160 -- Average amount of kernel time spent in cycle,
161 -- for `type' before last call to `update'
162 do
163 Result := c_sys_avg (item)
164 end
165
166 sys_interval_time: DOUBLE is
167 -- Amount of kernel time elapsed since between
168 -- the last and the penultimate cycle,
169 -- for `type' before last call to `update'
170 do
171 Result := c_sys_itime (item)
172 end
173
174 sys_interval_time_average: DOUBLE is
175 -- Average amount of kernel time between two cycles,
176 -- for `type' before last call to `update'
177 do
178 Result := c_sys_iavg (item)
179 end
180
181 feature {NONE} -- Implementation
182
183 gc_stat (a_ptr: POINTER; mem: INTEGER) is
184 -- Initialize `a_ptr used by GC_INFO to retrieve the
185 -- statistics frozen at the time of this call.
186 external
187 "C use %"eif_memory.h%""
188 alias
189 "eif_gc_stat"
190 end
191
192 structure_size: INTEGER is
193 -- Size of underlying C structure.
194 do
195 Result := c_sizeof_gacstat
196 end
197
198 feature {NONE} -- C externals
199
200 c_sizeof_gacstat: INTEGER is
201 -- Size of struct `gacstat'.
202 external
203 "C inline use %"eif_memory.h%""
204 alias
205 "return sizeof(struct gacstat);"
206 end
207
208 c_count (a_ptr: POINTER): INTEGER is
209 -- Access `count' data member of `a_ptr' struct.
210 external
211 "C inline use %"eif_memory.h%""
212 alias
213 "return ((struct gacstat *) $a_ptr)->count;"
214 end
215
216 c_mem_used (a_ptr: POINTER): INTEGER is
217 -- Access `mem_used' data member of `a_ptr' struct.
218 external
219 "C inline use %"eif_memory.h%""
220 alias
221 "return ((struct gacstat *) $a_ptr)->mem_used;"
222 end
223
224 c_mem_collect (a_ptr: POINTER): INTEGER is
225 -- Access `mem_collect' data member of `a_ptr' struct.
226 external
227 "C inline use %"eif_memory.h%""
228 alias
229 "return ((struct gacstat *) $a_ptr)->mem_collect;"
230 end
231
232 c_mem_avg (a_ptr: POINTER): INTEGER is
233 -- Access `mem_avg' data member of `a_ptr' struct.
234 external
235 "C inline use %"eif_memory.h%""
236 alias
237 "return ((struct gacstat *) $a_ptr)->mem_avg;"
238 end
239
240 c_real_time (a_ptr: POINTER): INTEGER is
241 -- Access `real_time' data member of `a_ptr' struct.
242 external
243 "C inline use %"eif_memory.h%""
244 alias
245 "return ((struct gacstat *) $a_ptr)->real_time;"
246 end
247
248 c_real_avg (a_ptr: POINTER): INTEGER is
249 -- Access `real_avg' data member of `a_ptr' struct.
250 external
251 "C inline use %"eif_memory.h%""
252 alias
253 "return ((struct gacstat *) $a_ptr)->real_avg;"
254 end
255
256 c_real_itime (a_ptr: POINTER): INTEGER is
257 -- Access `real_itime' data member of `a_ptr' struct.
258 external
259 "C inline use %"eif_memory.h%""
260 alias
261 "return ((struct gacstat *) $a_ptr)->real_itime;"
262 end
263
264 c_real_iavg (a_ptr: POINTER): INTEGER is
265 -- Access `real_iavg' data member of `a_ptr' struct.
266 external
267 "C inline use %"eif_memory.h%""
268 alias
269 "return ((struct gacstat *) $a_ptr)->real_iavg;"
270 end
271
272 c_cpu_time (a_ptr: POINTER): DOUBLE is
273 -- Access `cpu_time' data member of `a_ptr' struct.
274 external
275 "C inline use %"eif_memory.h%""
276 alias
277 "return ((struct gacstat *) $a_ptr)->cpu_time;"
278 end
279
280 c_cpu_avg (a_ptr: POINTER): DOUBLE is
281 -- Access `cpu_avg' data member of `a_ptr' struct.
282 external
283 "C inline use %"eif_memory.h%""
284 alias
285 "return ((struct gacstat *) $a_ptr)->cpu_avg;"
286 end
287
288 c_cpu_itime (a_ptr: POINTER): DOUBLE is
289 -- Access `cpu_itime' data member of `a_ptr' struct.
290 external
291 "C inline use %"eif_memory.h%""
292 alias
293 "return ((struct gacstat *) $a_ptr)->cpu_itime;"
294 end
295
296 c_cpu_iavg (a_ptr: POINTER): DOUBLE is
297 -- Access `cpu_iavg' data member of `a_ptr' struct.
298 external
299 "C inline use %"eif_memory.h%""
300 alias
301 "return ((struct gacstat *) $a_ptr)->cpu_iavg;"
302 end
303
304 c_sys_time (a_ptr: POINTER): DOUBLE is
305 -- Access `sys_time' data member of `a_ptr' struct.
306 external
307 "C inline use %"eif_memory.h%""
308 alias
309 "return ((struct gacstat *) $a_ptr)->sys_time;"
310 end
311
312 c_sys_avg (a_ptr: POINTER): DOUBLE is
313 -- Access `sys_avg' data member of `a_ptr' struct.
314 external
315 "C inline use %"eif_memory.h%""
316 alias
317 "return ((struct gacstat *) $a_ptr)->sys_avg;"
318 end
319
320 c_sys_itime (a_ptr: POINTER): DOUBLE is
321 -- Access `sys_itime' data member of `a_ptr' struct.
322 external
323 "C inline use %"eif_memory.h%""
324 alias
325 "return ((struct gacstat *) $a_ptr)->sys_itime;"
326 end
327
328 c_sys_iavg (a_ptr: POINTER): DOUBLE is
329 -- Access `sys_iavg' data member of `a_ptr' struct.
330 external
331 "C inline use %"eif_memory.h%""
332 alias
333 "return ((struct gacstat *) $a_ptr)->sys_iavg;"
334 end
335
336 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23