contur2
Loading...
Searching...
No Matches
statistics.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <memory>
7
8#include "contur/core/types.h"
9
10namespace contur {
11
14 {
15 public:
16 explicit Statistics(double alpha = 0.5);
18
19 Statistics(const Statistics &) = delete;
20 Statistics &operator=(const Statistics &) = delete;
21 Statistics(Statistics &&) noexcept;
22 Statistics &operator=(Statistics &&) noexcept;
23
25 void recordBurst(ProcessId pid, Tick burst);
26
28 [[nodiscard]] Tick predictedBurst(ProcessId pid) const noexcept;
29
31 [[nodiscard]] bool hasPrediction(ProcessId pid) const noexcept;
32
34 void clear(ProcessId pid);
35
37 void reset();
38
40 [[nodiscard]] double alpha() const noexcept;
41
42 private:
43 struct Impl;
44 std::unique_ptr<Impl> impl_;
45 };
46
47} // namespace contur
Statistics(double alpha=0.5)
void reset()
Clears statistics for all processes.
Statistics(Statistics &&) noexcept
std::unique_ptr< Impl > impl_
Definition statistics.h:44
void clear(ProcessId pid)
Clears statistics for one process.
Statistics(const Statistics &)=delete
void recordBurst(ProcessId pid, Tick burst)
Records an observed CPU burst for the process.
bool hasPrediction(ProcessId pid) const noexcept
Returns true if the process already has a prediction.
Statistics & operator=(const Statistics &)=delete
double alpha() const noexcept
Returns EWMA alpha in range (0, 1].
Tick predictedBurst(ProcessId pid) const noexcept
Returns the current predicted burst (0 if unknown).
Definition block.h:15
std::uint64_t Tick
Simulation clock tick counter.
Definition types.h:18
std::uint32_t ProcessId
Unique identifier for a process.
Definition types.h:12
Common type aliases, sentinel constants, and forward declarations used throughout the Contur 2 kernel...