當前位置: 首頁>>代碼示例>>Java>>正文


Java SystemStatsCollector類代碼示例

本文整理匯總了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);
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:38,代碼來源:MemoryStats.java

示例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);
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:42,代碼來源:RealVoltDB.java

示例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();
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:34,代碼來源:ReportMaker.java

示例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);
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:67,代碼來源:MemoryStats.java


注:本文中的org.voltdb.utils.SystemStatsCollector類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。