Changeset 12403 in vbox for trunk/src/libs/xpcom18a4/python/sample
- Timestamp:
- Sep 11, 2008 12:28:30 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 36456
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/python/sample/shellcommon.py
r11991 r12403 97 97 return 'off' 98 98 99 def guestStats (ctx,guest):99 def guestStats2(ctx,guest): 100 100 stats = { 101 101 'Guest statistics for sample': ctx['ifaces'].GuestStatisticType.SampleNumber, … … 115 115 pass 116 116 117 def guestStats(ctx,mach): 118 collector = ctx['vb'].performanceCollector 119 collector.setupMetrics(['*'], [mach], 1, 15) 120 121 (vals, names, objs, idxs, lens) = collector.queryMetricsData(["*"], [mach]) 122 for i in range(0,len(names)): 123 valsStr = '[' 124 for j in range(0, lens[i]): 125 valsStr += str(vals[idxs[i]])+' ' 126 valsStr += ']' 127 print "Name:",names[i],"Vals:",valsStr 128 117 129 def cmdExistingVm(ctx,mach,cmd): 118 130 mgr=ctx['mgr'] … … 131 143 return 132 144 # unfortunately IGuest is suppressed, thus WebServices knows not about it 133 if ctx['remote'] and cmd == 'stats ':145 if ctx['remote'] and cmd == 'stats2': 134 146 print 'Trying to use local only functionality, ignored' 135 147 return … … 138 150 'resume': lambda: console.resume(), 139 151 'powerdown': lambda: console.powerDown(), 140 'stats': lambda: guestStats(ctx, console.guest), 152 # Guest stats not yet implemented 153 # 'stats2': lambda: guestStats2(ctx, console.guest), 154 # 'stats': lambda: guestStats(ctx, mach), 141 155 } 142 156 ops[cmd]() … … 264 278 print "Executing",expr 265 279 try: 266 #mach.BIOSSettings.IOAPICEnabled = True267 280 exec expr 268 281 except Exception, e: … … 297 310 298 311 (vals, names, objs, idxs, lens) = collector.queryMetricsData(["*"], [host]) 299 for i in range(0,len(vals)): 300 print "for name:",names[i]," val:",vals[i] 312 for i in range(0,len(names)): 313 valsStr = '[' 314 for j in range(0, lens[i]): 315 valsStr += str(vals[idxs[i]])+' ' 316 valsStr += ']' 317 print "Name:",names[i],"Vals:",valsStr 301 318 302 319 return 0 … … 314 331 'pause':['Pause virtual machine', pauseCmd], 315 332 'resume':['Resume virtual machine', resumeCmd], 333 # stats not yet well implemented 316 334 'stats':['Stats for virtual machine', statsCmd], 317 335 'powerdown':['Power down virtual machine', powerdownCmd], … … 338 356 339 357 def interpret(ctx): 340 print "Running VirtualBox version %s" %(ctx['vb'].version) 358 vbox = ctx['vb'] 359 print "Running VirtualBox version %s" %(vbox.version) 341 360 342 361 autoCompletion(commands, ctx) 343 362 363 # to allow to print actual host information, we collect infor for 364 # last 150 secs maximum, (sample every 10 secs and keep up to 15 samples) 365 vbox.performanceCollector.setupMetrics(['*'], [vbox.host], 10, 15) 366 344 367 while True: 345 368 try: … … 357 380 traceback.print_exc() 358 381 382 vbox.performanceCollector.disableMetrics(['*'], [vbox.host])
Note:
See TracChangeset
for help on using the changeset viewer.