RTCTest.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: euc-jp -*-
00003 #
00004 ## RTCTest.py
00005 ##
00006 ## メモリーリークチェック
00007 ## RTC.idlで定義されているオペレーション
00008 ## ステートレスなオペレーション
00009 #
00010 # $Id: RTCTest.py 1541 2009-08-31 07:21:12Z hakuta $
00011 #
00012 
00013 from rtc_handle import *
00014 from BasicDataType_idl import *
00015 import time
00016 import commands
00017 
00018 env = RtmEnv(sys.argv, ["localhost:9898"])
00019 list0 = env.name_space["localhost:9898"].list_obj()
00020 env.name_space['localhost:9898'].rtc_handles.keys()
00021 
00022 time.sleep(2)
00023 
00024 ns = env.name_space['localhost:9898']
00025 
00026 compo1 = ns.rtc_handles["ConsoleIn0.rtc"]
00027 compo0 = ns.rtc_handles["ConsoleOut0.rtc"]
00028 
00029 def mem_rss():
00030     (stat, output) = commands.getstatusoutput("ps alxww | grep \"[r]\"tcd")
00031     return output.split()[7]
00032 
00033 ## file and console out
00034 def print_file_and_cons(out_data, out_flag=0):
00035     ## out_flag:1 is file out only
00036     if out_flag == 1:
00037       fout.write(out_data + '\n')
00038       fout.flush()
00039     ## out_flag:2 is console out only
00040     elif out_flag == 2:
00041       print out_data
00042     ## out_flag:0 is console and file out (default)
00043     else:
00044       print out_data
00045       fout.write(out_data + '\n')
00046       fout.flush()
00047     return
00048 
00049 ## memory leak check
00050 def leak_check(rss_start, rss_end):
00051     if rss_start != rss_end:
00052         fodat = "  result: memory leak was found !!!"
00053     else:
00054         fodat = "  result: memory leak was not found."
00055     print_file_and_cons(fodat)
00056     return
00057 
00058 ## file out setting
00059 test_case = "RTCTest"
00060 fout = open(test_case + ".log", 'w')
00061 
00062 fodat = "=== " + test_case + " start ==="
00063 print_file_and_cons(fodat)
00064 
00065 ec = compo0.rtc_ref.get_owned_contexts()
00066 ec_id = compo0.rtc_ref.get_context_handle(ec[0])
00067 ec[0].activate_component(compo0.rtc_ref)
00068 
00069 loop_cnt = 1000
00070 ## -----------------------------------------------------------------------------
00071 fodat = "on_finalize()"
00072 print_file_and_cons(fodat)
00073 
00074 for i in range(loop_cnt):
00075     # ComponentAction::on_finalize()
00076     compo0.rtc_ref.on_finalize()
00077 
00078     if i == 0:
00079         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00080         fodat = "   %05d: %s KB start" % (1, rss0)
00081         print_file_and_cons(fodat,1)
00082     rss1 = mem_rss() ; j1 = i
00083     if rss0 != rss1:
00084         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00085         print_file_and_cons(fodat,1)
00086         rss0 = rss1 ; j0 = j1
00087 
00088 rssEnd = mem_rss()
00089 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00090 print_file_and_cons(fodat,1)
00091 leak_check(rssStart, rssEnd)
00092 ## -----------------------------------------------------------------------------
00093 fodat = "on_startup()"
00094 print_file_and_cons(fodat)
00095 
00096 for i in range(loop_cnt):
00097     # ComponentAction::on_startup(in ExecutionContextHandle_t exec_handle)
00098     compo0.rtc_ref.on_startup(ec_id)
00099 
00100     if i == 0:
00101         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00102         fodat = "   %05d: %s KB start" % (1, rss0)
00103         print_file_and_cons(fodat,1)
00104     rss1 = mem_rss() ; j1 = i
00105     if rss0 != rss1:
00106         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00107         print_file_and_cons(fodat,1)
00108         rss0 = rss1 ; j0 = j1
00109 
00110 rssEnd = mem_rss()
00111 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00112 print_file_and_cons(fodat,1)
00113 leak_check(rssStart, rssEnd)
00114 ## -----------------------------------------------------------------------------
00115 fodat = "on_shutdown()"
00116 print_file_and_cons(fodat)
00117 
00118 for i in range(loop_cnt):
00119     # ComponentAction::on_shutdown(in ExecutionContextHandle_t exec_handle)
00120     compo0.rtc_ref.on_shutdown(ec_id)
00121 
00122     if i == 0:
00123         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00124         fodat = "   %05d: %s KB start" % (1, rss0)
00125         print_file_and_cons(fodat,1)
00126     rss1 = mem_rss() ; j1 = i
00127     if rss0 != rss1:
00128         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00129         print_file_and_cons(fodat,1)
00130         rss0 = rss1 ; j0 = j1
00131 
00132 rssEnd = mem_rss()
00133 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00134 print_file_and_cons(fodat,1)
00135 leak_check(rssStart, rssEnd)
00136 ## -----------------------------------------------------------------------------
00137 fodat = "on_activated()"
00138 print_file_and_cons(fodat)
00139 
00140 for i in range(loop_cnt):
00141     # ComponentAction::on_activated(in ExecutionContextHandle_t exec_handle)
00142     compo0.rtc_ref.on_activated(ec_id)
00143 
00144     if i == 0:
00145         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00146         fodat = "   %05d: %s KB start" % (1, rss0)
00147         print_file_and_cons(fodat,1)
00148     rss1 = mem_rss() ; j1 = i
00149     if rss0 != rss1:
00150         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00151         print_file_and_cons(fodat,1)
00152         rss0 = rss1 ; j0 = j1
00153 
00154 rssEnd = mem_rss()
00155 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00156 print_file_and_cons(fodat,1)
00157 leak_check(rssStart, rssEnd)
00158 ## -----------------------------------------------------------------------------
00159 fodat = "on_deactivated()"
00160 print_file_and_cons(fodat)
00161 
00162 for i in range(loop_cnt):
00163     # ComponentAction::on_deactivated(in ExecutionContextHandle_t exec_handle)
00164     compo0.rtc_ref.on_deactivated(ec_id)
00165 
00166     if i == 0:
00167         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00168         fodat = "   %05d: %s KB start" % (1, rss0)
00169         print_file_and_cons(fodat,1)
00170     rss1 = mem_rss() ; j1 = i
00171     if rss0 != rss1:
00172         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00173         print_file_and_cons(fodat,1)
00174         rss0 = rss1 ; j0 = j1
00175 
00176 rssEnd = mem_rss()
00177 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00178 print_file_and_cons(fodat,1)
00179 leak_check(rssStart, rssEnd)
00180 ## -----------------------------------------------------------------------------
00181 fodat = "on_aborting()"
00182 print_file_and_cons(fodat)
00183 
00184 for i in range(loop_cnt):
00185     # ComponentAction::on_aborting(in ExecutionContextHandle_t exec_handle)
00186     compo0.rtc_ref.on_aborting(ec_id)
00187 
00188     if i == 0:
00189         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00190         fodat = "   %05d: %s KB start" % (1, rss0)
00191         print_file_and_cons(fodat,1)
00192     rss1 = mem_rss() ; j1 = i
00193     if rss0 != rss1:
00194         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00195         print_file_and_cons(fodat,1)
00196         rss0 = rss1 ; j0 = j1
00197 
00198 rssEnd = mem_rss()
00199 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00200 print_file_and_cons(fodat,1)
00201 leak_check(rssStart, rssEnd)
00202 ## -----------------------------------------------------------------------------
00203 fodat = "on_error()"
00204 print_file_and_cons(fodat)
00205 
00206 for i in range(loop_cnt):
00207     # ComponentAction::on_error(in ExecutionContextHandle_t exec_handle)
00208     compo0.rtc_ref.on_error(ec_id)
00209 
00210     if i == 0:
00211         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00212         fodat = "   %05d: %s KB start" % (1, rss0)
00213         print_file_and_cons(fodat,1)
00214     rss1 = mem_rss() ; j1 = i
00215     if rss0 != rss1:
00216         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00217         print_file_and_cons(fodat,1)
00218         rss0 = rss1 ; j0 = j1
00219 
00220 rssEnd = mem_rss()
00221 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00222 print_file_and_cons(fodat,1)
00223 leak_check(rssStart, rssEnd)
00224 ## -----------------------------------------------------------------------------
00225 fodat = "on_reset()"
00226 print_file_and_cons(fodat)
00227 
00228 for i in range(loop_cnt):
00229     # ComponentAction::on_reset(in ExecutionContextHandle_t exec_handle)
00230     compo0.rtc_ref.on_reset(ec_id)
00231 
00232     if i == 0:
00233         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00234         fodat = "   %05d: %s KB start" % (1, rss0)
00235         print_file_and_cons(fodat,1)
00236     rss1 = mem_rss() ; j1 = i
00237     if rss0 != rss1:
00238         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00239         print_file_and_cons(fodat,1)
00240         rss0 = rss1 ; j0 = j1
00241 
00242 rssEnd = mem_rss()
00243 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00244 print_file_and_cons(fodat,1)
00245 leak_check(rssStart, rssEnd)
00246 ## -----------------------------------------------------------------------------
00247 fodat = "is_alive()"
00248 print_file_and_cons(fodat)
00249 
00250 for i in range(loop_cnt):
00251     # LightweightRTObject::is_alive(in ExecutionContext exec_context)
00252     compo0.rtc_ref.is_alive(ec[0])
00253 
00254     if i == 0:
00255         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00256         fodat = "   %05d: %s KB start" % (1, rss0)
00257         print_file_and_cons(fodat,1)
00258     rss1 = mem_rss() ; j1 = i
00259     if rss0 != rss1:
00260         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00261         print_file_and_cons(fodat,1)
00262         rss0 = rss1 ; j0 = j1
00263 
00264 rssEnd = mem_rss()
00265 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00266 print_file_and_cons(fodat,1)
00267 leak_check(rssStart, rssEnd)
00268 ## -----------------------------------------------------------------------------
00269 fodat = "get_context()"
00270 print_file_and_cons(fodat)
00271 
00272 for i in range(loop_cnt):
00273     # LightweightRTObject::get_context(in ExecutionContextHandle_t exec_handle)
00274     compo0.rtc_ref.get_context(ec_id)
00275 
00276     if i == 0:
00277         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00278         fodat = "   %05d: %s KB start" % (1, rss0)
00279         print_file_and_cons(fodat,1)
00280     rss1 = mem_rss() ; j1 = i
00281     if rss0 != rss1:
00282         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00283         print_file_and_cons(fodat,1)
00284         rss0 = rss1 ; j0 = j1
00285 
00286 rssEnd = mem_rss()
00287 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00288 print_file_and_cons(fodat,1)
00289 leak_check(rssStart, rssEnd)
00290 ## -----------------------------------------------------------------------------
00291 fodat = "get_owned_contexts()"
00292 print_file_and_cons(fodat)
00293 
00294 for i in range(loop_cnt):
00295     # LightweightRTObject::get_owned_contexts()
00296     compo0.rtc_ref.get_owned_contexts()
00297 
00298     if i == 0:
00299         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00300         fodat = "   %05d: %s KB start" % (1, rss0)
00301         print_file_and_cons(fodat,1)
00302     rss1 = mem_rss() ; j1 = i
00303     if rss0 != rss1:
00304         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00305         print_file_and_cons(fodat,1)
00306         rss0 = rss1 ; j0 = j1
00307 
00308 rssEnd = mem_rss()
00309 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00310 print_file_and_cons(fodat,1)
00311 leak_check(rssStart, rssEnd)
00312 ## -----------------------------------------------------------------------------
00313 fodat = "get_participating_contexts()"
00314 print_file_and_cons(fodat)
00315 
00316 for i in range(loop_cnt):
00317     # LightweightRTObject::get_participating_contexts()
00318     compo0.rtc_ref.get_participating_contexts()
00319 
00320     if i == 0:
00321         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00322         fodat = "   %05d: %s KB start" % (1, rss0)
00323         print_file_and_cons(fodat,1)
00324     rss1 = mem_rss() ; j1 = i
00325     if rss0 != rss1:
00326         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00327         print_file_and_cons(fodat,1)
00328         rss0 = rss1 ; j0 = j1
00329 
00330 rssEnd = mem_rss()
00331 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00332 print_file_and_cons(fodat,1)
00333 leak_check(rssStart, rssEnd)
00334 ## -----------------------------------------------------------------------------
00335 fodat = "get_context_handle()"
00336 print_file_and_cons(fodat)
00337 
00338 for i in range(loop_cnt):
00339     # LightweightRTObject::get_context_handle(in ExecutionContext cxt)
00340     compo0.rtc_ref.get_context_handle(ec[0])
00341 
00342     if i == 0:
00343         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00344         fodat = "   %05d: %s KB start" % (1, rss0)
00345         print_file_and_cons(fodat,1)
00346     rss1 = mem_rss() ; j1 = i
00347     if rss0 != rss1:
00348         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00349         print_file_and_cons(fodat,1)
00350         rss0 = rss1 ; j0 = j1
00351 
00352 rssEnd = mem_rss()
00353 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00354 print_file_and_cons(fodat,1)
00355 leak_check(rssStart, rssEnd)
00356 ## -----------------------------------------------------------------------------
00357 fodat = "is_running()"
00358 print_file_and_cons(fodat)
00359 
00360 for i in range(loop_cnt):
00361     # ExecutionContext::is_running()
00362     ec[0].is_running()
00363 
00364     if i == 0:
00365         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00366         fodat = "   %05d: %s KB start" % (1, rss0)
00367         print_file_and_cons(fodat,1)
00368     rss1 = mem_rss() ; j1 = i
00369     if rss0 != rss1:
00370         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00371         print_file_and_cons(fodat,1)
00372         rss0 = rss1 ; j0 = j1
00373 
00374 rssEnd = mem_rss()
00375 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00376 print_file_and_cons(fodat,1)
00377 leak_check(rssStart, rssEnd)
00378 ## -----------------------------------------------------------------------------
00379 fodat = "start()"
00380 print_file_and_cons(fodat)
00381 
00382 for i in range(loop_cnt):
00383     # ExecutionContext::start()
00384     ec[0].start()
00385 
00386     if i == 0:
00387         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00388         fodat = "   %05d: %s KB start" % (1, rss0)
00389         print_file_and_cons(fodat,1)
00390     rss1 = mem_rss() ; j1 = i
00391     if rss0 != rss1:
00392         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00393         print_file_and_cons(fodat,1)
00394         rss0 = rss1 ; j0 = j1
00395 
00396 rssEnd = mem_rss()
00397 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00398 print_file_and_cons(fodat,1)
00399 leak_check(rssStart, rssEnd)
00400 ## -----------------------------------------------------------------------------
00401 fodat = "stop()"
00402 print_file_and_cons(fodat)
00403 
00404 for i in range(loop_cnt):
00405     # ExecutionContext::stop()
00406     ec[0].stop()
00407 
00408     if i == 0:
00409         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00410         fodat = "   %05d: %s KB start" % (1, rss0)
00411         print_file_and_cons(fodat,1)
00412     rss1 = mem_rss() ; j1 = i
00413     if rss0 != rss1:
00414         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00415         print_file_and_cons(fodat,1)
00416         rss0 = rss1 ; j0 = j1
00417 
00418 rssEnd = mem_rss()
00419 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00420 print_file_and_cons(fodat,1)
00421 leak_check(rssStart, rssEnd)
00422 ## -----------------------------------------------------------------------------
00423 fodat = "get_rate()"
00424 print_file_and_cons(fodat)
00425 
00426 for i in range(loop_cnt):
00427     # ExecutionContext::get_rate()
00428     ec[0].get_rate()
00429 
00430     if i == 0:
00431         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00432         fodat = "   %05d: %s KB start" % (1, rss0)
00433         print_file_and_cons(fodat,1)
00434     rss1 = mem_rss() ; j1 = i
00435     if rss0 != rss1:
00436         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00437         print_file_and_cons(fodat,1)
00438         rss0 = rss1 ; j0 = j1
00439 
00440 rssEnd = mem_rss()
00441 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00442 print_file_and_cons(fodat,1)
00443 leak_check(rssStart, rssEnd)
00444 ## -----------------------------------------------------------------------------
00445 fodat = "set_rate()"
00446 print_file_and_cons(fodat)
00447 
00448 for i in range(loop_cnt):
00449     # ExecutionContext::set_rate(in double rate)
00450     ec[0].set_rate(1.23456)
00451 
00452     if i == 0:
00453         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00454         fodat = "   %05d: %s KB start" % (1, rss0)
00455         print_file_and_cons(fodat,1)
00456     rss1 = mem_rss() ; j1 = i
00457     if rss0 != rss1:
00458         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00459         print_file_and_cons(fodat,1)
00460         rss0 = rss1 ; j0 = j1
00461 
00462 rssEnd = mem_rss()
00463 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00464 print_file_and_cons(fodat,1)
00465 leak_check(rssStart, rssEnd)
00466 ## -----------------------------------------------------------------------------
00467 fodat = "activate_component()"
00468 print_file_and_cons(fodat)
00469 
00470 for i in range(loop_cnt):
00471     # ExecutionContext::activate_component(in LightweightRTObject comp)
00472     ec[0].activate_component(compo0.rtc_ref)
00473 
00474     if i == 0:
00475         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00476         fodat = "   %05d: %s KB start" % (1, rss0)
00477         print_file_and_cons(fodat,1)
00478     rss1 = mem_rss() ; j1 = i
00479     if rss0 != rss1:
00480         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00481         print_file_and_cons(fodat,1)
00482         rss0 = rss1 ; j0 = j1
00483 
00484 rssEnd = mem_rss()
00485 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00486 print_file_and_cons(fodat,1)
00487 leak_check(rssStart, rssEnd)
00488 ## -----------------------------------------------------------------------------
00489 fodat = "deactivate_component()"
00490 print_file_and_cons(fodat)
00491 
00492 for i in range(loop_cnt):
00493     # ExecutionContext::deactivate_component(in LightweightRTObject comp)
00494     ec[0].deactivate_component(compo0.rtc_ref)
00495 
00496     if i == 0:
00497         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00498         fodat = "   %05d: %s KB start" % (1, rss0)
00499         print_file_and_cons(fodat,1)
00500     rss1 = mem_rss() ; j1 = i
00501     if rss0 != rss1:
00502         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00503         print_file_and_cons(fodat,1)
00504         rss0 = rss1 ; j0 = j1
00505 
00506 rssEnd = mem_rss()
00507 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00508 print_file_and_cons(fodat,1)
00509 leak_check(rssStart, rssEnd)
00510 ## -----------------------------------------------------------------------------
00511 fodat = "reset_component()"
00512 print_file_and_cons(fodat)
00513 
00514 for i in range(loop_cnt):
00515     # ExecutionContext::reset_component(in LightweightRTObject comp)
00516     ec[0].reset_component(compo0.rtc_ref)
00517 
00518     if i == 0:
00519         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00520         fodat = "   %05d: %s KB start" % (1, rss0)
00521         print_file_and_cons(fodat,1)
00522     rss1 = mem_rss() ; j1 = i
00523     if rss0 != rss1:
00524         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00525         print_file_and_cons(fodat,1)
00526         rss0 = rss1 ; j0 = j1
00527 
00528 rssEnd = mem_rss()
00529 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00530 print_file_and_cons(fodat,1)
00531 leak_check(rssStart, rssEnd)
00532 ## -----------------------------------------------------------------------------
00533 ec[0].activate_component(compo0.rtc_ref)
00534 
00535 fodat = "get_component_state()"
00536 print_file_and_cons(fodat)
00537 
00538 for i in range(loop_cnt):
00539     # ExecutionContext::get_component_state(in LightweightRTObject comp)
00540     ec[0].get_component_state(compo0.rtc_ref)
00541 
00542     if i == 0:
00543         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00544         fodat = "   %05d: %s KB start" % (1, rss0)
00545         print_file_and_cons(fodat,1)
00546     rss1 = mem_rss() ; j1 = i
00547     if rss0 != rss1:
00548         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00549         print_file_and_cons(fodat,1)
00550         rss0 = rss1 ; j0 = j1
00551 
00552 rssEnd = mem_rss()
00553 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00554 print_file_and_cons(fodat,1)
00555 leak_check(rssStart, rssEnd)
00556 ## -----------------------------------------------------------------------------
00557 fodat = "get_kind()"
00558 print_file_and_cons(fodat)
00559 
00560 for i in range(loop_cnt):
00561     # ExecutionContext::get_kind()
00562     ec[0].get_kind()
00563 
00564     if i == 0:
00565         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00566         fodat = "   %05d: %s KB start" % (1, rss0)
00567         print_file_and_cons(fodat,1)
00568     rss1 = mem_rss() ; j1 = i
00569     if rss0 != rss1:
00570         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00571         print_file_and_cons(fodat,1)
00572         rss0 = rss1 ; j0 = j1
00573 
00574 rssEnd = mem_rss()
00575 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00576 print_file_and_cons(fodat,1)
00577 leak_check(rssStart, rssEnd)
00578 ## -----------------------------------------------------------------------------
00579 fodat = "on_execute()"
00580 print_file_and_cons(fodat)
00581 
00582 for i in range(loop_cnt):
00583     # DataFlowComponentAction::on_execute(in ExecutionContextHandle_t exec_handle)
00584     compo0.rtc_ref.on_execute(ec_id)
00585 
00586     if i == 0:
00587         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00588         fodat = "   %05d: %s KB start" % (1, rss0)
00589         print_file_and_cons(fodat,1)
00590     rss1 = mem_rss() ; j1 = i
00591     if rss0 != rss1:
00592         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00593         print_file_and_cons(fodat,1)
00594         rss0 = rss1 ; j0 = j1
00595 
00596 rssEnd = mem_rss()
00597 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00598 print_file_and_cons(fodat,1)
00599 leak_check(rssStart, rssEnd)
00600 ## -----------------------------------------------------------------------------
00601 fodat = "on_state_update()"
00602 print_file_and_cons(fodat)
00603 
00604 for i in range(loop_cnt):
00605     # DataFlowComponentAction::on_state_update(in ExecutionContextHandle_t exec_handle)
00606     compo0.rtc_ref.on_state_update(ec_id)
00607 
00608     if i == 0:
00609         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00610         fodat = "   %05d: %s KB start" % (1, rss0)
00611         print_file_and_cons(fodat,1)
00612     rss1 = mem_rss() ; j1 = i
00613     if rss0 != rss1:
00614         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00615         print_file_and_cons(fodat,1)
00616         rss0 = rss1 ; j0 = j1
00617 
00618 rssEnd = mem_rss()
00619 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00620 print_file_and_cons(fodat,1)
00621 leak_check(rssStart, rssEnd)
00622 ## -----------------------------------------------------------------------------
00623 fodat = "on_rate_changed()"
00624 print_file_and_cons(fodat)
00625 
00626 for i in range(loop_cnt):
00627     # DataFlowComponentAction::on_rate_changed(in ExecutionContextHandle_t exec_handle)
00628     compo0.rtc_ref.on_rate_changed(ec_id)
00629 
00630     if i == 0:
00631         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00632         fodat = "   %05d: %s KB start" % (1, rss0)
00633         print_file_and_cons(fodat,1)
00634     rss1 = mem_rss() ; j1 = i
00635     if rss0 != rss1:
00636         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00637         print_file_and_cons(fodat,1)
00638         rss0 = rss1 ; j0 = j1
00639 
00640 rssEnd = mem_rss()
00641 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00642 print_file_and_cons(fodat,1)
00643 leak_check(rssStart, rssEnd)
00644 ## -----------------------------------------------------------------------------
00645 fodat = "get_profile()"
00646 print_file_and_cons(fodat)
00647 
00648 for i in range(loop_cnt):
00649     # ExecutionContextService::get_profile()
00650     ec[0].get_profile()
00651 
00652     if i == 0:
00653         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00654         fodat = "   %05d: %s KB start" % (1, rss0)
00655         print_file_and_cons(fodat,1)
00656     rss1 = mem_rss() ; j1 = i
00657     if rss0 != rss1:
00658         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00659         print_file_and_cons(fodat,1)
00660         rss0 = rss1 ; j0 = j1
00661 
00662 rssEnd = mem_rss()
00663 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00664 print_file_and_cons(fodat,1)
00665 leak_check(rssStart, rssEnd)
00666 ## -----------------------------------------------------------------------------
00667 fodat = "get_component_profile()"
00668 print_file_and_cons(fodat)
00669 
00670 for i in range(loop_cnt):
00671     # RTObject::get_component_profile()
00672     compo0.rtc_ref.get_component_profile()
00673 
00674     if i == 0:
00675         rss0 = mem_rss() ; j0 = 0 ; rssStart = rss0
00676         fodat = "   %05d: %s KB start" % (1, rss0)
00677         print_file_and_cons(fodat,1)
00678     rss1 = mem_rss() ; j1 = i
00679     if rss0 != rss1:
00680         fodat = "   %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
00681         print_file_and_cons(fodat,1)
00682         rss0 = rss1 ; j0 = j1
00683 
00684 rssEnd = mem_rss()
00685 fodat = "   %05d: %s KB end" % (i+1, rssEnd)
00686 print_file_and_cons(fodat,1)
00687 leak_check(rssStart, rssEnd)
00688 ## -----------------------------------------------------------------------------
00689 ec[0].deactivate_component(compo0.rtc_ref)
00690 
00691 fodat = "=== " + test_case + " end ==="
00692 print_file_and_cons(fodat)
00693 fout.close()


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sun Mar 26 2017 03:37:17