Search in sources :

Example 1 with NumaNodeStatistics

use of org.ovirt.engine.core.common.businessentities.NumaNodeStatistics in project ovirt-engine by oVirt.

the class NumaStatisticalQuery method getStatistics.

@Override
public List<Statistic> getStatistics(VdsNumaNode entity) {
    NumaNodeStatistics s = entity.getNumaNodeStatistics();
    long memTotal = entity.getMemTotal();
    long memFree = (s == null) ? 0 : s.getMemFree();
    return asList(setDatum(clone(MEM_TOTAL), memTotal), setDatum(clone(MEM_USED), memTotal - memFree), setDatum(clone(MEM_FREE), memFree), setDatum(clone(CPU_USER), (s == null) ? 0 : s.getCpuUser()), setDatum(clone(CPU_SYS), (s == null) ? 0 : s.getCpuSys()), setDatum(clone(CPU_IDLE), (s == null) ? 0 : s.getCpuIdle()));
}
Also used : NumaNodeStatistics(org.ovirt.engine.core.common.businessentities.NumaNodeStatistics)

Example 2 with NumaNodeStatistics

use of org.ovirt.engine.core.common.businessentities.NumaNodeStatistics in project ovirt-engine by oVirt.

the class VmNumaNodeDaoTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    vmNumaNodeDao = dbFacade.getVmNumaNodeDao();
    newNodeStatistics = new NumaNodeStatistics();
    newNodeStatistics.setCpuUsagePercent(20);
    newNodeStatistics.setMemUsagePercent(50);
}
Also used : NumaNodeStatistics(org.ovirt.engine.core.common.businessentities.NumaNodeStatistics)

Example 3 with NumaNodeStatistics

use of org.ovirt.engine.core.common.businessentities.NumaNodeStatistics in project ovirt-engine by oVirt.

the class VdsNumaNodeDaoTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    vdsNumaNodeDao = dbFacade.getVdsNumaNodeDao();
    newNodeStatistics = new NumaNodeStatistics();
    newNodeStatistics.setCpuUsagePercent(20);
    newNodeStatistics.setMemUsagePercent(50);
}
Also used : NumaNodeStatistics(org.ovirt.engine.core.common.businessentities.NumaNodeStatistics)

Example 4 with NumaNodeStatistics

use of org.ovirt.engine.core.common.businessentities.NumaNodeStatistics in project ovirt-engine by oVirt.

the class VdsBrokerObjectsBuilder method buildVdsNumaNodeStatistics.

private static VdsNumaNode buildVdsNumaNodeStatistics(DecimalFormat percentageFormatter, Map.Entry<Integer, List<CpuStatistics>> item) {
    VdsNumaNode node = new VdsNumaNode();
    NumaNodeStatistics nodeStat = new NumaNodeStatistics();
    double nodeCpuUser = 0.0;
    double nodeCpuSys = 0.0;
    double nodeCpuIdle = 0.0;
    for (CpuStatistics cpuStat : item.getValue()) {
        nodeCpuUser += cpuStat.getCpuUser();
        nodeCpuSys += cpuStat.getCpuSys();
        nodeCpuIdle += cpuStat.getCpuIdle();
    }
    nodeStat.setCpuUser(Double.parseDouble(percentageFormatter.format(nodeCpuUser / item.getValue().size())));
    nodeStat.setCpuSys(Double.parseDouble(percentageFormatter.format(nodeCpuSys / item.getValue().size())));
    nodeStat.setCpuIdle(Double.parseDouble(percentageFormatter.format(nodeCpuIdle / item.getValue().size())));
    nodeStat.setCpuUsagePercent((int) (nodeStat.getCpuSys() + nodeStat.getCpuUser()));
    node.setIndex(item.getKey());
    node.setNumaNodeStatistics(nodeStat);
    return node;
}
Also used : VdsNumaNode(org.ovirt.engine.core.common.businessentities.VdsNumaNode) NumaNodeStatistics(org.ovirt.engine.core.common.businessentities.NumaNodeStatistics) CpuStatistics(org.ovirt.engine.core.common.businessentities.CpuStatistics)

Example 5 with NumaNodeStatistics

use of org.ovirt.engine.core.common.businessentities.NumaNodeStatistics in project ovirt-engine by oVirt.

the class NumaSettingFactoryTest method createTestVdsNumaNodes.

private static List<VdsNumaNode> createTestVdsNumaNodes() {
    NumaNodeStatistics newNodeStatistics = new NumaNodeStatistics();
    newNodeStatistics.setCpuUsagePercent(20);
    newNodeStatistics.setMemUsagePercent(50);
    List<VdsNumaNode> newVdsNodes = new ArrayList<>();
    VdsNumaNode newVdsNumaNode = new VdsNumaNode();
    newVdsNumaNode.setCpuIds(generateCpuList(0, 4));
    newVdsNumaNode.setId(Guid.newGuid());
    newVdsNumaNode.setIndex(0);
    newVdsNumaNode.setNumaNodeDistances(generateDistance(2, 0));
    newVdsNumaNode.setNumaNodeStatistics(newNodeStatistics);
    newVdsNodes.add(newVdsNumaNode);
    newVdsNumaNode = new VdsNumaNode();
    newVdsNumaNode.setCpuIds(generateCpuList(4, 4));
    newVdsNumaNode.setId(Guid.newGuid());
    newVdsNumaNode.setIndex(1);
    newVdsNumaNode.setNumaNodeDistances(generateDistance(2, 1));
    newVdsNumaNode.setNumaNodeStatistics(newNodeStatistics);
    newVdsNodes.add(newVdsNumaNode);
    return newVdsNodes;
}
Also used : VdsNumaNode(org.ovirt.engine.core.common.businessentities.VdsNumaNode) NumaNodeStatistics(org.ovirt.engine.core.common.businessentities.NumaNodeStatistics) ArrayList(java.util.ArrayList)

Aggregations

NumaNodeStatistics (org.ovirt.engine.core.common.businessentities.NumaNodeStatistics)5 VdsNumaNode (org.ovirt.engine.core.common.businessentities.VdsNumaNode)2 ArrayList (java.util.ArrayList)1 CpuStatistics (org.ovirt.engine.core.common.businessentities.CpuStatistics)1