Examples of Swap


Examples of org.apache.bcel.generic.SWAP

            if (type instanceof BasicType) {
                if (type.getSize() < 2 && !type.equals(Type.FLOAT)) {
                    type = Type.INT;
                }
                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
                insList.append(new SWAP()); // TODO: check for types with two words on stack
                insList.append(insFactory.createInvoke(STACK_CLASS, getPushMethod(type), Type.VOID, new Type[]{type}, Constants.INVOKEVIRTUAL));
            } else if (type == null) {
                insList.append(InstructionConstants.POP);
            } else if (type instanceof UninitializedObjectType) {
                // After the remove of new, there shouldn't be a
                // uninitialized object on the stack
            } else if (type instanceof ReferenceType) {
                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
                insList.append(new SWAP());
                insList.append(insFactory.createInvoke(STACK_CLASS, getPushMethod(Type.OBJECT), Type.VOID, new Type[]{Type.OBJECT}, Constants.INVOKEVIRTUAL));
            }
        }
        // add isCapturing test
        insList.insert(new IFEQ(handle.getNext()));
View Full Code Here

Examples of org.apache.bcel.generic.SWAP

        Type[] arguments = invoke.getArgumentTypes(method.getConstantPool());
        // pop all arguments for the constructor from the stack
        for (int i = arguments.length - 1; i >= 0; i--) {
            Type type = arguments[i];
            insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
            insList.append(new SWAP());
            if (type instanceof BasicType) {
                if (type.getSize() < 2 && !type.equals(Type.FLOAT)) {
                    type = Type.INT;
                }
                insList.append(insFactory.createInvoke(STACK_CLASS, getPushMethod(type), Type.VOID, new Type[]{type}, Constants.INVOKEVIRTUAL));
View Full Code Here

Examples of org.apache.bcel.generic.SWAP

            if (type instanceof BasicType) {
                if (type.getSize() < 2 && !type.equals(Type.FLOAT)) {
                    type = Type.INT;
                }
                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
                insList.append(new SWAP()); // TODO: check for types with two words on stack
                insList.append(insFactory.createInvoke(STACK_CLASS, getPushMethod(type), Type.VOID, new Type[]{type}, Constants.INVOKEVIRTUAL));
            } else if (type == null) {
                insList.append(InstructionConstants.POP);
            } else if (type instanceof UninitializedObjectType) {
                // After the remove of new, there shouldn't be a
                // uninitialized object on the stack
            } else if (type instanceof ReferenceType) {
                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
                insList.append(new SWAP());
                insList.append(insFactory.createInvoke(STACK_CLASS, getPushMethod(Type.OBJECT), Type.VOID, new Type[]{Type.OBJECT}, Constants.INVOKEVIRTUAL));
            }
        }
        // add isCapturing test
        insList.insert(new IFEQ(handle.getNext()));
View Full Code Here

Examples of org.hyperic.sigar.Swap

      Mem mem = sigar.getMem();
      status.setTotalMem(mem.getTotal() / (1024 * 1024));
      status.setUsedMem(mem.getUsed() / (1024 * 1024));
      status.setFreeMem(mem.getFree() / (1024 * 1024));
      // 交换区
      Swap swap = sigar.getSwap();
      status.setTotalSwap(swap.getTotal() / (1024 * 1024));
      status.setUsedSwap(swap.getUsed() / (1024 * 1024));
      status.setFreeSwap(swap.getFree() / (1024 * 1024));
    } catch (Exception e) {

    }
  }
View Full Code Here

