Example #1
0
 @Override
 public VoltTable[] getStats(
     SysProcSelector selector, int[] locators, boolean interval, Long now) {
   return m_ee.getStats(selector, locators, interval, now);
 }
Example #2
0
  /**
   * Cache the current statistics.
   *
   * @param time
   */
  private void statsTick(long time) {
    /*
     * grab the table statistics from ee and put it into the statistics
     * agent.
     */
    if (m_tableStats != null) {
      CatalogMap<Table> tables = m_context.database.getTables();
      int[] tableIds = new int[tables.size()];
      int i = 0;
      for (Table table : tables) {
        tableIds[i++] = table.getRelativeIndex();
      }

      // data to aggregate
      long tupleCount = 0;
      int tupleDataMem = 0;
      int tupleAllocatedMem = 0;
      int indexMem = 0;
      int stringMem = 0;

      // update table stats
      final VoltTable[] s1 = m_ee.getStats(SysProcSelector.TABLE, tableIds, false, time);
      if (s1 != null) {
        VoltTable stats = s1[0];
        assert (stats != null);

        // rollup the table memory stats for this site
        while (stats.advanceRow()) {
          tupleCount += stats.getLong(7);
          tupleAllocatedMem += (int) stats.getLong(8);
          tupleDataMem += (int) stats.getLong(9);
          stringMem += (int) stats.getLong(10);
        }
        stats.resetRowPosition();

        m_tableStats.setStatsTable(stats);
      }

      // update index stats
      final VoltTable[] s2 = m_ee.getStats(SysProcSelector.INDEX, tableIds, false, time);
      if ((s2 != null) && (s2.length > 0)) {
        VoltTable stats = s2[0];
        assert (stats != null);

        // rollup the index memory stats for this site
        while (stats.advanceRow()) {
          indexMem += stats.getLong(10);
        }
        stats.resetRowPosition();

        m_indexStats.setStatsTable(stats);
      }

      // update the rolled up memory statistics
      if (m_memStats != null) {
        m_memStats.eeUpdateMemStats(
            m_siteId,
            tupleCount,
            tupleDataMem,
            tupleAllocatedMem,
            indexMem,
            stringMem,
            m_ee.getThreadLocalPoolAllocations());
      }
    }
  }