13 from rtc_handle
import *
14 from BasicDataType_idl
import *
15 from omniORB
import any
19 import SDOPackage__POA
28 env = RtmEnv(sys.argv, [
"localhost:9898"])
31 mgr_name = socket.gethostname()+
".host_cxt/manager.mgr" 33 manager = naming.resolve(mgr_name)._narrow(RTM.Manager)
35 manager.create_component(
"PeriodicECSharedComposite?instance_name=a&exported_ports=ConsoleIn0.out,ConsoleOut0.in")
39 listo = env.name_space[
"localhost:9898"].list_obj()
40 env.name_space[
'localhost:9898'].rtc_handles.keys()
42 ns = env.name_space[
'localhost:9898']
45 a0 = ns.rtc_handles[
"a.rtc"]
46 config = a0.rtc_ref.get_configuration()
47 svcprofs = a0.rtc_ref.get_service_profiles()
50 svcProf = SDOPackage.ServiceProfile(
"ID 1",
"INTERFACE_TYPE 1", [], sdomock)
53 (stat, output) = commands.getstatusoutput(
"ps alxww | grep \"[r]\"tcd")
54 return output.split()[7]
60 fout.write(out_data +
'\n')
68 fout.write(out_data +
'\n')
74 if rss_start != rss_end:
75 fodat =
" result: memory leak was found !!!" 77 fodat =
" result: memory leak was not found." 82 test_case =
"ServiceProfileSDOPackageTest" 83 fout = open(test_case +
".log",
'w')
85 fodat =
"=== " + test_case +
" start ===" 90 fodat =
"add_service_profile()" 93 for i
in range(loop_cnt):
95 config.add_service_profile(svcProf)
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_service_profiles()" 115 for i
in range(loop_cnt):
117 a0.rtc_ref.get_service_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_service_profile()" 137 for i
in range(loop_cnt):
139 a0.rtc_ref.get_service_profile(
"ID 1")
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_sdo_service()" 159 for i
in range(loop_cnt):
161 a0.rtc_ref.get_sdo_service(
"ID 1")
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 =
"remove_service_profile()" 181 for i
in range(loop_cnt):
183 config.remove_service_profile(
"ID 1")
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)
201 fodat =
"=== " + test_case +
" end ===" def print_file_and_cons(out_data, out_flag=0)
file and console out
Dummy class of SDOService_impl.
def leak_check(rss_start, rss_end)
memory leak check