Contur 2
Educational OS kernel simulator
Loading...
Searching...
No Matches
contur::Statistics Class Reference

Tracks per-process burst history and EWMA burst prediction. More...

#include <statistics.h>

Public Member Functions

 Statistics (double alpha=0.5)
 Constructs statistics store.
 ~Statistics ()
 Destroys statistics store.
 Statistics (const Statistics &)=delete
 Copy construction is disabled.
Statisticsoperator= (const Statistics &)=delete
 Copy assignment is disabled.
 Statistics (Statistics &&) noexcept
 Move-constructs statistics state.
Statisticsoperator= (Statistics &&) noexcept
 Move-assigns statistics state.
void recordBurst (ProcessId pid, Tick burst)
 Records an observed CPU burst for the process.
Tick predictedBurst (ProcessId pid) const noexcept
 Returns the current predicted burst (0 if unknown).
bool hasPrediction (ProcessId pid) const noexcept
 Returns true if the process already has a prediction.
void clear (ProcessId pid)
 Clears statistics for one process.
void reset ()
 Clears statistics for all processes.
double alpha () const noexcept
 Returns EWMA alpha in range (0, 1].

Private Attributes

std::unique_ptr< Impl > impl_

Detailed Description

Tracks per-process burst history and EWMA burst prediction.

Definition at line 13 of file statistics.h.

Constructor & Destructor Documentation

◆ Statistics() [1/3]

contur::Statistics::Statistics ( double alpha = 0.5)
explicit

Constructs statistics store.

Parameters
alphaEWMA smoothing coefficient in range (0, 1].

References alpha().

Referenced by operator=(), operator=(), Statistics(), and Statistics().

◆ ~Statistics()

contur::Statistics::~Statistics ( )

Destroys statistics store.

◆ Statistics() [2/3]

contur::Statistics::Statistics ( const Statistics & )
delete

Copy construction is disabled.

References Statistics().

◆ Statistics() [3/3]

contur::Statistics::Statistics ( Statistics && )
noexcept

Move-constructs statistics state.

References Statistics().

Member Function Documentation

◆ alpha()

double contur::Statistics::alpha ( ) const
nodiscardnoexcept

Returns EWMA alpha in range (0, 1].

References alpha().

Referenced by alpha(), and Statistics().

◆ clear()

void contur::Statistics::clear ( ProcessId pid)

Clears statistics for one process.

References clear().

Referenced by clear().

◆ hasPrediction()

bool contur::Statistics::hasPrediction ( ProcessId pid) const
nodiscardnoexcept

Returns true if the process already has a prediction.

References hasPrediction().

Referenced by hasPrediction().

◆ operator=() [1/2]

Statistics & contur::Statistics::operator= ( const Statistics & )
delete

Copy assignment is disabled.

References Statistics().

◆ operator=() [2/2]

Statistics & contur::Statistics::operator= ( Statistics && )
noexcept

Move-assigns statistics state.

References Statistics().

◆ predictedBurst()

Tick contur::Statistics::predictedBurst ( ProcessId pid) const
nodiscardnoexcept

Returns the current predicted burst (0 if unknown).

References predictedBurst().

Referenced by predictedBurst().

◆ recordBurst()

void contur::Statistics::recordBurst ( ProcessId pid,
Tick burst )

Records an observed CPU burst for the process.

References recordBurst().

Referenced by recordBurst().

◆ reset()

void contur::Statistics::reset ( )

Clears statistics for all processes.

References reset().

Referenced by reset().

Member Data Documentation

◆ impl_

std::unique_ptr<Impl> contur::Statistics::impl_
private

Definition at line 54 of file statistics.h.


The documentation for this class was generated from the following file: