13 from rtc_handle
import *
14 from BasicDataType_idl
import *
15 from omniORB
import any
22 env =
RtmEnv(sys.argv, [
"localhost:9898"])
25 mgr_name = socket.gethostname()+
".host_cxt/manager.mgr" 27 manager = naming.resolve(mgr_name)._narrow(RTM.Manager)
29 manager.create_component(
"PeriodicECSharedComposite?instance_name=a&exported_ports=ConsoleIn0.out,ConsoleOut0.in")
33 listo = env.name_space[
"localhost:9898"].list_obj()
34 env.name_space[
'localhost:9898'].rtc_handles.keys()
36 ns = env.name_space[
'localhost:9898']
38 consin0 = ns.rtc_handles[
"ConsoleIn0.rtc"]
39 consout0 = ns.rtc_handles[
"ConsoleOut0.rtc"]
41 a0 = ns.rtc_handles[
"a.rtc"]
42 org = a0.rtc_ref.get_owned_organizations()[0]
43 config = a0.rtc_ref.get_configuration()
44 configset = config.get_configuration_sets()
47 config.add_configuration_set(configset[0])
50 (stat, output) = commands.getstatusoutput(
"ps alxww | grep \"[r]\"tcd")
51 return output.split()[7]
57 fout.write(out_data +
'\n')
65 fout.write(out_data +
'\n')
71 if rss_start != rss_end:
72 fodat =
" result: memory leak was found !!!" 74 fodat =
" result: memory leak was not found." 79 test_case =
"ConfigurationSDOPackageTest" 80 fout = open(test_case +
".log",
'w')
82 fodat =
"=== " + test_case +
" start ===" 87 fodat =
"add_configuration_set() and remove_configuration_set()" 90 for i
in range(loop_cnt):
92 config.add_configuration_set(configset[0])
95 config.remove_configuration_set(id)
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 =
"activate_configuration_set() and get_active_configuration_set()" 116 for i
in range(loop_cnt):
118 config.activate_configuration_set(id)
121 config.get_active_configuration_set()
124 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
125 fodat =
" %05d: %s KB start" % (1, rss0)
129 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
131 rss0 = rss1 ; j0 = j1
134 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
138 fodat =
"get_configuration_set()" 141 for i
in range(loop_cnt):
143 config.get_configuration_set(id)
146 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
147 fodat =
" %05d: %s KB start" % (1, rss0)
151 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
153 rss0 = rss1 ; j0 = j1
156 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
160 fodat =
"set_configuration_set_values()" 163 for i
in range(loop_cnt):
165 config.set_configuration_set_values (configset[0])
168 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
169 fodat =
" %05d: %s KB start" % (1, rss0)
173 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
175 rss0 = rss1 ; j0 = j1
178 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
183 fodat =
"=== " + test_case +
" end ===" 187 config.remove_configuration_set(id)
def leak_check(rss_start, rss_end)
memory leak check
def print_file_and_cons(out_data, out_flag=0)
file and console out