geopm  3.1.1.dev214+gba4f9f6d
GEOPM - Global Extensible Open Power Manager
TimeSignal.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 TIMESIGNAL_HPP_INCLUDE
7 #define TIMESIGNAL_HPP_INCLUDE
8 
9 #include <memory>
10 
11 #include "Signal.hpp"
12 #include "geopm_time.h"
13 
14 namespace geopm
15 {
18  class TimeSignal : public Signal
19  {
20  public:
21  TimeSignal(std::shared_ptr<geopm_time_s> time_zero,
22  std::shared_ptr<double> time_batch);
23  TimeSignal(const TimeSignal &other) = delete;
24  TimeSignal &operator=(const TimeSignal &other) = delete;
25  virtual ~TimeSignal() = default;
26  void setup_batch(void) override;
27  double sample(void) override;
28  double read(void) const override;
29  private:
30  std::shared_ptr<geopm_time_s> m_time_zero;
31  std::shared_ptr<double> m_time_batch;
32  bool m_is_batch_ready;
33  };
34 }
35 
36 #endif
Definition: Signal.hpp:16
Definition: TimeSignal.hpp:19
double read(void) const override
Read directly the value of the signal without affecting any pushed batch signals.
Definition: TimeSignal.cpp:39
TimeSignal(std::shared_ptr< geopm_time_s > time_zero, std::shared_ptr< double > time_batch)
Definition: TimeSignal.cpp:14
TimeSignal & operator=(const TimeSignal &other)=delete
double sample(void) override
Apply any conversions necessary to interpret the latest stored value as a double.
Definition: TimeSignal.cpp:30
void setup_batch(void) override
Prepare the signal for being updated through side effects by the owner's read_batch step....
Definition: TimeSignal.cpp:23
TimeSignal(const TimeSignal &other)=delete
virtual ~TimeSignal()=default
Definition: Agg.cpp:20
struct geopm_time_s time_zero(void)
Definition: TimeZero.cpp:56