35 std::cout << std::setw(54) <<
" ";
37 std::cout << std::setw(16) << std::left << st <<
"\t";
38 std::cout <<
"Unit" << std::endl;
39 for (
size_t i = 0; i < s.
min.
size(); i++) {
40 std::cout << std::setw(54) << std::left << names[i].first;
42 std::cout << std::setw(16) << st[i] <<
"\t";
44 std::cout << names[i].second << std::endl;
46 std::cout << std::endl << std::endl;
61 for (
auto itr = request.begin(); itr < request.end(); itr++)
76 std::vector<MetroCollect::MetricsSource::FieldInfo> fields(metricsArray.
fieldCount());
77 for (
size_t i = 0; i < fields.size(); i++)
80 std::vector<std::pair<std::string, std::string>> names;
81 names.reserve(fields.size());
83 for (
const auto& field : fields) {
84 ss.str(std::string());
85 for (
const auto& part : field.name)
87 names.push_back(std::pair{ss.str(), field.unit});
98 std::vector<std::pair<std::string, std::string>>
names;
128 int main(
int argc,
char* argv[]) {
135 samplingInterval = std::chrono::milliseconds(std::atol(argv[1]));
137 windowLength = std::atol(argv[2]);
139 windowOverlap = std::atol(argv[3]);
bool metricsContollerShouldStopCollectingMetrics(const MetroCollect::MetricsController &) override
Function called after each iteration to ask the delegate whether the controller should stop collectin...
static constexpr std::chrono::milliseconds defaultSamplingInterval
Default parameter option.
Struct to store all final metric stats.
size_t iterationCount
Number of iterations remaining to be done.
void setRequestedMetrics(const MetricsArray< Statistics::Stats > &requestedMetrics) noexcept
Sets the list of request metrics.
static constexpr size_t defaultProcessingWindowLength
Default parameter option.
Stats
Bitwise type te select statistics.
void setSamplingInterval(std::chrono::milliseconds interval) noexcept
Sets the metrics sampling interval.
void setSendStats(bool sendStats) noexcept
Sets whether the controller alerts the delegate after computing statistics.
void collectMetrics()
Launch metric collection loop.
void printMetrics(const std::vector< std::pair< std::string, std::string >> &names, const MetroCollect::MetricsController::MetricsStats &s)
Print metric stats on screen.
static constexpr size_t defaultProcessingWindowOverlap
Default parameter option.
Small struct to implement MetricsController delegate.
SourceInterests makeSourceInterests(bool value)
Construct a new shared pointer to a SourceInterests object.
void forEach(Function func)
Execute a function for each stats array.
std::vector< std::pair< std::string, std::string > > names
Name of collected metrics.
void setProcessingWindow(size_t length, size_t overlap) noexcept
Sets the processing window parameters used to compute statistics.
int main(int argc, char *argv[])
MetroCollectStats main function.
const MetricsSource::FieldInfo fieldInfoAtIndex(size_t index) const noexcept
Get details about a specific metric field.
Class to fetch metrics from the kernel and store them.
auto generateMetrics()
Generate metric request to give to the MetricsController.
void metricsContollerCollectedMetricsValues(const MetroCollect::MetricsController &, const MetroCollect::MetricsDiffArray &, const MetroCollect::MetricsDataArray &, const MetroCollect::MetricsDataArray &) override
Function called every time the MetricsController has collected new values.
static constexpr std::array< std::string_view, count > names
Names of available statistics.
void metricsContollerCollectedMetricsStats(const MetroCollect::MetricsController &, const MetroCollect::MetricsController::MetricsStats &) override
Function called every time the MetricsController has computed statistics.
Abstract delegate of MetricsController.
size_t fieldCount() const noexcept
Returns the total number of available metrics.
MetricsStatsArray< DiffValueType > min
Array of minimums.
Class to control the collection of metrics.
Class to compute and store metric values variations.
size_t size() const noexcept
Returns the size of the underlying array.
auto getAllFieldNames(const MetroCollect::MetricsArray< T > &metricsArray)
Get fields name of all metrics.