Changeset 26583 in vbox
- Timestamp:
- Feb 16, 2010 3:11:22 PM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
-
Frontends/VBoxShell/vboxshell.py (modified) (7 diffs)
-
Main/glue/constants-python.xsl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r26571 r26583 295 295 return 'off' 296 296 297 def guestStats(ctx,mach):297 def perfStats(ctx,mach): 298 298 if not ctx['perf']: 299 299 return … … 381 381 else: 382 382 reportError(ctx,session,rc) 383 384 385 def guestStats(ctx,session,console,args): 386 guest = console.guest 387 # we need to set up guest statistics 388 if len(args) > 0 : 389 update = args[0] 390 else: 391 update = 1 392 if guest.statisticsUpdateInterval != update: 393 guest.statisticsUpdateInterval = update 394 try: 395 time.sleep(float(update)+0.1) 396 except: 397 # to allow sleep interruption 398 pass 399 all_stats = ctx['ifaces'].all_values('GuestStatisticType') 400 cpu = 0 401 for s in all_stats.keys(): 402 try: 403 val = guest.getStatistic( cpu, all_stats[s]) 404 print "%s: %d" %(s, val) 405 except: 406 # likely not implemented 407 pass 383 408 384 409 def cmdExistingVm(ctx,mach,cmd,args): … … 397 422 print "Session to '%s' in wrong state: %s" %(mach.name, session.state) 398 423 return 399 # unfortunately IGuest is suppressed, thus WebServices knows not about it400 # this is an example how to handle local onlyfunctionality401 if ctx['remote'] and cmd == 's tats2':424 # this could be an example how to handle local only (i.e. unavailable 425 # in Webservices) functionality 426 if ctx['remote'] and cmd == 'some_local_only_command': 402 427 print 'Trying to use local only functionality, ignored' 403 428 return … … 407 432 'powerdown': lambda: console.powerDown(), 408 433 'powerbutton': lambda: console.powerButton(), 409 'stats': lambda: guestStats(ctx, mach),434 'stats': lambda: perfStats(ctx, mach), 410 435 'guest': lambda: guestExec(ctx, mach, console, args), 411 436 'monitorGuest': lambda: monitorGuest(ctx, mach, console, args), 412 437 'save': lambda: progressBar(ctx,console.saveState()), 413 438 'screenshot': lambda: takeScreenshot(ctx,console,args), 414 'teleport': lambda: teleport(ctx,session,console,args) 439 'teleport': lambda: teleport(ctx,session,console,args), 440 'gueststats': lambda: guestStats(ctx, mach, console, args), 415 441 } 416 442 try: … … 747 773 return 0 748 774 775 def gueststatsCmd(ctx, args): 776 if (len(args) < 2): 777 print "usage: gueststats name <check interval>" 778 return 0 779 mach = argsToMach(ctx,args) 780 if mach == None: 781 return 0 782 cmdExistingVm(ctx, mach, 'gueststats', args[2:]) 783 return 0 784 749 785 750 786 def setvarCmd(ctx, args): … … 1129 1165 1130 1166 commands = {'help':['Prints help information', helpCmd, 0], 1131 'start':['Start virtual machine by name or uuid ', startCmd, 0],1167 'start':['Start virtual machine by name or uuid: start Linux', startCmd, 0], 1132 1168 'create':['Create virtual machine', createCmd, 0], 1133 1169 'remove':['Remove virtual machine', removeCmd, 0], … … 1161 1197 'closeportal':['Close teleportation portal (see openportal,teleport): closeportal Win', closeportalCmd, 0], 1162 1198 'getextra':['Get extra data, empty key lists all: getextra <vm|global> <key>', getExtraDataCmd, 0], 1163 'setextra':['Set extra data, empty value removes key: setextra <vm|global> <key> <value>', setExtraDataCmd, 0] 1199 'setextra':['Set extra data, empty value removes key: setextra <vm|global> <key> <value>', setExtraDataCmd, 0], 1200 'gueststats':['Print available guest stats (only Windows guests with additions so far): gueststats Win32', gueststatsCmd, 0], 1164 1201 } 1165 1202 -
trunk/src/VBox/Main/glue/constants-python.xsl
r22043 r26583 59 59 </xsl:for-each>} 60 60 61 _ValuesSym = {<xsl:for-each select="//enum"> 62 '<xsl:value-of select="@name"/>':{ 63 <xsl:for-each select="const">'<xsl:value-of select="@name"/>': '<xsl:value-of select="@name"/>'<xsl:if test="not(position()=last())">,</xsl:if> 64 </xsl:for-each>}<xsl:if test="not(position()=last())">,</xsl:if> 65 66 </xsl:for-each>} 67 61 68 _ValuesFlat = {<xsl:for-each select="//enum"> 62 69 <xsl:variable name="ename"> … … 92 99 raise AttributeError 93 100 101 def all_values(self,enum_name): 102 if self.isSym: 103 vals = self._ValuesSym.get(enum_name) 104 else: 105 vals = self._Values.get(enum_name) 106 if vals is not None: 107 return vals 108 else: 109 return {} 110 94 111 </xsl:template> 95 112 </xsl:stylesheet>
Note:
See TracChangeset
for help on using the changeset viewer.

