• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PerfEntityMetricBase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vmware.vim25.PerfEntityMetricBase的典型用法代码示例。如果您正苦于以下问题:Java PerfEntityMetricBase类的具体用法?Java PerfEntityMetricBase怎么用?Java PerfEntityMetricBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PerfEntityMetricBase类属于com.vmware.vim25包,在下文中一共展示了PerfEntityMetricBase类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: displayValues

import com.vmware.vim25.PerfEntityMetricBase; //导入依赖的package包/类
static void displayValues(PerfEntityMetricBase[] values)
{
  for(int i=0; i<values.length; ++i) 
  {
    String entityDesc = values[i].getEntity().getType() 
        + ":" + values[i].getEntity().get_value();
    System.out.println("Entity:" + entityDesc);
    if(values[i] instanceof PerfEntityMetric)
    {
      printPerfMetric((PerfEntityMetric)values[i]);
    }
    else if(values[i] instanceof PerfEntityMetricCSV)
    {
      printPerfMetricCSV((PerfEntityMetricCSV)values[i]);
    }
    else
    {
      System.out.println("UnExpected sub-type of " +
      		"PerfEntityMetricBase.");
    }
  }
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:23,代码来源:RealtimePerfMonitor.java


示例2: printPerfMetric

import com.vmware.vim25.PerfEntityMetricBase; //导入依赖的package包/类
static void printPerfMetric(PerfEntityMetricBase val)
{
  String entityDesc = val.getEntity().getType() 
      + ":" + val.getEntity().get_value();
  System.out.println("Entity:" + entityDesc);
  if(val instanceof PerfEntityMetric)
  {
    printPerfMetric((PerfEntityMetric)val);
  }
  else if(val instanceof PerfEntityMetricCSV)
  {
    printPerfMetricCSV((PerfEntityMetricCSV)val);
  }
  else
  {
    System.out.println("UnExpected sub-type of " +
    		"PerfEntityMetricBase.");
  }
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:20,代码来源:GetMultiPerf.java


示例3: querySingleEntity

import com.vmware.vim25.PerfEntityMetricBase; //导入依赖的package包/类
/**
 * See <a href="https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.PerformanceManager.html#queryStats">queryStats method</a>
 * @param ctx
 * @return
 * @throws RuntimeFaultFaultMsg
 */
private List<ServiceStat> querySingleEntity(StatCollectionContext ctx)
        throws RuntimeFaultFaultMsg {
    List<PerfEntityMetricBase> metrics = getVimPort().queryPerf(PERF_MGR_MOREF,
            Collections.singletonList(ctx.getSpec()));

    List<ServiceStat> res = new ArrayList<>();

    if (metrics.isEmpty()) {
        // nothing fetched
        return Collections.emptyList();
    }

    // the metrics for the single entity
    PerfEntityMetric m = (PerfEntityMetric) metrics.get(0);

    for (PerfMetricSeries pms : m.getValue()) {
        PerfMetricId metricId = pms.getId();
        PerfMetricIntSeries series = (PerfMetricIntSeries) pms;
        SamplesAggregator factory = ctx.getFactory(metricId.getCounterId());

        PerfCounterInfo counter = this.perfCounterLookup
                .getCounterByKey(metricId.getCounterId());

        ServiceStat stat = factory.createStat(counter, m.getSampleInfo(), series.getValue());
        if (stat != null) {
            res.add(stat);
        }
    }

    return res;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:38,代码来源:StatsClient.java


示例4: main

import com.vmware.vim25.PerfEntityMetricBase; //导入依赖的package包/类
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);
  }
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:51,代码来源:RealtimePerfMonitor.java


示例5: main

import com.vmware.vim25.PerfEntityMetricBase; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
  if(args.length != 4)
  {
    System.out.println("Usage: java GetMultiPerf " 
      + "<url> <username> <password> <vmname>");
    return;
  }

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

  String vmname = args[3];
  VirtualMachine vm = (VirtualMachine) 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();

  int perfInterval = 1800; // 30 minutes for PastWeek
  
  // retrieve all the available perf metrics for vm
  PerfMetricId[] pmis = perfMgr.queryAvailablePerfMetric(
      vm, null, null, perfInterval);
  
  Calendar curTime = si.currentTime();
  
  PerfQuerySpec qSpec = new PerfQuerySpec();
  qSpec.setEntity(vm.getRuntime().getHost());
  //metricIDs must be provided, or InvalidArgumentFault 
  qSpec.setMetricId(pmis);
  qSpec.setFormat("normal"); //optional since it's default
  qSpec.setIntervalId(perfInterval); 

  Calendar startTime = (Calendar) curTime.clone();
  startTime.roll(Calendar.DATE, -4);
  System.out.println("start:" + startTime.getTime());
  qSpec.setStartTime(startTime);
  
  Calendar endTime = (Calendar) curTime.clone();
  endTime.roll(Calendar.DATE, -3);
  System.out.println("end:" + endTime.getTime());
  qSpec.setEndTime(endTime);
  
  PerfCompositeMetric pv = perfMgr.queryPerfComposite(qSpec);
  if(pv != null)
  {
    printPerfMetric(pv.getEntity());
    PerfEntityMetricBase[] pembs = pv.getChildEntity();
    for(int i=0; pembs!=null && i< pembs.length; i++)
    {
      printPerfMetric(pembs[i]);
    }
  }
  si.getServerConnection().logout();
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:65,代码来源:GetMultiPerf.java


示例6: queryPerformanceValues

import com.vmware.vim25.PerfEntityMetricBase; //导入依赖的package包/类
/**
 * This method queries performance values for a given managed entity.
 *
 * @param managedEntity the managed entity to query
 * @return the perfomance values
 * @throws RemoteException
 */
public VmwarePerformanceValues queryPerformanceValues(ManagedEntity managedEntity) throws RemoteException {

    VmwarePerformanceValues vmwarePerformanceValues = new VmwarePerformanceValues();

    int refreshRate = getPerformanceManager().queryPerfProviderSummary(managedEntity).getRefreshRate();

    PerfQuerySpec perfQuerySpec = new PerfQuerySpec();
    perfQuerySpec.setEntity(managedEntity.getMOR());
    perfQuerySpec.setMaxSample(Integer.valueOf(1));

    perfQuerySpec.setIntervalId(refreshRate);

    PerfEntityMetricBase[] perfEntityMetricBases = getPerformanceManager().queryPerf(new PerfQuerySpec[]{perfQuerySpec});

    if (perfEntityMetricBases != null) {
        for (int i = 0; i < perfEntityMetricBases.length; i++) {
            PerfMetricSeries[] perfMetricSeries = ((PerfEntityMetric) perfEntityMetricBases[i]).getValue();

            for (int j = 0; perfMetricSeries != null && j < perfMetricSeries.length; j++) {

                if (perfMetricSeries[j] instanceof PerfMetricIntSeries) {
                    long[] longs = ((PerfMetricIntSeries) perfMetricSeries[j]).getValue();

                    if (longs.length == 1) {

                        PerfCounterInfo perfCounterInfo = getPerfCounterInfoMap().get(perfMetricSeries[j].getId().getCounterId());
                        String instance = perfMetricSeries[j].getId().getInstance();
                        String name = getHumanReadableName(perfCounterInfo);

                        if (instance != null && !"".equals(instance)) {
                            vmwarePerformanceValues.addValue(name, instance, longs[0]);
                        } else {
                            vmwarePerformanceValues.addValue(name, longs[0]);
                        }
                    }
                }
            }
        }
    }

    return vmwarePerformanceValues;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:50,代码来源:VmwareViJavaAccess.java


示例7: queryPerf

import com.vmware.vim25.PerfEntityMetricBase; //导入依赖的package包/类
public List<PerfEntityMetricBase> queryPerf(PerfQuerySpec[] specs) throws Exception {
    return _context.getService().queryPerf(_mor, Arrays.asList(specs));
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:4,代码来源:PerfManagerMO.java


示例8: queryPerf

import com.vmware.vim25.PerfEntityMetricBase; //导入依赖的package包/类
List<PerfEntityMetricBase> queryPerf(List<PerfQuerySpec> querySpec) throws RuntimeFault, RemoteException; 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:2,代码来源:PerformanceManagerApi.java



注:本文中的com.vmware.vim25.PerfEntityMetricBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EditableWSDLOperation类代码示例发布时间:2022-05-23
下一篇:
Java SQLInListExpr类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap