本文整理了Java中org.jclouds.compute.domain.Hardware.getProcessors()
方法的一些代码示例,展示了Hardware.getProcessors()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hardware.getProcessors()
方法的具体详情如下:
包路径:org.jclouds.compute.domain.Hardware
类名称:Hardware
方法名:getProcessors
[英]Amount of virtual or physical processors provided
[中]提供的虚拟或物理处理器数量
代码示例来源:origin: jclouds/legacy-jclouds
public static double getCores(Hardware input) {
double cores = 0;
for (Processor processor : input.getProcessors())
cores += processor.getCores();
return cores;
}
代码示例来源:origin: io.cloudsoft.jclouds/jclouds-compute
public static double getCores(Hardware input) {
double cores = 0;
for (Processor processor : input.getProcessors())
cores += processor.getCores();
return cores;
}
代码示例来源:origin: org.apache.jclouds/jclouds-compute
public static double getCores(Hardware input) {
double cores = 0;
for (Processor processor : input.getProcessors())
cores += processor.getCores();
return cores;
}
代码示例来源:origin: apache/jclouds
public static double getCores(Hardware input) {
double cores = 0;
for (Processor processor : input.getProcessors())
cores += processor.getCores();
return cores;
}
代码示例来源:origin: org.apache.jclouds.karaf/commands
protected double getCpuCores(Hardware hardware) {
int nb = 0;
for (Processor p : hardware.getProcessors()) {
nb += p.getCores();
}
return nb;
}
代码示例来源:origin: jclouds/legacy-jclouds
public static double getCoresAndSpeed(Hardware input) {
double total = 0;
for (Processor processor : input.getProcessors())
total += processor.getCores() * processor.getSpeed();
return total;
}
代码示例来源:origin: org.apache.jclouds/jclouds-compute
public static double getCoresAndSpeed(Hardware input) {
double total = 0;
for (Processor processor : input.getProcessors())
total += processor.getCores() * processor.getSpeed();
return total;
}
代码示例来源:origin: io.cloudsoft.jclouds/jclouds-compute
public static double getCoresAndSpeed(Hardware input) {
double total = 0;
for (Processor processor : input.getProcessors())
total += processor.getCores() * processor.getSpeed();
return total;
}
代码示例来源:origin: org.apache.jclouds.karaf/commands
protected double getCpuUnits(Hardware hardware) {
double nb = 0;
for (Processor p : hardware.getProcessors()) {
nb += p.getCores() * p.getSpeed();
}
return nb;
}
代码示例来源:origin: apache/jclouds
public static double getCoresAndSpeed(Hardware input) {
double total = 0;
for (Processor processor : input.getProcessors())
total += processor.getCores() * processor.getSpeed();
return total;
}
代码示例来源:origin: apache/jclouds
@Test
public void machineTypeParserTest() {
URI uri = URI.create("https://www.googleapis.com/compute/v1/projects/jclouds-dev/zones/asia-east1-a/machineTypes/custom-1-1024");
Hardware hardware = machineTypeURIToCustomHardware(uri);
assertThat(hardware.getRam()).isEqualTo(1024);
assertThat(hardware.getProcessors().get(0).getCores()).isEqualTo(1);
assertThat(hardware.getUri())
.isEqualTo(URI.create("https://www.googleapis.com/compute/v1/projects/jclouds-dev/zones/asia-east1-a/machineTypes/custom-1-1024"));
assertThat(hardware.getId())
.isEqualTo("https://www.googleapis.com/compute/v1/projects/jclouds-dev/zones/asia-east1-a/machineTypes/custom-1-1024");
}
代码示例来源:origin: apache/jclouds
@Test
public void testVirtualGuestToHardware() {
VirtualGuest virtualGuest = createVirtualGuest();
Hardware hardware = new VirtualGuestToHardware().apply(virtualGuest);
assertNotNull(hardware);
assertEquals(hardware.getRam(), virtualGuest.getMaxMemory());
assertTrue(hardware.getProcessors().size() == 1);
assertEquals(Iterables.get(hardware.getProcessors(), 0).getCores(), (double) virtualGuest.getStartCpus());
}
代码示例来源:origin: apache/jclouds
@Test(dataProvider = "onlyIfAutomaticHardwareSupported", groups = {"integration", "live"})
public void testAutoGeneratedHardwareFromId() {
Template template = view.getComputeService().templateBuilder()
.hardwareId("automatic:cores=2;ram=1024").build();
assertThat(template.getHardware().getId()).isEqualTo("automatic:cores=2.0;ram=1024");
assertThat(template.getHardware().getRam()).isEqualTo(1024);
assertThat(template.getHardware().getProcessors().get(0).getCores()).isEqualTo(2);
}
代码示例来源:origin: apache/jclouds
@Override
@Test(dataProvider = "onlyIfAutomaticHardwareSupported", groups = {"integration", "live"})
public void testAutoGeneratedHardwareFromId() {
Template template = view.getComputeService().templateBuilder()
.hardwareId("automatic:cores=2;ram=1024").build();
assertThat(template.getHardware().getId()).isEqualTo(template.getLocation()
.getDescription() + "/machineTypes/custom-2-1024");
assertThat(template.getHardware().getRam()).isEqualTo(1024);
assertThat(template.getHardware().getProcessors().get(0).getCores()).isEqualTo(2);
assertThat(template.getHardware().getUri()).isEqualTo(URI.create(template.getLocation()
.getDescription() + "/machineTypes/custom-2-1024"));
}
代码示例来源:origin: apache/jclouds
@Test(dataProvider = "onlyIfAutomaticHardwareSupported", groups = {"integration", "live"})
public void testAutoGeneratedHardwareWithOnlyMinCoresMatchHardwareProfile() {
if (!view.getComputeService().listHardwareProfiles().isEmpty()) {
Template template = view.getComputeService().templateBuilder().minCores(4).build();
assertThat(AutomaticHardwareIdSpec.isAutomaticId(template.getHardware().getId())).isFalse();
assertThat(template.getHardware().getProcessors().get(0).getCores()).isGreaterThanOrEqualTo(4);
}
else {
throw new SkipException("Hardware profile list is empty, this provider can not match any hardware profile" +
"to the specified minRam and minCores.");
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-locations-jclouds
@Test(groups={"Live", "Live-sanity"})
public void testJcloudsCreateWithHardwareProfiles() throws Exception {
// default minRam is 1gb
obtainMachine();
assertTrue(template.getHardware().getRam() >= 1000, "template="+template);
assertEquals(template.getHardware().getId(), G1_SMALL_HARDWARE_ID_LONG_FORM, "template="+template);
obtainMachine(MutableMap.of(JcloudsLocationConfig.MIN_RAM, "4096"));
assertTrue(template.getHardware().getRam() >= 4096, "template="+template);
assertEquals(template.getHardware().getId(), N1_STANDARD_2_HARDWARE_ID_LONG_FORM, "template="+template);
obtainMachine(MutableMap.of(JcloudsLocationConfig.MIN_CORES, "4"));
assertTrue(template.getHardware().getProcessors().get(0).getCores() >= 4, "template="+template);
assertEquals(template.getHardware().getId(), N1_HIGHCPU_4_HARDWARE_ID_LONG_FORM, "template="+template);
}
代码示例来源:origin: jclouds/legacy-jclouds
@SuppressWarnings("unchecked")
public static HardwareBuilder fromHardware(Hardware in) {
return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name(
in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors(
List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes()))
.supportsImage(in.supportsImage()).hypervisor(in.getHypervisor());
}
}
代码示例来源:origin: io.cloudsoft.jclouds/jclouds-compute
@SuppressWarnings("unchecked")
public static HardwareBuilder fromHardware(Hardware in) {
return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name(
in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors(
List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes()))
.supportsImage(in.supportsImage()).hypervisor(in.getHypervisor());
}
}
代码示例来源:origin: org.apache.jclouds/jclouds-compute
@SuppressWarnings("unchecked")
public static HardwareBuilder fromHardware(Hardware in) {
return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name(
in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors(
List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes()))
.supportsImage(in.supportsImage()).hypervisor(in.getHypervisor());
}
}
代码示例来源:origin: apache/jclouds
@SuppressWarnings("unchecked")
public static HardwareBuilder fromHardware(Hardware in) {
return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name(
in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors(
List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes()))
.supportsImage(in.supportsImage()).hypervisor(in.getHypervisor());
}
}
内容来源于网络,如有侵权,请联系作者删除!