Java 类com.vmware.vim25.PerfProviderSummary 实例源码

项目:vijava    文件:RealtimePerfMonitor.java   
public static void main(String[] args) throws Exception
{
  if(args.length != 4)
  {
    System.out.println("Usage: java RealtimePerfMonitor " 
      + "<url> <username> <password> <vmname>");
    return;
  }

  ServiceInstance si = new ServiceInstance(
    new URL(args[0]), args[1], args[2], true);

  String vmname = args[3];
  ManagedEntity vm = new InventoryNavigator(
    si.getRootFolder()).searchManagedEntity(
      "VirtualMachine", vmname);

  if(vm == null)
  {
    System.out.println("Virtual Machine " + vmname 
        + " cannot be found.");
    si.getServerConnection().logout();
    return;
  }

  PerformanceManager perfMgr = si.getPerformanceManager();

  // find out the refresh rate for the virtual machine
  PerfProviderSummary pps = perfMgr.queryPerfProviderSummary(vm);
  int refreshRate = pps.getRefreshRate().intValue();

  // retrieve all the available perf metrics for vm
  PerfMetricId[] pmis = perfMgr.queryAvailablePerfMetric(
      vm, null, null, refreshRate);

  PerfQuerySpec qSpec = createPerfQuerySpec(
      vm, pmis, 3, refreshRate);

  while(true) 
  {
    PerfEntityMetricBase[] pValues = perfMgr.queryPerf(
      new PerfQuerySpec[] {qSpec});
    if(pValues != null)
    {
      displayValues(pValues);
    }
    System.out.println("Sleeping 60 seconds...");
    Thread.sleep(refreshRate*3*1000);
  }
}
项目:cloudstack    文件:PerfManagerMO.java   
public PerfProviderSummary queryPerfProviderSummary(ManagedObjectReference morEntity) throws Exception {
    return _context.getService().queryPerfProviderSummary(_mor, morEntity);
}
项目:jcloud-vsphere    文件:PerformanceManagerApi.java   
PerfProviderSummary queryPerfProviderSummary(ManagedEntity entity) throws RuntimeFault, RemoteException;