13 from rtc_handle
import *
14 from BasicDataType_idl
import *
15 from omniORB
import any
20 env =
RtmEnv(sys.argv, [
"localhost:9898"])
21 listo = env.name_space[
"localhost:9898"].list_obj()
22 env.name_space[
'localhost:9898'].rtc_handles.keys()
26 ns = env.name_space[
'localhost:9898']
28 consin0 = ns.rtc_handles[
"ConsoleIn0.rtc"]
31 (stat, output) = commands.getstatusoutput(
"ps alxww | grep \"[r]\"tcd")
32 return output.split()[7]
38 fout.write(out_data +
'\n')
46 fout.write(out_data +
'\n')
52 if rss_start != rss_end:
53 fodat =
" result: memory leak was found !!!" 55 fodat =
" result: memory leak was not found." 60 test_case =
"SDOPackageTest" 61 fout = open(test_case +
".log",
'w')
63 fodat =
"=== " + test_case +
" start ===" 74 fodat =
"get_owned_organizations()" 77 for i
in range(loop_cnt):
79 consin0.rtc_ref.get_owned_organizations()
82 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
83 fodat =
" %05d: %s KB start" % (1, rss0)
87 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
92 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
96 fodat =
"get_sdo_id()" 99 for i
in range(loop_cnt):
101 consin0.rtc_ref.get_sdo_id()
104 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
105 fodat =
" %05d: %s KB start" % (1, rss0)
109 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
111 rss0 = rss1 ; j0 = j1
114 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
118 fodat =
"get_sdo_type()" 121 for i
in range(loop_cnt):
123 consin0.rtc_ref.get_sdo_type()
126 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
127 fodat =
" %05d: %s KB start" % (1, rss0)
131 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
133 rss0 = rss1 ; j0 = j1
136 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
140 fodat =
"get_device_profile()" 143 for i
in range(loop_cnt):
145 consin0.rtc_ref.get_device_profile ()
148 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
149 fodat =
" %05d: %s KB start" % (1, rss0)
153 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
155 rss0 = rss1 ; j0 = j1
158 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
162 fodat =
"get_configuration()" 165 for i
in range(loop_cnt):
167 config = consin0.rtc_ref.get_configuration ()
170 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
171 fodat =
" %05d: %s KB start" % (1, rss0)
175 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
177 rss0 = rss1 ; j0 = j1
180 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
184 fodat =
"get_status_list()" 187 for i
in range(loop_cnt):
189 consin0.rtc_ref.get_status_list ()
192 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
193 fodat =
" %05d: %s KB start" % (1, rss0)
197 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
199 rss0 = rss1 ; j0 = j1
202 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
206 fodat =
"set_device_profile()" 209 for i
in range(loop_cnt):
211 devProf = SDOPackage.DeviceProfile(
"test",
"",
"",
"0.1.0",[])
212 config.set_device_profile (devProf)
215 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
216 fodat =
" %05d: %s KB start" % (1, rss0)
220 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
222 rss0 = rss1 ; j0 = j1
225 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
229 fodat =
"get_configuration_parameters()" 232 for i
in range(loop_cnt):
234 config.get_configuration_parameters ()
237 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
238 fodat =
" %05d: %s KB start" % (1, rss0)
242 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
244 rss0 = rss1 ; j0 = j1
247 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
251 fodat =
"get_configuration_parameter_values()" 254 for i
in range(loop_cnt):
256 config.get_configuration_parameter_values ()
259 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
260 fodat =
" %05d: %s KB start" % (1, rss0)
264 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
266 rss0 = rss1 ; j0 = j1
269 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
273 fodat =
"get_configuration_parameter_value()" 276 for i
in range(loop_cnt):
278 config.get_configuration_parameter_value (
"test")
281 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
282 fodat =
" %05d: %s KB start" % (1, rss0)
286 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
288 rss0 = rss1 ; j0 = j1
291 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
295 fodat =
"set_configuration_parameter()" 298 for i
in range(loop_cnt):
300 config.set_configuration_parameter (
"test",any.to_any(
"value"))
303 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
304 fodat =
" %05d: %s KB start" % (1, rss0)
308 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
310 rss0 = rss1 ; j0 = j1
313 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
317 fodat =
"get_configuration_sets()" 320 for i
in range(loop_cnt):
322 config.get_configuration_sets ()
325 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
326 fodat =
" %05d: %s KB start" % (1, rss0)
330 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
332 rss0 = rss1 ; j0 = j1
335 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
340 fodat =
"=== " + test_case +
" end ===" def print_file_and_cons(out_data, out_flag=0)
file and console out
def leak_check(rss_start, rss_end)
memory leak check