Index: /trunk/src/libs/xpcom18a4/python/sample/shellcommon.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/sample/shellcommon.py	(revision 12410)
+++ /trunk/src/libs/xpcom18a4/python/sample/shellcommon.py	(revision 12411)
@@ -86,4 +86,6 @@
     rc = progress.resultCode
     print "Completed:", completed, "rc:",rc
+    if rc == 0:
+        vb.performanceCollector.setupMetrics(['*'], [mach], 10, 15)
     session.close()
 
@@ -97,33 +99,13 @@
         return 'off'
 
-def guestStats2(ctx,guest):
-    stats = {
-        'Guest statistics for sample': ctx['ifaces'].GuestStatisticType.SampleNumber,
-        'CPU Load Idle': ctx['ifaces'].GuestStatisticType.CPULoad_Idle,
-        'CPU Load User': ctx['ifaces'].GuestStatisticType.CPULoad_User,
-        'CPU Load Kernel': ctx['ifaces'].GuestStatisticType.CPULoad_Kernel,
-        'Threads': ctx['ifaces'].GuestStatisticType.Threads,
-        'Processes': ctx['ifaces'].GuestStatisticType.Processes,
-        'Handles': ctx['ifaces'].GuestStatisticType.Handles,
-        }
-    for (k,v) in stats.items(): 
-        try:
-            val = guest.getStatistic(0, v)
-            print "'%s' = '%s'" %(k,str(v))
-        except:
-            print "Cannot get value for '%s'"  %(k)
-            pass
-
 def guestStats(ctx,mach):
     collector = ctx['vb'].performanceCollector
-    collector.setupMetrics(['*'], [mach], 1, 15)
-
     (vals, names, objs, idxs, lens) = collector.queryMetricsData(["*"], [mach])
     for i in range(0,len(names)):
-        valsStr = '['
+        valsStr = '[ '
         for j in range(0, lens[i]):
             valsStr += str(vals[idxs[i]])+' '
         valsStr += ']'
-        print "Name:",names[i],"Vals:",valsStr
+        print names[i],valsStr
 
 def cmdExistingVm(ctx,mach,cmd):
@@ -143,4 +125,5 @@
         return
     # unfortunately IGuest is suppressed, thus WebServices knows not about it
+    # this is an example how to handle local only functionality
     if ctx['remote'] and cmd == 'stats2':
         print 'Trying to use local only functionality, ignored'
@@ -150,7 +133,5 @@
          'resume':     lambda: console.resume(),
          'powerdown':  lambda: console.powerDown(),
-# Guest stats not yet implemented
-#         'stats2':      lambda: guestStats2(ctx, console.guest),
-#         'stats':      lambda: guestStats(ctx, mach),
+         'stats':      lambda: guestStats(ctx, mach),
          }
     ops[cmd]()
@@ -311,9 +292,9 @@
    (vals, names, objs, idxs, lens) = collector.queryMetricsData(["*"], [host])
    for i in range(0,len(names)):
-       valsStr = '['
+       valsStr = '[ '
        for j in range(0, lens[i]):
            valsStr += str(vals[idxs[i]])+' '
        valsStr += ']'
-       print "Name:",names[i],"Vals:",valsStr
+       print names[i],valsStr
 
    return 0
@@ -331,5 +312,4 @@
             'pause':['Pause virtual machine', pauseCmd],
             'resume':['Resume virtual machine', resumeCmd],
-# stats not yet well implemented
             'stats':['Stats for virtual machine', statsCmd],
             'powerdown':['Power down virtual machine', powerdownCmd],
@@ -361,5 +341,5 @@
     autoCompletion(commands, ctx)
 
-    # to allow to print actual host information, we collect infor for
+    # to allow to print actual host information, we collect info for
     # last 150 secs maximum, (sample every 10 secs and keep up to 15 samples)
     vbox.performanceCollector.setupMetrics(['*'], [vbox.host], 10, 15)
