geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
MSRFieldSignal.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 MSRFIELDSIGNAL_HPP_INCLUDE
7 #define MSRFIELDSIGNAL_HPP_INCLUDE
8 
9 #include <cstdint>
10 #include <cmath>
11 
12 #include <string>
13 #include <memory>
14 
15 #include "Signal.hpp"
16 
17 namespace geopm
18 {
24  class MSRFieldSignal : public Signal
25  {
26  public:
27  MSRFieldSignal(std::shared_ptr<Signal> raw_msr,
28  int begin_bit,
29  int end_bit,
30  int function,
31  double scalar);
32  MSRFieldSignal(const MSRFieldSignal &other) = delete;
33  MSRFieldSignal &operator=(const MSRFieldSignal &other) = delete;
34  virtual ~MSRFieldSignal() = default;
35  void setup_batch(void) override;
36  double sample(void) override;
37  double read(void) const override;
38  private:
39  double convert_raw_value(double val,
40  uint64_t &last_field,
41  int &num_overflow) const;
50  std::shared_ptr<Signal> m_raw_msr;
51  const int m_shift;
52  const int m_num_bit;
53  const uint64_t m_mask;
54  const uint64_t m_subfield_max;
55  const int m_function;
56  const double m_scalar;
57  uint64_t m_last_field;
58  int m_num_overflow;
59  bool m_is_batch_ready;
60  };
61 }
62 
63 #endif
Definition: MSRFieldSignal.hpp:25
double read(void) const override
Read directly the value of the signal without affecting any pushed batch signals.
Definition: MSRFieldSignal.cpp:107
void setup_batch(void) override
Prepare the signal for being updated through side effects by the owner's read_batch step....
Definition: MSRFieldSignal.cpp:47
MSRFieldSignal(const MSRFieldSignal &other)=delete
MSRFieldSignal(std::shared_ptr< Signal > raw_msr, int begin_bit, int end_bit, int function, double scalar)
Definition: MSRFieldSignal.cpp:17
MSRFieldSignal & operator=(const MSRFieldSignal &other)=delete
virtual ~MSRFieldSignal()=default
double sample(void) override
Apply any conversions necessary to interpret the latest stored value as a double.
Definition: MSRFieldSignal.cpp:98
Definition: Signal.hpp:16
Definition: Agg.cpp:20