Lumiera  0.pre.03
»edit your freedom«
ComputationalLoad Class Reference

#include "/Werk/devel/lumi/tests/vault/gear/test-chain-load.hpp"

Description

A calibratable CPU load to be invoked from a node job functor.

Two distinct methods for load generation are provided

  • tight loop with arithmetics in register
  • repeatedly accessing and adding memory marked as volatile The timeBase multiplied with the given scaleStep´ determines the actual run time. When using the _memory method_ (useAllocation), a heap block ofstaleStep*sizeBase` is used, and the number of repetitions is chosen such as to match the given timing goal.
    Note
    since performance depends on the platform, it is mandatory to invoke the self calibration at least once prior to use. Performing the calibration with default base settings is acceptable, since mostly the overall expense is growing linearly; obviously the calibration is more precisely however when using the actual timeBase and sizeBase of the intended usage. The calibration watches processing speed in a microbenchmark with LOAD_BENCHMARK_RUNS repetitions; the result is stored in a static variable and can thus be reused.

Definition at line 1310 of file test-chain-load.hpp.

Public Member Functions

double benchmark (uint scaleStep=1)
 
void calibrate ()
 
double invoke (uint scaleStep=1)
 cause a delay by computational load
 
bool isCalibrated () const
 
void maybeCalibrate ()
 

Public Attributes

size_t sizeBase = LOAD_DEFAULT_MEM_SIZE
 
microseconds timeBase = LOAD_DEFAULT_TIME
 
bool useAllocation = false
 

Private Types

using Sink = volatile size_t
 

Private Member Functions

auto allocNeeded (uint scaleStep)
 
void causeComputationLoad (uint scaleStep)
 
void causeMemProcessLoad (uint scaleStep)
 
double determineSpeed ()
 
void performIncrementalCalibration ()
 
uint64_t roundsNeeded (uint scaleStep)
 
- Private Member Functions inherited from MoveAssign
 MoveAssign (MoveAssign &&)=default
 
 MoveAssign (MoveAssign const &)=delete
 
MoveAssignoperator= (MoveAssign &&)=default
 
MoveAssignoperator= (MoveAssign const &)=delete
 

Static Private Member Functions

static double & computationSpeed (bool mem)
 

Member Function Documentation

◆ computationSpeed()

◆ benchmark()

double benchmark ( uint  scaleStep = 1)
inline
Returns
averaged runtime in current configuration

Definition at line 1340 of file test-chain-load.hpp.

Referenced by TestChainLoad_test::verify_computation_load().

+ Here is the caller graph for this function:
+ Inheritance diagram for ComputationalLoad:
+ Collaboration diagram for ComputationalLoad:

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