List of usage examples for java.lang.management MemoryUsage getUsed
public long getUsed()
From source file:com.chinamobile.bcbsp.comm.ProducerTool.java
/** Run method of Thread. */ public final void run() { while (true) { while (this.idle) { if (this.completed) { return; }/*from ww w . ja va 2s .com*/ if (this.noMoreMessagesFlag) { this.superStepCounter++; this.noMoreMessagesFlag = false; // LOG.info("Test Progress: from " + (this.superStepCounter - 1) + // " to " + this.superStepCounter); } try { Thread.sleep(this.sleepTime); } catch (InterruptedException e) { LOG.error("[ProducerTool] to " + this.hostNameAndPort + " has been interrupted for ", e); return; } } if (this.hostNameAndPort == null) { LOG.error("Destination hostname is null."); return; } if (this.messageQueue == null) { LOG.error("Message queue for ProducerTool is null."); return; } this.messageCount = 0; this.connectTime = 0; this.sendTime = 0; while (true) { if (this.reconnectCount == ProducerTool.RECONNECTTHRESHOLD) { break; } try { if (this.newHostNameAndPort) { // Should create new connection. if (connection != null) { try { connection.close(); } catch (Throwable ignore) { LOG.warn("[ConsumerTool] run connection " + ignore); } } long start = System.currentTimeMillis(); /** Clock */ // Make the destination broker's url. this.url = "tcp://" + this.hostNameAndPort; // Create the connection. // ActiveMQConnectionFactory connectionFactory = new // ActiveMQConnectionFactory( // user, password, url); BSPActiveMQConnFactory connectionFactory = new BSPActiveMQConnFactoryImpl(); connectionFactory.activeMQConnFactoryMethod(url); connectionFactory.setCopyMessageOnSend(false); connection = connectionFactory.createConnection(); connection.start(); // Create the session session = connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE); this.connectTime += (System.currentTimeMillis() - start); /* Clock */ this.newHostNameAndPort = false; start = System.currentTimeMillis(); /* Clock */ destination = session.createQueue(subject); // Create the producer. producer = session.createProducer(destination); if (persistent) { producer.setDeliveryMode(DeliveryMode.PERSISTENT); } else { producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); } if (timeToLive != 0) { producer.setTimeToLive(timeToLive); } this.connectTime += (System.currentTimeMillis() - start); } // Start sending messages sendLoopOptimistic(session, producer); this.idle = true; break; } catch (Exception e) { this.reconnectCount++; if (this.reconnectCount == 1) { LOG.error("[ProducerTool] to " + this.hostNameAndPort + " caught: ", e); } LOG.info("[ProducerTool] to " + this.hostNameAndPort + " is reconnecting for " + this.reconnectCount + "th time."); LOG.info("---------------- Memory Info ------------------"); MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); MemoryUsage memoryUsage = memoryMXBean.getHeapMemoryUsage(); long used = memoryUsage.getUsed(); long committed = memoryUsage.getCommitted(); LOG.info("[JVM Memory used] = " + used / MB_SIZE + "MB"); LOG.info("[JVM Memory committed] = " + committed / MB_SIZE + "MB"); LOG.info("-----------------------------------------------"); try { Thread.sleep(this.sleepTime); } catch (InterruptedException e1) { LOG.error("[ProducerTool] caught: ", e1); } } } LOG.info("[ProducerTool] to " + this.hostNameAndPort + " has sent " + this.messageCount + " messages totally! (with " + this.messageQueue.size() + " messages lost!)"); this.sender.addConnectTime(this.connectTime); /* Clock */ this.sender.addSendTime(this.sendTime); /* Clock */ if (this.reconnectCount == ProducerTool.RECONNECTTHRESHOLD) { LOG.info("[ProducerTool] to " + this.hostNameAndPort + " has reconnected for " + this.reconnectCount + " times but failed!"); this.isFailed = true; break; } } }
From source file:org.artifactory.webapp.wicket.page.config.advanced.SystemInfoPage.java
/** * Return a formatted string of the system info to display * * @return/* w w w . java 2 s . c o m*/ */ private String collectSystemInfo() { StringBuilder infoBuilder = new StringBuilder(); StorageProperties storageProperties = ContextHelper.get().beanForType(StorageProperties.class); infoBuilder.append("Storage Info:").append("\n"); addInfo(infoBuilder, "Database Type", storageProperties.getDbType().toString()); BinaryProviderType binariesStorageType = storageProperties.getBinariesStorageType(); addInfo(infoBuilder, "Storage Type", binariesStorageType.toString()); if (BinaryProviderType.S3 == binariesStorageType) { // S3 properties addInfo(infoBuilder, "s3.bucket.name", storageProperties.getS3BucketName()); addInfo(infoBuilder, "s3.bucket.path", storageProperties.getS3BucketPath()); addInfo(infoBuilder, "s3.endpoint", storageProperties.getS3Entpoint()); // Retry properties addInfo(infoBuilder, "retry.max.retries.number", Integer.toString(storageProperties.getMaxRetriesNumber())); addInfo(infoBuilder, "retry.delay.between.retries", Integer.toString(storageProperties.getDelayBetweenRetries())); // Eventually persisted properties addInfo(infoBuilder, "eventually.persisted.max.number.of.threads", Integer.toString(storageProperties.getEventuallyPersistedMaxNumberOfThread())); addInfo(infoBuilder, "eventually.persisted.timeout", Integer.toString(storageProperties.getEventuallyPersistedTimeOut())); addInfo(infoBuilder, "eventually.dispatcher.sleep.time", Long.toString(storageProperties.getEventuallyPersistedDispatcherSleepTime())); } infoBuilder.append("\n").append("System Properties:").append("\n"); Properties properties = System.getProperties(); //// add Artifactory version to the properties, will be alphabetically sorted later. properties.setProperty(ConstantValues.artifactoryVersion.getPropertyName(), ConstantValues.artifactoryVersion.getString()); AddonsManager addonsManager = ContextHelper.get().beanForType(AddonsManager.class); addInfo(infoBuilder, "artifactory.running.mode", addonsManager.getArtifactoryRunningMode().name()); addInfo(infoBuilder, "artifactory.running.state", ContextHelper.get().isOffline() ? "Offline" : "Online"); addFromProperties(infoBuilder, properties); addHaProperties(infoBuilder); infoBuilder.append("\n").append("General JVM Info:").append("\n"); OperatingSystemMXBean systemBean = ManagementFactory.getOperatingSystemMXBean(); addInfo(infoBuilder, "Available Processors", Integer.toString(systemBean.getAvailableProcessors())); MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean(); MemoryUsage heapMemoryUsage = memoryBean.getHeapMemoryUsage(); addInfo(infoBuilder, "Heap Memory Usage-Committed", Long.toString(heapMemoryUsage.getCommitted())); addInfo(infoBuilder, "Heap Memory Usage-Init", Long.toString(heapMemoryUsage.getInit())); addInfo(infoBuilder, "Heap Memory Usage-Max", Long.toString(heapMemoryUsage.getMax())); addInfo(infoBuilder, "Heap Memory Usage-Used", Long.toString(heapMemoryUsage.getUsed())); MemoryUsage nonHeapMemoryUsage = memoryBean.getNonHeapMemoryUsage(); addInfo(infoBuilder, "Non-Heap Memory Usage-Committed", Long.toString(nonHeapMemoryUsage.getCommitted())); addInfo(infoBuilder, "Non-Heap Memory Usage-Init", Long.toString(nonHeapMemoryUsage.getInit())); addInfo(infoBuilder, "Non-Heap Memory Usage-Max", Long.toString(nonHeapMemoryUsage.getMax())); addInfo(infoBuilder, "Non-Heap Memory Usage-Used", Long.toString(nonHeapMemoryUsage.getUsed())); RuntimeMXBean RuntimemxBean = ManagementFactory.getRuntimeMXBean(); StringBuilder vmArgumentBuilder = new StringBuilder(); List<String> vmArguments = RuntimemxBean.getInputArguments(); if (vmArguments != null) { for (String vmArgument : vmArguments) { if (InfoWriter.shouldMaskValue(vmArgument)) { vmArgument = Strings.maskKeyValue(vmArgument); } vmArgumentBuilder.append(vmArgument); if (vmArguments.indexOf(vmArgument) != (vmArguments.size() - 1)) { vmArgumentBuilder.append("\n"); } } } infoBuilder.append("\nJVM Arguments:\n").append(vmArgumentBuilder.toString()); return StringUtils.removeEnd(infoBuilder.toString(), "\n"); }
From source file:org.helios.netty.jmx.MetricCollector.java
/** * Generates a {@link JSONObject} representing memory usage, plus the percentage usage of:<ul> * <li>Memory Allocated</li> * <li>Memory Maximum Capacity</li> * </ul>/*from ww w . j av a 2 s. c om*/ * @param usage The memory usage provided by the {@link MemoryMXBean} * @return A {@link JSONObject} * @throws JSONException I have no idea why this would be thrown */ protected JSONObject processMemoryUsage(MemoryUsage usage) throws JSONException { JSONObject json = new JSONObject(usage); json.put("consumed(%)", calcPercent(usage.getUsed(), usage.getCommitted())); json.put("capacity(%)", calcPercent(usage.getUsed(), usage.getMax())); return json; }
From source file:org.apache.hadoop.hbase.regionserver.metrics.RegionServerMetrics.java
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb = Strings.appendKeyValue(sb, "requestsPerSecond", Integer.valueOf((int) this.requests.getPreviousIntervalValue())); sb = Strings.appendKeyValue(sb, "numberOfOnlineRegions", Integer.valueOf(this.regions.get())); sb = Strings.appendKeyValue(sb, "numberOfStores", Integer.valueOf(this.stores.get())); sb = Strings.appendKeyValue(sb, "numberOfStorefiles", Integer.valueOf(this.storefiles.get())); sb = Strings.appendKeyValue(sb, this.storefileIndexSizeMB.getName(), Integer.valueOf(this.storefileIndexSizeMB.get())); sb = Strings.appendKeyValue(sb, "rootIndexSizeKB", Integer.valueOf(this.rootIndexSizeKB.get())); sb = Strings.appendKeyValue(sb, "totalStaticIndexSizeKB", Integer.valueOf(this.totalStaticIndexSizeKB.get())); sb = Strings.appendKeyValue(sb, "totalStaticBloomSizeKB", Integer.valueOf(this.totalStaticBloomSizeKB.get())); sb = Strings.appendKeyValue(sb, this.memstoreSizeMB.getName(), Integer.valueOf(this.memstoreSizeMB.get())); sb = Strings.appendKeyValue(sb, "mbInMemoryWithoutWAL", Integer.valueOf(this.mbInMemoryWithoutWAL.get())); sb = Strings.appendKeyValue(sb, "numberOfPutsWithoutWAL", Long.valueOf(this.numPutsWithoutWAL.get())); sb = Strings.appendKeyValue(sb, "readRequestsCount", Long.valueOf(this.readRequestsCount.get())); sb = Strings.appendKeyValue(sb, "writeRequestsCount", Long.valueOf(this.writeRequestsCount.get())); sb = Strings.appendKeyValue(sb, "compactionQueueSize", Integer.valueOf(this.compactionQueueSize.get())); sb = Strings.appendKeyValue(sb, "flushQueueSize", Integer.valueOf(this.flushQueueSize.get())); // Duplicate from jvmmetrics because metrics are private there so // inaccessible. MemoryUsage memory = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage(); sb = Strings.appendKeyValue(sb, "usedHeapMB", Long.valueOf(memory.getUsed() / MB)); sb = Strings.appendKeyValue(sb, "maxHeapMB", Long.valueOf(memory.getMax() / MB)); sb = Strings.appendKeyValue(sb, this.blockCacheSize.getName() + "MB", StringUtils.limitDecimalTo2((float) this.blockCacheSize.get() / MB)); sb = Strings.appendKeyValue(sb, this.blockCacheFree.getName() + "MB", StringUtils.limitDecimalTo2((float) this.blockCacheFree.get() / MB)); sb = Strings.appendKeyValue(sb, this.blockCacheCount.getName(), Long.valueOf(this.blockCacheCount.get())); sb = Strings.appendKeyValue(sb, this.blockCacheHitCount.getName(), Long.valueOf(this.blockCacheHitCount.get())); sb = Strings.appendKeyValue(sb, this.blockCacheMissCount.getName(), Long.valueOf(this.blockCacheMissCount.get())); sb = Strings.appendKeyValue(sb, this.blockCacheEvictedCount.getName(), Long.valueOf(this.blockCacheEvictedCount.get())); sb = Strings.appendKeyValue(sb, this.blockCacheHitRatio.getName(), Long.valueOf(this.blockCacheHitRatio.get()) + "%"); sb = Strings.appendKeyValue(sb, this.blockCacheHitCachingRatio.getName(), Long.valueOf(this.blockCacheHitCachingRatio.get()) + "%"); sb = Strings.appendKeyValue(sb, this.hdfsBlocksLocalityIndex.getName(), Long.valueOf(this.hdfsBlocksLocalityIndex.get())); sb = Strings.appendKeyValue(sb, "slowHLogAppendCount", Long.valueOf(this.slowHLogAppendCount.get())); sb = appendHistogram(sb, this.fsReadLatencyHistogram); sb = appendHistogram(sb, this.fsPreadLatencyHistogram); sb = appendHistogram(sb, this.fsWriteLatencyHistogram); return sb.toString(); }
From source file:controllers.api.core.RootApiController.java
/** * Return some information regarding the memory status of the instance. *//*from w ww .ja v a 2 s .c o m*/ @ApiAuthentication(onlyRootKey = true) public Result instanceMemoryStatus() { try { RootResponse response = new RootResponse(); response.attributes = new HashMap<String, JsonNode>(); List<MemoryPoolMXBean> mbeans = ManagementFactory.getMemoryPoolMXBeans(); if (mbeans != null) { for (MemoryPoolMXBean mbean : mbeans) { System.out.println(mbean.getName()); MemoryUsage memUsage = mbean.getUsage(); HashMap<String, Long> memoryUsageAsMap = new HashMap<String, Long>(); memoryUsageAsMap.put("init", memUsage.getInit()); memoryUsageAsMap.put("max", memUsage.getMax()); memoryUsageAsMap.put("committed", memUsage.getCommitted()); memoryUsageAsMap.put("used", memUsage.getUsed()); response.attributes.put(mbean.getName(), Json.toJson(memoryUsageAsMap)); } } return getJsonSuccessResponse(response); } catch (Exception e) { return getJsonErrorResponse(new ApiError(500, "INTERNAL SERVER ERROR", e)); } }
From source file:fr.tpt.atlanalyser.examples.ExampleRunner.java
public void executePost2Pre(File postFile, int maxNumRuleIterations) throws IOException { // checkDirs(); inputMM = getInputMMEPkg();//from w w w. ja v a2 s . co m outputMM = getOutputMMEPkg(); makeAbstractClassesInstantiable(inputMM); makeAbstractClassesInstantiable(outputMM); Module transfo = loadHenshinTransformation(); EcoreUtil.resolveAll(transfo); EPackage traceMM = resourceSet.getPackageRegistry().getEPackage("http://traces/1.0"); stripFromAttributes(transfo); Resource postRes = resourceSet.getResource(URI.createFileURI(postFile.getCanonicalPath()), true); Module postModule = (Module) postRes.getContents().get(0); EList<Unit> units = postModule.getUnits(); List<Formula> postconditions = Lists.transform(units, new Function<Unit, Formula>() { @Override public Formula apply(Unit arg0) { return ((Rule) arg0).getLhs().getFormula(); } }); Module preModule = HenshinFactory.eINSTANCE.createModule(); preModule.setName("Preconditions"); LOGGER.info("Starting Post2Pre for {}", transfo.getName()); Post2Pre4ATL post2Pre = new Post2Pre4ATL(transfo, inputMM, outputMM, traceMM, jobs); ScheduledExecutorService memMonitorExecutor = Executors.newScheduledThreadPool(1); memMonitorExecutor.scheduleAtFixedRate(new Runnable() { private final MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean(); private final Logger LOGGER = LogManager.getLogger("MemMon"); @Override public void run() { // LOGGER.setAdditivity(false); // for (Enumeration iterator = // AGGWrapper.LOGGER.getAllAppenders(); iterator // .hasMoreElements();) { // Appender appender = (Appender) iterator.nextElement(); // LOGGER.addAppender(appender); // } MemoryUsage heapUsage = memoryBean.getHeapMemoryUsage(); final long used = heapUsage.getUsed(); double usedGB = (double) used / (1 << 30); final long max = heapUsage.getMax(); double maxGB = (double) max / (1 << 30); LOGGER.info(String.format("Memory use : %6.3fGB of %6.3fGB (%.2f%%)", usedGB, maxGB, (float) used / max * 100)); } }, 0, 10, TimeUnit.SECONDS); try { for (Formula formula : postconditions) { Formula pre = post2Pre.post2Pre(formula, maxNumRuleIterations); Rule preRule = HenshinFactory.eINSTANCE.createRule(); Graph preLhs = HenshinFactory.eINSTANCE.createGraph(); preLhs.setFormula(EcoreUtil.copy(pre)); preRule.setLhs(preLhs); preModule.getUnits().add(preRule); } } finally { memMonitorExecutor.shutdown(); } File outputDir = new File(baseDir, "Preconditions"); if (!outputDir.isDirectory()) { outputDir.mkdir(); } Resource outputRes = resourceSet .createResource(URI.createFileURI("Preconditions/" + postFile.getName() + "_pre.henshin")); outputRes.getContents().add(preModule); LOGGER.info("Writing Precondition in {}", outputRes.getURI().toString()); outputRes.save(xmiSaveOptions); LOGGER.info("Done!"); }
From source file:com.knowbout.cc2nlp.server.CCEventServiceImpl.java
private void checkStats() { long timestamp = new Date().getTime(); String day = getFileDate(timestamp); if (!day.equals(currentDay)) { if (statsFile != null) { statsFile.println("</table></body></html>"); statsFile.close();//from ww w . ja v a 2 s .co m statsFile = null; } currentDay = day; } if (hostname == null) { try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { hostname = "UnknownHost"; } } String dirname = documentRoot + "/stats/" + currentDay + "/" + hostname; String statsFileName = dirname + "/nlpprocstats.html"; int interval = 5; // minutes try { if (statsFile == null) { File dir = new File(dirname); if ((!dir.exists()) && (!dir.mkdirs())) { throw new IOException("Error creating directory " + dirname); } File file = new File(statsFileName); if (file.exists()) { statsFile = new PrintStream(new FileOutputStream(statsFileName, true)); statsFile.println("<tr><td colspan='5'>Restart</td></tr>"); } else { statsFile = new PrintStream(new FileOutputStream(statsFileName)); String title = "NLP Process (tomcat) status for " + currentDay; statsFile.println("<html><head><title>" + title + "</title></head>"); statsFile.println("<body><h1>" + title + "</h1>"); statsFile.println("<table border='1'>"); statsFile.println("<tr>"); statsFile.println( "<th colspan='2'>" + interval + " Minute Intervals</th><th colspan='3'>Memory</th>"); statsFile.println("</tr>"); statsFile.println("<tr>"); statsFile.println("<th>Timestamp</th>"); statsFile.println("<th>Time</th>"); statsFile.println("<th>Used</th>"); statsFile.println("<th>Committed</th>"); statsFile.println("<th>Max<th>"); statsFile.println("</tr>"); } } if ((timestamp - lastWrite) > (interval * 60 * 1000)) { lastWrite = timestamp; Calendar cal = Calendar.getInstance(); cal.setTimeZone(TimeZone.getTimeZone("GMT")); cal.setTimeInMillis(timestamp); String time = String.format("%1$tH:%1$tM:%1$tS", cal); MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean(); MemoryUsage memory = memoryBean.getHeapMemoryUsage(); statsFile.print("<tr>"); statsFile.print("<td>" + timestamp + "</td>"); statsFile.print("<td>" + time + "</td>"); statsFile.format("<td>%,d</td>", memory.getUsed()); statsFile.format("<td>%,d</td>", memory.getCommitted()); statsFile.format("<td>%,d</td>", memory.getMax()); statsFile.println("</tr>"); } } catch (IOException e) { log.error("Error opening or writing to " + statsFileName, e); } }
From source file:org.apache.cassandra.tools.NodeCmd.java
/** * Write node information./*from w w w. j a v a 2 s. co m*/ * * @param outs the stream to write to */ public void printInfo(PrintStream outs) { boolean gossipInitialized = probe.isInitialized(); outs.println(probe.getToken()); outs.printf("%-17s: %s%n", "Gossip active", gossipInitialized); outs.printf("%-17s: %s%n", "Load", probe.getLoadString()); if (gossipInitialized) outs.printf("%-17s: %s%n", "Generation No", probe.getCurrentGenerationNumber()); else outs.printf("%-17s: %s%n", "Generation No", 0); // 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); }
From source file:org.wso2.carbon.cassandra.cluster.mgt.query.ClusterMBeanServiceHandler.java
public NodeInformation getNodeInfo() throws ClusterDataAdminException { clusterStorageMBeanService = ClusterMBeanProxy.getClusterStorageMBeanService(); clusterEndpointSnitchMBeanService = ClusterMBeanProxy.getClusterEndpointSnitchMBeanService(); clusterCacheMBeanService = ClusterMBeanProxy.getClusterCacheMBeanService(); clusterRuntimeMXBeanService = ClusterMBeanProxy.getRuntimeMXBeanService(); clusterMemoryMXBeanService = ClusterMBeanProxy.getClusterMemoryMXBeanService(); NodeInformation nodeInformation = new NodeInformation(); boolean gossipInitialized = clusterStorageMBeanService.isInitialized(); nodeInformation.setToken(clusterStorageMBeanService.getToken()); nodeInformation.setGossipState(gossipInitialized); nodeInformation.setThriftState(clusterStorageMBeanService.getRPCServerStatus()); nodeInformation.setLoad(clusterStorageMBeanService.getLoadString()); if (gossipInitialized) nodeInformation.setGenerationNo(clusterStorageMBeanService.getCurrentGenerationNumber()); else/* w w w .j a va 2 s. co m*/ nodeInformation.setGenerationNo(0); // Uptime long secondsUp = clusterRuntimeMXBeanService.getUptime() / 1000; nodeInformation.setUptime(secondsUp); // Memory usage MemoryUsage heapUsage = clusterMemoryMXBeanService.getHeapMemoryUsage(); HeapMemory heapMemory = new HeapMemory(); double memUsed = (double) heapUsage.getUsed() / (1024 * 1024); double memMax = (double) heapUsage.getMax() / (1024 * 1024); heapMemory.setMaxMemory(memMax); heapMemory.setUseMemory(memUsed); nodeInformation.setHeapMemory(heapMemory); // Data Center/Rack try { nodeInformation.setDataCenter( clusterEndpointSnitchMBeanService.getDataCenter(clusterStorageMBeanService.getEndpoint())); nodeInformation .setRack(clusterEndpointSnitchMBeanService.getRack(clusterStorageMBeanService.getEndpoint())); } catch (UnknownHostException e) { throw new ClusterDataAdminException("Host is unknown when retrieving node info", e, log); } // Exceptions nodeInformation.setExceptions(clusterStorageMBeanService.getExceptionCount()); CacheProperties keyCacheProperties = new CacheProperties(); CacheProperties rowCacheProperties = new CacheProperties(); // Key Cache: Hits, Requests, RecentHitRate, SavePeriodInSeconds keyCacheProperties.setCacheSize(clusterCacheMBeanService.getKeyCacheSize()); keyCacheProperties.setCacheCapacity(clusterCacheMBeanService.getKeyCacheCapacityInBytes()); keyCacheProperties.setCacheHits(clusterCacheMBeanService.getKeyCacheHits()); keyCacheProperties.setCacheRequests(clusterCacheMBeanService.getKeyCacheRequests()); keyCacheProperties.setCacheRecentHitRate(clusterCacheMBeanService.getKeyCacheRecentHitRate()); keyCacheProperties.setCacheSavePeriodInSeconds(clusterCacheMBeanService.getKeyCacheSavePeriodInSeconds()); // Row Cache: Hits, Requests, RecentHitRate, SavePeriodInSeconds rowCacheProperties.setCacheSize(clusterCacheMBeanService.getRowCacheSize()); rowCacheProperties.setCacheCapacity(clusterCacheMBeanService.getRowCacheCapacityInBytes()); rowCacheProperties.setCacheHits(clusterCacheMBeanService.getRowCacheHits()); rowCacheProperties.setCacheRequests(clusterCacheMBeanService.getRowCacheRequests()); rowCacheProperties.setCacheRecentHitRate(clusterCacheMBeanService.getRowCacheRecentHitRate()); rowCacheProperties.setCacheSavePeriodInSeconds(clusterCacheMBeanService.getRowCacheSavePeriodInSeconds()); nodeInformation.setRowCacheProperties(rowCacheProperties); nodeInformation.setKeyCacheProperties(keyCacheProperties); return nodeInformation; }
From source file:com.bigdata.dastor.tools.DastorAdminCli.java
/** * Write node information.//from w w w. j ava2 s .co m * * @param outs the stream to write to */ public void printInfo(PrintStream outs) { outs.println(String.format("%-17s: %s", "Who", host + ":" + port)); outs.println(String.format("%-17s: %s", "Status", probe.getOperationMode())); outs.println(String.format("%-17s: %s", "PositionCode", probe.getToken())); outs.println(String.format("%-17s: %s", "Generation", probe.getCurrentGenerationNumber())); // Uptime long secondsUp = probe.getUptime() / 1000; outs.println(String.format("%-17s: %d", "Uptime (seconds)", secondsUp)); // Memory usage MemoryUsage heapUsage = probe.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)); // Disk space outs.println(String.format("%-17s: %s / %s", "Load", probe.getLoadString(), probe.getStorageServiceMBean().getGrossLoadString())); Map<String, DiskSpaceLoad> loadMap = probe.getStorageServiceMBean().getTablesDiskSpaceLoad(); for (Entry<String, DiskSpaceLoad> entry : loadMap.entrySet()) { outs.println(String.format("%-17s : %s / %s", "Load of " + entry.getKey(), FileUtils.stringifyFileSize(entry.getValue().net), FileUtils.stringifyFileSize(entry.getValue().gross))); } }