Examples of org.hyperic.sigar.Swap

    @Test(enabled = ENABLED)
    public void testNativeMemory() throws Exception {
        Sigar sigar = new Sigar();
        try {
            Mem allMemory = sigar.getMem();
            Swap allSwap = sigar.getSwap();

            NumberFormat nf = NumberFormat.getNumberInstance();
            System.out.println("All Memory:" + "\nActualFreeMem=" + nf.format(allMemory.getActualFree())
                + "\nActualUsedMem=" + nf.format(allMemory.getActualUsed()) + "\n       RamMem="
                + nf.format(allMemory.getRam()) + "\n      FreeMem=" + nf.format(allMemory.getFree())
                + "\n      UsedMem=" + nf.format(allMemory.getUsed()) + "\n     TotalMem="
                + nf.format(allMemory.getTotal()) + "\n     FreeSwap=" + nf.format(allSwap.getFree())
                + "\n     UsedSwap=" + nf.format(allSwap.getUsed()) + "\n    TotalSwap="
                + nf.format(allSwap.getTotal()));
            assert allMemory.getActualFree() > 0 : allMemory.getActualFree();
            assert allMemory.getFree() > 0 : allMemory.getFree();
            assert allMemory.getTotal() > 1000000 : allMemory.getTotal();
            if (allSwap.getTotal()>0) {
                assert allSwap.getTotal() > 1000000 : allSwap.getTotal();
                assert allSwap.getFree() > 0 : allSwap.getFree();
            }

            ProcMem processMemory = sigar.getProcMem(sigar.getPid());

            System.out.println("Process Memory:" + "\n  MinorFaults=" + nf.format(processMemory.getMinorFaults())
View Full Code Here

Examples of org.hyperic.sigar.Swap

    public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) {
        SystemInfo info = this.resourceContext.getSystemInformation();
        boolean isNative = info.isNative();
        Mem platformMemoryInfo = null;
        Swap platformSwapInfo = null;
        CpuPerc cpuPerc = null;
        try {
            cpuPerc = SigarAccess.getSigar().getCpuPerc();
        } catch (Exception e) {
            // probably native api is unavailable, but getCpuPerc might also have a problem; in either case, nothing we can do
View Full Code Here

Examples of org.hyperic.sigar.Swap

        return new Long(value / 1024);
    }

    public void output(String[] args) throws SigarException {
        Mem mem   = this.sigar.getMem();
        Swap swap = this.sigar.getSwap();

        Object[] header = new Object[] { "total", "used", "free" };

        Object[] memRow = new Object[] {
            format(mem.getTotal()),
            format(mem.getUsed()),
            format(mem.getFree())
        };

        Object[] actualRow = new Object[] {
            format(mem.getActualUsed()),
            format(mem.getActualFree())
        };

        Object[] swapRow = new Object[] {
            format(swap.getTotal()),
            format(swap.getUsed()),
            format(swap.getFree())
        };

        printf("%18s %10s %10s", header);

        printf("Mem:    %10ld %10ld %10ld", memRow);
View Full Code Here

Examples of org.hyperic.sigar.Swap

    }

    public void testCreate() throws Exception {
        Sigar sigar = getSigar();

        Swap swap = sigar.getSwap();

        assertGtEqZeroTrace("Total", swap.getTotal());

        assertGtEqZeroTrace("Used", swap.getUsed());

        assertGtEqZeroTrace("Free", swap.getFree());

        assertEqualsTrace("Total-Used==Free",
                          swap.getTotal() - swap.getUsed(),
                          swap.getFree());

        traceln("PageIn=" + swap.getPageIn());
        traceln("PageOut=" + swap.getPageOut());
    }
View Full Code Here

Examples of org.hyperic.sigar.Swap

  private List<DataEntity> buildSwapInfo() {
    ArrayList<DataEntity> entities = new ArrayList<DataEntity>();

    try {
      Swap curSwap = m_sigar.getSwap();
      double totalSwap = curSwap.getTotal();
      double swapUsage = totalSwap > 0.0 ? curSwap.getFree() / totalSwap : 0.0;
      Map<String, Double> values = new HashMap<String, Double>();

      values.put(buildSystemId("swapUsage"), swapUsage);
      entities.addAll(buildEntities(values, AVG_TYPE));
    } catch (Exception e) {
View Full Code Here

Examples of org.hyperic.sigar.Swap

    }

    public void testCreate() throws Exception {
        Sigar sigar = getSigar();

        Swap swap = sigar.getSwap();

        assertGtEqZeroTrace("Total", swap.getTotal());

        assertGtEqZeroTrace("Used", swap.getUsed());

        assertGtEqZeroTrace("Free", swap.getFree());

        assertEqualsTrace("Total-Used==Free",
                          swap.getTotal() - swap.getUsed(),
                          swap.getFree());

        traceln("PageIn=" + swap.getPageIn());
        traceln("PageOut=" + swap.getPageOut());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.