Package java.lang.management

Examples of java.lang.management.MemoryUsage


      throw new IllegalArgumentException(HFILE_CACHE_SIZE_KEY +
        " must be between 0.0 and 1.0, not > 1.0");
    }

    // Calculate the amount of heap to give the heap.
    MemoryUsage mu = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
    long cacheSize = (long)(mu.getMax() * cachePercentage);
    LOG.info("Allocating LruBlockCache with maximum size " +
      StringUtils.humanReadableInt(cacheSize));
    hfileBlockCache = new LruBlockCache(cacheSize, DEFAULT_BLOCKSIZE_SMALL);
    return hfileBlockCache;
  }
View Full Code Here


    TreeMap<byte [], HServerLoad.RegionLoad> regionLoads =
      new TreeMap<byte [], HServerLoad.RegionLoad>(Bytes.BYTES_COMPARATOR);
    for (HRegion region: regions) {
      regionLoads.put(region.getRegionName(), createRegionLoad(region));
    }
    MemoryUsage memory =
      ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
    return new HServerLoad(requestCount.get(),(int)metrics.getRequests(),
      (int)(memory.getUsed() / 1024 / 1024),
      (int) (memory.getMax() / 1024 / 1024), regionLoads,
      this.hlog.getCoprocessorHost().getCoprocessors());
  }
View Full Code Here

        // Uptime
        long secondsUp = probe.getUptime() / 1000;
        outs.printf("%-17s: %d%n", "Uptime (seconds)", secondsUp);

        // Memory usage
        MemoryUsage heapUsage = probe.getHeapMemoryUsage();
        double memUsed = (double)heapUsage.getUsed() / (1024 * 1024);
        double memMax = (double)heapUsage.getMax() / (1024 * 1024);
        outs.printf("%-17s: %.2f / %.2f%n", "Heap Memory (MB)", memUsed, memMax);
    }
View Full Code Here

     threads(record);
     collector.add(record);
  }

  private void memory(final MetricsRecord record){
    MemoryUsage memNonHeap = memoryMXBean.getNonHeapMemoryUsage();
    MemoryUsage memHeap = memoryMXBean.getHeapMemoryUsage();
    record.add(new Metric(MemNonHeapUsedM, memNonHeap.getUsed() / M));
    record.add(new Metric(MemNonHeapCommittedM,
                           memNonHeap.getCommitted() / M));
    record.add(new Metric(MemHeapUsedM, memHeap.getUsed() / M));
    record.add(new Metric(MemHeapCommittedM, memHeap.getCommitted() / M));
  }
View Full Code Here

                {
                    articlesManager.updateArticle(article);
                    commit();
                } catch (SQLException e)
                {
                    MemoryUsage mu = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
                    System.out.println("Init=" + mu.getInit() + ", usage=" + mu.getUsed() + ", " +
                        "commited=" + mu.getCommitted() + ", max=" + mu.getMax());
                    rollback();
                    throw new PersistenceException(Strings.error("db.failed.to.update.article"), e);
                }
            }
        }
View Full Code Here

        // Uptime
        long secondsUp = probe.getUptime() / 1000;
        outs.printf("%-17s: %d%n", "Uptime (seconds)", secondsUp);

        // Memory usage
        MemoryUsage heapUsage = probe.getHeapMemoryUsage();
        double memUsed = (double)heapUsage.getUsed() / (1024 * 1024);
        double memMax = (double)heapUsage.getMax() / (1024 * 1024);
        outs.printf("%-17s: %.2f / %.2f%n", "Heap Memory (MB)", memUsed, memMax);

        // Data Center/Rack
        outs.printf("%-17s: %s%n", "Data Center", probe.getDataCenter());
        outs.printf("%-17s: %s%n", "Rack", probe.getRack());
View Full Code Here

        // Uptime
        long secondsUp = runtimeProxy.getUptime() / 1000;
        outs.println(String.format("%-17s: %d", "Uptime (seconds)", secondsUp));

        // Memory usage
        MemoryUsage heapUsage = memProxy.getHeapMemoryUsage();
        double memUsed = (double)heapUsage.getUsed() / (1024 * 1024);
        double memMax = (double)heapUsage.getMax() / (1024 * 1024);
        outs.println(String.format("%-17s: %.2f / %.2f", "Heap Memory (MB)", memUsed, memMax));
    }
View Full Code Here

    throws JMException
  {
    CompositeData data
      = (CompositeData) _mbeanServer.getAttribute(getCodeCacheName(), "Usage");

    MemoryUsage usage = MemoryUsage.from(data);

    return usage.getCommitted();
  }
View Full Code Here

    throws JMException
  {
    CompositeData data
      = (CompositeData) _mbeanServer.getAttribute(getCodeCacheName(), "Usage");

    MemoryUsage usage = MemoryUsage.from(data);

    return usage.getMax();
  }
View Full Code Here

    throws JMException
  {
    CompositeData data
      = (CompositeData) _mbeanServer.getAttribute(getCodeCacheName(), "Usage");

    MemoryUsage usage = MemoryUsage.from(data);

    return usage.getUsed();
  }
View Full Code Here

TOP

Related Classes of java.lang.management.MemoryUsage

Copyright © 2018 www.massapicom. 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.