Fetching contributors…
Cannot retrieve contributors at this time
85 lines (72 sloc) 2.89 KB
/* This file is part of VoltDB.
* Copyright (C) 2008-2010 VoltDB Inc.
* VoltDB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* VoltDB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with VoltDB. If not, see <>.
#include "common/ids.h"
#include "common/types.h"
#include <vector>
#include <map>
namespace voltdb {
class StatsSource;
class Table;
* StatsAgent serves as a central registrar for all sources of statistical runtime information in an EE. In the future this could perform
* further aggregation and processing on the collected statistics. Right now statistics are only collected on persistent tables but that
* could be extended to include stats about plan fragments and the temp tables connecting them.
class StatsAgent {
* Do nothing constructor
* Associate the specified StatsSource with the specified CatalogId under the specified StatsSelector
* @param sst Type of statistic being registered
* @param catalogId CatalogId of the resource
* @param statsSource statsSource containing statistics for the resource
void registerStatsSource(voltdb::StatisticsSelectorType sst, voltdb::CatalogId catalogId, voltdb::StatsSource* statsSource);
* Unassociate all instances of this selector type
void unregisterStatsSource(voltdb::StatisticsSelectorType sst);
* Get statistics for the specified resources
* @param sst StatisticsSelectorType of the resources
* @param catalogIds CatalogIds of the resources statistics should be retrieved for
* @param interval Return counters since the beginning or since this method was last invoked
* @param now Timestamp to return with each row
Table* getStats(
voltdb::StatisticsSelectorType sst,
std::vector<voltdb::CatalogId> catalogIds,
bool interval,
int64_t now);
* Map from a statistics selector to a map of CatalogIds to StatsSources.
std::map<voltdb::StatisticsSelectorType, std::map<voltdb::CatalogId, voltdb::StatsSource*> > m_statsCategoryByStatsSelector;
* Temporary tables for aggregating the results of table statistics keyed by type of statistic
std::map<voltdb::StatisticsSelectorType, voltdb::Table*> m_statsTablesByStatsSelector;
#endif /* STATSAGENT_H_ */