geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
LevelZeroSignal.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 LEVELZEROSIGNAL_HPP_INCLUDE
7 #define LEVELZEROSIGNAL_HPP_INCLUDE
8 
9 #include <functional>
10 
11 #include "Signal.hpp"
12 #include "LevelZeroDevicePool.hpp"
13 
14 
15 namespace geopm
16 {
17  class LevelZeroDevicePool;
18 
19  class LevelZeroSignal : public Signal
20  {
21  public:
22  virtual ~LevelZeroSignal() = default;
23  LevelZeroSignal(std::function<double (unsigned int)> devpool_func,
24  unsigned int gpu, double scalar);
25  LevelZeroSignal(const LevelZeroSignal &other) = delete;
26  LevelZeroSignal &operator=(const LevelZeroSignal &other) = delete;
27  void setup_batch(void) override;
28  double sample(void) override;
29  double read(void) const override;
30  void set_sample(double value) override;
31  bool is_sampled(void) const override;
32  private:
33  std::function<double (unsigned int)> m_devpool_func;
34  unsigned int m_domain_idx;
35  double m_scalar;
36  bool m_is_batch_ready;
37  double m_value;
38  mutable bool m_is_sampled;
39  };
40 }
41 
42 #endif
Definition: LevelZeroSignal.hpp:20
virtual ~LevelZeroSignal()=default
bool is_sampled(void) const override
True if the signal has been sampled during this batch.
Definition: LevelZeroSignal.cpp:38
LevelZeroSignal & operator=(const LevelZeroSignal &other)=delete
void setup_batch(void) override
Prepare the signal for being updated through side effects by the owner's read_batch step....
Definition: LevelZeroSignal.cpp:25
void set_sample(double value) override
Set the value to be returned by sample()
Definition: LevelZeroSignal.cpp:32
LevelZeroSignal(std::function< double(unsigned int)> devpool_func, unsigned int gpu, double scalar)
Definition: LevelZeroSignal.cpp:14
LevelZeroSignal(const LevelZeroSignal &other)=delete
double sample(void) override
Apply any conversions necessary to interpret the latest stored value as a double.
Definition: LevelZeroSignal.cpp:43
double read(void) const override
Read directly the value of the signal without affecting any pushed batch signals.
Definition: LevelZeroSignal.cpp:53
Definition: Signal.hpp:16
Definition: Agg.cpp:20