本文整理汇总了Java中org.voltdb.utils.SystemStatsCollector类的典型用法代码示例。如果您正苦于以下问题:Java SystemStatsCollector类的具体用法?Java SystemStatsCollector怎么用?Java SystemStatsCollector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SystemStatsCollector类属于org.voltdb.utils包,在下文中一共展示了SystemStatsCollector类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateStatsRow
import org.voltdb.utils.SystemStatsCollector; //导入依赖的package包/类
@Override
protected synchronized void updateStatsRow(Object rowKey, Object[] rowValues) {
// sum up all of the site statistics
PartitionMemRow totals = new PartitionMemRow();
for (PartitionMemRow pmr : m_memoryStats.values()) {
totals.tupleCount += pmr.tupleCount;
totals.tupleDataMem += pmr.tupleDataMem;
totals.tupleAllocatedMem += pmr.tupleAllocatedMem;
totals.indexMem += pmr.indexMem;
totals.stringMem += pmr.stringMem;
totals.pooledMem += pmr.pooledMem;
}
// get system statistics
int rss = 0; int javaused = 0; int javaunused = 0;
SystemStatsCollector.Datum d = SystemStatsCollector.getRecentSample();
if (d != null) {
rss = (int) (d.rss / 1024);
double javausedFloat = d.javausedheapmem + d.javausedsysmem;
javaused = (int) (javausedFloat / 1024);
javaunused = (int) ((d.javatotalheapmem + d.javatotalsysmem - javausedFloat) / 1024);
}
rowValues[columnNameToIndex.get("RSS")] = rss;
rowValues[columnNameToIndex.get("JAVAUSED")] = javaused;
rowValues[columnNameToIndex.get("JAVAUNUSED")] = javaunused;
rowValues[columnNameToIndex.get("TUPLEDATA")] = totals.tupleDataMem;
rowValues[columnNameToIndex.get("TUPLEALLOCATED")] = totals.tupleAllocatedMem;
rowValues[columnNameToIndex.get("INDEXMEMORY")] = totals.indexMem;
rowValues[columnNameToIndex.get("STRINGMEMORY")] = totals.stringMem;
rowValues[columnNameToIndex.get("TUPLECOUNT")] = totals.tupleCount;
rowValues[columnNameToIndex.get("POOLEDMEMORY")] = totals.pooledMem / 1024;
//in kb to make math simpler with other mem values.
rowValues[columnNameToIndex.get("PHYSICALMEMORY")] = PlatformProperties.getPlatformProperties().ramInMegabytes * 1024;
rowValues[columnNameToIndex.get("JAVAMAXHEAP")] = Runtime.getRuntime().maxMemory() / 1024;
super.updateStatsRow(rowKey, rowValues);
}
示例2: schedulePeriodicWorks
import org.voltdb.utils.SystemStatsCollector; //导入依赖的package包/类
/**
* Schedule all the periodic works
*/
private void schedulePeriodicWorks() {
// JMX stats broadcast
m_periodicWorks.add(scheduleWork(new Runnable() {
@Override
public void run() {
// A null here was causing a steady stream of annoying but apparently inconsequential
// NPEs during a debug session of an unrelated unit test.
if (m_statsManager != null) {
m_statsManager.sendNotification();
}
}
}, 0, StatsManager.POLL_INTERVAL, TimeUnit.MILLISECONDS));
// small stats samples
m_periodicWorks.add(scheduleWork(new Runnable() {
@Override
public void run() {
SystemStatsCollector.asyncSampleSystemNow(false, false);
}
}, 0, 5, TimeUnit.SECONDS));
// medium stats samples
m_periodicWorks.add(scheduleWork(new Runnable() {
@Override
public void run() {
SystemStatsCollector.asyncSampleSystemNow(true, false);
}
}, 0, 1, TimeUnit.MINUTES));
// large stats samples
m_periodicWorks.add(scheduleWork(new Runnable() {
@Override
public void run() {
SystemStatsCollector.asyncSampleSystemNow(true, true);
}
}, 0, 6, TimeUnit.MINUTES));
GCInspector.instance.start(m_periodicPriorityWorkThread);
}
示例3: getLiveSystemOverview
import org.voltdb.utils.SystemStatsCollector; //导入依赖的package包/类
public static String getLiveSystemOverview()
{
// get the start time
long t = SystemStatsCollector.getStartTime();
Date date = new Date(t);
long duration = System.currentTimeMillis() - t;
long minutes = duration / 60000;
long hours = minutes / 60; minutes -= hours * 60;
long days = hours / 24; hours -= days * 24;
String starttime = String.format("%s (%dd %dh %dm)",
date.toString(), days, hours, minutes);
// handle the basic info page below this
SiteTracker st = VoltDB.instance().getSiteTrackerForSnapshot();
// get the cluster info
String clusterinfo = st.getAllHosts().size() + " hosts ";
clusterinfo += " with " + st.getAllSites().size() + " sites ";
clusterinfo += " (" + st.getAllSites().size() / st.getAllHosts().size();
clusterinfo += " per host)";
StringBuilder sb = new StringBuilder();
sb.append("<table class='table table-condensed'>\n");
sb.append("<tr><td>Mode </td><td>" + VoltDB.instance().getMode().toString() + "</td><td>\n");
sb.append("<tr><td>VoltDB Version </td><td>" + VoltDB.instance().getVersionString() + "</td><td>\n");
sb.append("<tr><td>Buildstring </td><td>" + VoltDB.instance().getBuildString() + "</td><td>\n");
sb.append("<tr><td>Cluster Composition </td><td>" + clusterinfo + "</td><td>\n");
sb.append("<tr><td>Running Since </td><td>" + starttime + "</td><td>\n");
sb.append("</table>\n");
return sb.toString();
}
示例4: updateStatsRow
import org.voltdb.utils.SystemStatsCollector; //导入依赖的package包/类
@Override
protected synchronized void updateStatsRow(Object rowKey, Object[] rowValues) {
// sum up all of the site statistics
PartitionMemRow totals = new PartitionMemRow();
for (PartitionMemRow pmr : m_memoryStats.values()) {
totals.tupleCount += pmr.tupleCount;
totals.tupleDataMem += pmr.tupleDataMem;
totals.tupleAllocatedMem += pmr.tupleAllocatedMem;
totals.indexMem += pmr.indexMem;
totals.stringMem += pmr.stringMem;
totals.pooledMem += pmr.pooledMem;
// ACTIVE
totals.tuplesEvicted += pmr.tuplesEvicted;
totals.blocksEvicted += pmr.blocksEvicted;
totals.bytesEvicted += pmr.bytesEvicted;
// GLOBAL WRITTEN
totals.tuplesWritten += pmr.tuplesWritten;
totals.blocksWritten += pmr.blocksWritten;
totals.bytesWritten += pmr.bytesWritten;
// GLOBAL READ
totals.tuplesRead += pmr.tuplesRead;
totals.blocksRead += pmr.blocksRead;
totals.bytesRead += pmr.bytesRead;
}
// get system statistics
int rss = 0; int javaused = 0; int javaunused = 0;
SystemStatsCollector.Datum d = SystemStatsCollector.getRecentSample();
if (d != null) {
rss = (int) (d.rss / 1024);
double javausedFloat = d.javausedheapmem + d.javausedsysmem;
javaused = (int) (javausedFloat / 1024);
javaunused = (int) ((d.javatotalheapmem + d.javatotalsysmem - javausedFloat) / 1024);
}
rowValues[columnNameToIndex.get("RSS")] = rss;
rowValues[columnNameToIndex.get("JAVA_USED")] = javaused;
rowValues[columnNameToIndex.get("JAVA_UNUSED")] = javaunused;
rowValues[columnNameToIndex.get("TUPLE_COUNT")] = totals.tupleCount;
rowValues[columnNameToIndex.get("TUPLE_ALLOCATED_MEMORY")] = totals.tupleAllocatedMem;
rowValues[columnNameToIndex.get("TUPLE_DATA_MEMORY")] = totals.tupleDataMem;
rowValues[columnNameToIndex.get("INDEX_MEMORY")] = totals.indexMem;
rowValues[columnNameToIndex.get("STRING_MEMORY")] = totals.stringMem;
rowValues[columnNameToIndex.get("POOLED_MEMORY")] = totals.pooledMem / 1024;
// ACTIVE
rowValues[columnNameToIndex.get("ANTICACHE_TUPLES_EVICTED")] = totals.tuplesEvicted;
rowValues[columnNameToIndex.get("ANTICACHE_BLOCKS_EVICTED")] = totals.blocksEvicted;
rowValues[columnNameToIndex.get("ANTICACHE_BYTES_EVICTED")] = totals.bytesEvicted / 1024;
// GLOBAL WRITTEN
rowValues[columnNameToIndex.get("ANTICACHE_TUPLES_WRITTEN")] = totals.tuplesWritten;
rowValues[columnNameToIndex.get("ANTICACHE_BLOCKS_WRITTEN")] = totals.blocksWritten;
rowValues[columnNameToIndex.get("ANTICACHE_BYTES_WRITTEN")] = totals.bytesWritten / 1024;
// GLOBAL READ
rowValues[columnNameToIndex.get("ANTICACHE_TUPLES_READ")] = totals.tuplesRead;
rowValues[columnNameToIndex.get("ANTICACHE_BLOCKS_READ")] = totals.blocksRead;
rowValues[columnNameToIndex.get("ANTICACHE_BYTES_READ")] = totals.bytesRead / 1024;
super.updateStatsRow(rowKey, rowValues);
}