geopm 3.1.1.dev410+g40bf96ed
GEOPM - Global Extensible Open Power Manager
Loading...
Searching...
No Matches
ProcessRegionAggregator.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 - 2024 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef PROCESSREGIONAGGREGATOR_HPP_INCLUDE
7#define PROCESSREGIONAGGREGATOR_HPP_INCLUDE
8
9#include <cstdint>
10
11#include <map>
12#include <memory>
13
14namespace geopm
15{
20 {
21 public:
22 virtual ~ProcessRegionAggregator() = default;
25 virtual void update(void) = 0;
30 virtual double get_runtime_average(uint64_t region_hash) const = 0;
35 virtual double get_count_average(uint64_t region_hash) const = 0;
36 static std::unique_ptr<ProcessRegionAggregator> make_unique(void);
37 };
38
40
42 {
43 public:
46 virtual ~ProcessRegionAggregatorImp() = default;
47 void update(void) override;
48 double get_runtime_average(uint64_t region_hash) const override;
49 double get_count_average(uint64_t region_hash) const override;
50 private:
51 ApplicationSampler &m_app_sampler;
52 int m_num_process;
53
54 // Records will be coming in sorted by process. An
55 // optimization might be to keep an iterator around
56 // pointing to the most recent process's map. The lookup
57 // by region hash will happen less frequently but requires
58 // iteration over all the process maps. Build a cache and
59 // invalidate it if update() is called.
60 struct region_info_s {
61 double total_runtime;
62 int total_count;
63 double last_entry_time;
64 };
65 std::map<int, std::map<uint64_t, region_info_s> > m_region_info;
66 };
67}
68
69#endif
Definition ApplicationSampler.hpp:27
Class responsible for reading records from the ApplicationSampler and calculating the per-process run...
Definition ProcessRegionAggregator.hpp:20
virtual ~ProcessRegionAggregator()=default
static std::unique_ptr< ProcessRegionAggregator > make_unique(void)
Definition ProcessRegionAggregator.cpp:16
virtual double get_count_average(uint64_t region_hash) const =0
Returns the average number of entries into a region across all processes.
virtual double get_runtime_average(uint64_t region_hash) const =0
Returns the average total time spent in a region across all processes.
virtual void update(void)=0
Gets the latest set of records from ApplicationSampler.
Definition ProcessRegionAggregator.hpp:42
double get_runtime_average(uint64_t region_hash) const override
Returns the average total time spent in a region across all processes.
Definition ProcessRegionAggregator.cpp:85
double get_count_average(uint64_t region_hash) const override
Returns the average number of entries into a region across all processes.
Definition ProcessRegionAggregator.cpp:100
void update(void) override
Gets the latest set of records from ApplicationSampler.
Definition ProcessRegionAggregator.cpp:33
ProcessRegionAggregatorImp()
Definition ProcessRegionAggregator.cpp:21
virtual ~ProcessRegionAggregatorImp()=default
Definition Accumulator.cpp:12