geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
RawMSRSignal.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 RAWMSRSIGNAL_HPP_INCLUDE
7 #define RAWMSRSIGNAL_HPP_INCLUDE
8 
9 #include <cstdint>
10 #include <cmath>
11 
12 #include <string>
13 #include <memory>
14 
15 #include "Signal.hpp"
16 
17 
18 namespace geopm
19 {
20  class MSRIO;
21 
22  class RawMSRSignal : public Signal
23  {
24  public:
25  RawMSRSignal(std::shared_ptr<MSRIO> msrio,
26  int cpu,
27  uint64_t offset);
28  RawMSRSignal(const RawMSRSignal &other) = delete;
29  RawMSRSignal &operator=(const RawMSRSignal &other) = delete;
30  virtual ~RawMSRSignal() = default;
31  void setup_batch(void) override;
32  double sample(void) override;
33  double read(void) const override;
34  private:
38  std::shared_ptr<MSRIO> m_msrio;
39  int m_cpu;
40  uint64_t m_offset;
43  int m_data_idx;
44  bool m_is_batch_ready;
45  };
46 }
47 
48 #endif
Definition: RawMSRSignal.hpp:23
void setup_batch(void) override
Prepare the signal for being updated through side effects by the owner's read_batch step....
Definition: RawMSRSignal.cpp:29
RawMSRSignal(std::shared_ptr< MSRIO > msrio, int cpu, uint64_t offset)
Definition: RawMSRSignal.cpp:17
double read(void) const override
Read directly the value of the signal without affecting any pushed batch signals.
Definition: RawMSRSignal.cpp:53
RawMSRSignal(const RawMSRSignal &other)=delete
double sample(void) override
Apply any conversions necessary to interpret the latest stored value as a double.
Definition: RawMSRSignal.cpp:41
virtual ~RawMSRSignal()=default
RawMSRSignal & operator=(const RawMSRSignal &other)=delete
Definition: Signal.hpp:16
Definition: Agg.cpp:20