Changeset 19239 in vbox for trunk/src/VBox/Frontends/VBoxShell/shellcommon.py
- Timestamp:
- Apr 28, 2009 1:19:14 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 46627
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxShell/shellcommon.py
r18693 r19239 177 177 # we ignore exceptions to allow starting VM even if 178 178 # perf collector cannot be started 179 try: 179 if perf: 180 try: 180 181 perf.setup(['*'], [mach], 10, 15) 181 except:182 except Exception,e: 182 183 print e 183 184 if g_verbose: … … 192 193 193 194 def getMachines(ctx): 194 return ctx['vb'].getMachines() 195 # XPCOM brigde has trouble with array attributes 196 if ctx['type'] == 'xpcom': 197 return ctx['vb'].getMachines() 198 else: 199 return ctx['vb'].machines 195 200 196 201 def asState(var): … … 201 206 202 207 def guestStats(ctx,mach): 208 if not ctx['perf']: 209 return 203 210 for metric in ctx['perf'].query(["*"], [mach]): 204 211 print metric['name'], metric['values_as_string'] … … 427 434 print "Processor #%d speed: %dMHz" %(i,host.getProcessorSpeed(i)) 428 435 429 for metric in ctx['perf'].query(["*"], [host]): 436 if ctx['perf']: 437 for metric in ctx['perf'].query(["*"], [host]): 430 438 print metric['name'], metric['values_as_string'] 431 439 … … 488 496 print "Running VirtualBox version %s" %(vbox.version) 489 497 490 ctx['perf'] = PerfCollector(vbox) 498 # MSCOM doesn't work with collector yet 499 if ctx['type'] != 'mscom': 500 ctx['perf'] = PerfCollector(vbox) 501 else: 502 ctx['perf'] = None 491 503 492 504 autoCompletion(commands, ctx) … … 494 506 # to allow to print actual host information, we collect info for 495 507 # last 150 secs maximum, (sample every 10 secs and keep up to 15 samples) 496 try: 508 if ctx['perf']: 509 try: 497 510 ctx['perf'].setup(['*'], [vbox.host], 10, 15) 498 except:511 except: 499 512 pass 500 513 … … 516 529 try: 517 530 # There is no need to disable metric collection. This is just an example. 518 ctx['perf'].disable(['*'], [vbox.host]) 531 if ct['perf']: 532 ctx['perf'].disable(['*'], [vbox.host]) 519 533 except: 520 534 pass
Note:
See TracChangeset
for help on using the changeset viewer.