13 from rtc_handle
import *
14 from BasicDataType_idl
import *
15 from CorbaNaming
import *
23 env =
RtmEnv(sys.argv, [
"localhost:9898"])
24 mgr_name=socket.gethostname()+
".host_cxt/manager.mgr" 26 manager = naming.resolve(mgr_name)._narrow(RTM.Manager)
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 =
"ManagerTest" 61 fout = open(test_case +
".log",
'w')
63 fodat =
"=== " + test_case +
" start ===" 68 fodat =
"get_loadable_modules()" 71 for i
in range(loop_cnt):
73 manager.get_loadable_modules()
76 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
77 fodat =
" %05d: %s KB start" % (1, rss0)
81 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
86 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
90 fodat =
"get_loaded_modules()" 93 for i
in range(loop_cnt):
95 manager.get_loaded_modules()
98 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
99 fodat =
" %05d: %s KB start" % (1, rss0)
103 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
105 rss0 = rss1 ; j0 = j1
108 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
112 fodat =
"get_factory_profiles()" 115 for i
in range(loop_cnt):
117 manager.get_factory_profiles()
120 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
121 fodat =
" %05d: %s KB start" % (1, rss0)
125 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
127 rss0 = rss1 ; j0 = j1
130 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
134 fodat =
"get_components()" 137 for i
in range(loop_cnt):
139 manager.get_components()
142 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
143 fodat =
" %05d: %s KB start" % (1, rss0)
147 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
149 rss0 = rss1 ; j0 = j1
152 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
156 fodat =
"get_component_profiles()" 159 for i
in range(loop_cnt):
161 manager.get_component_profiles()
164 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
165 fodat =
" %05d: %s KB start" % (1, rss0)
169 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
171 rss0 = rss1 ; j0 = j1
174 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
178 fodat =
"get_profile()" 181 for i
in range(loop_cnt):
183 manager.get_profile()
186 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
187 fodat =
" %05d: %s KB start" % (1, rss0)
191 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
193 rss0 = rss1 ; j0 = j1
196 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
200 fodat =
"get_configuration()" 203 for i
in range(loop_cnt):
205 manager.get_configuration()
208 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
209 fodat =
" %05d: %s KB start" % (1, rss0)
213 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
215 rss0 = rss1 ; j0 = j1
218 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
222 fodat =
"set_configuration()" 225 for i
in range(loop_cnt):
227 manager.set_configuration(
"module.load_path",
"./")
230 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
231 fodat =
" %05d: %s KB start" % (1, rss0)
235 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
237 rss0 = rss1 ; j0 = j1
240 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
335 for i
in range(loop_cnt):
340 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
341 fodat =
" %05d: %s KB start" % (1, rss0)
345 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
347 rss0 = rss1 ; j0 = j1
350 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
379 for i
in range(loop_cnt):
384 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
385 fodat =
" %05d: %s KB start" % (1, rss0)
389 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
391 rss0 = rss1 ; j0 = j1
394 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
398 fodat =
"get_service()" 401 for i
in range(loop_cnt):
403 manager.get_service(
"test")
406 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
407 fodat =
" %05d: %s KB start" % (1, rss0)
411 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
413 rss0 = rss1 ; j0 = j1
416 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
421 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