geopm  3.1.1.dev214+gba4f9f6d
GEOPM - Global Extensible Open Power Manager
EditDistEpochRecordFilter.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 EDITDISTEPOCHRECORDFILTER_HPP_INCLUDE
7 #define EDITDISTEPOCHRECORDFILTER_HPP_INCLUDE
8 
9 #include "RecordFilter.hpp"
10 
11 namespace geopm
12 {
13  struct record_s;
14  class EditDistPeriodicityDetector;
15 
17  {
18  public:
44  EditDistEpochRecordFilter(int history_buffer_size,
45  int min_hysteresis_base_period,
46  int min_detectable_period,
47  double stable_period_hysteresis,
48  double unstable_period_hysteresis);
49  EditDistEpochRecordFilter(std::shared_ptr<EditDistPeriodicityDetector> edpd,
50  int min_hysteresis_base_period,
51  int min_detectable_period,
52  double stable_period_hysteresis,
53  double unstable_period_hysteresis);
54  EditDistEpochRecordFilter(const std::string &name);
55  virtual ~EditDistEpochRecordFilter() = default;
56  std::vector<record_s> filter(const record_s &record) override;
62  static void parse_name(const std::string &name,
63  int &history_buffer_size,
64  int &min_hysteresis_base_period,
65  int &min_detectable_period,
66  double &stable_period_hysteresis,
67  double &unstable_period_hysteresis);
68  private:
97  bool epoch_detected();
98 
101  std::shared_ptr<EditDistPeriodicityDetector> m_edpd;
102  // Parameter for the epoch detection algorithm. See
103  // EditDistEpochRecordFilter::epoch_detected().
104  const int m_min_hysteresis_base_period;
105  // Parameter for the epoch detection algorithm. See
106  // EditDistEpochRecordFilter::epoch_detected().
107  const int m_min_detectable_period;
108  // Parameter for the epoch detection algorithm. See
109  // EditDistEpochRecordFilter::epoch_detected().
110  const double m_stable_period_hysteresis;
111  // Parameter for the epoch detection algorithm. See
112  // EditDistEpochRecordFilter::epoch_detected().
113  const double m_unstable_period_hysteresis;
114  // Input to the stable period detector state machine.
115  int m_last_period;
116  // Input to the stable period detector state machine.
117  int m_period_stable;
118  // Input to the stable period detector state machine.
119  int m_period_unstable;
120  // State variable of the stable period detector state machine.
121  bool m_is_period_detected;
122  // Input to the stable period detector state machine.
123  int m_last_epoch;
124  // Variable for the filter method.
125  int m_epoch_count;
126  };
127 }
128 
129 #endif
Definition: EditDistEpochRecordFilter.hpp:17
EditDistEpochRecordFilter(int history_buffer_size, int min_hysteresis_base_period, int min_detectable_period, double stable_period_hysteresis, double unstable_period_hysteresis)
Default constructor for the filter.
Definition: EditDistEpochRecordFilter.cpp:108
virtual ~EditDistEpochRecordFilter()=default
static void parse_name(const std::string &name, int &history_buffer_size, int &min_hysteresis_base_period, int &min_detectable_period, double &stable_period_hysteresis, double &unstable_period_hysteresis)
Static function that will parse the filter string for the edit_distance into the constructor argument...
Definition: EditDistEpochRecordFilter.cpp:238
std::vector< record_s > filter(const record_s &record) override
Apply a filter to a stream of records.
Definition: EditDistEpochRecordFilter.cpp:142
Base class for filters that can be applied to ApplicationSampler record streams produced by a single ...
Definition: RecordFilter.hpp:19
Definition: Accumulator.cpp:12
Record of an application event.
Definition: record.hpp:61