static void Test_ListVMStatistics(Host host, string uuid)
        {
            XenConnect      conn = new XenConnect(host, testServerId, testip);
            List <VcpuInfo> info = null;

            conn.listVmStats(uuid, out info);
        }
        private void updatePerformance(Host host)
        {
            XenConnect conn = new XenConnect(host, Settings.SystemIdentifier, Settings.SystemIp);

            foreach (KeyValuePair <string, VM> kvp in host.VMList)
            {
                VM vm = kvp.Value;
                if (vm.PowerState == vm_state.Shutoff)
                {
                    continue;
                }
                List <VcpuInfo> cpuinfo = null;
                conn.listVmStats(vm.UUID, out cpuinfo);
                if (cpuinfo == null)
                {
                    continue;
                }

                int   cpuCount = 0;
                ulong cpuTime  = 0;

                foreach (VcpuInfo info in cpuinfo)
                {
                    cpuCount++;
                    cpuTime += info.CpuTime;
                }

                listview_performance.Items.Add(new UserControl1(cpuCount, cpuTime, vm.Name));
            }
        }
 public void updateVMCpuInfo()
 {
     foreach (KeyValuePair <string, Host> entry in _hostList)
     {
         Host host = entry.Value;
         foreach (KeyValuePair <string, VM> vmentry in host.VMList)
         {
             VM vm = vmentry.Value;
             if (!(vm.PowerState == vm_state.Running))
             {
                 continue;
             }
             XenConnect      connect = new XenConnect(host, "VMAX", "172.16.10.76"); //TODO: Unhardcode me please!
             List <VcpuInfo> info    = null;
             connect.listVmStats(vm.UUID, out info);
             if (info == null)
             {
                 continue;
             }
             Application.Current.Dispatcher.Invoke((Action) delegate
             {
                 vm.updateVcpuStats(info);
             });
             Thread.Sleep(1000);
         }
     }
 }