Creating an energy-meter service
Overview
An energy-meter service simply measures, at regular intervals, the energy consumed by one or more hosts, making measurement traces available as part of the simulation output.
Creating an energy-meter service
In WRENCH, an energy-meter service is defined by the
wrench::EnergyMeterService
class, an instantiation of which requires
the following parameters:
The name of a host on which to start the service;
A map (
std::map
) of key-value pairs, where the keys are hostnames and the values are measurement periods in seconds.
The example below creates an instance that runs on host
MeasurerHost
, and measures the energy consumed on host Host1
every second and the energy consumed on host Host2
every 10 seconds:
auto em_service = simulation->add(
new wrench::EnergyMeterService("MeasurerHost", {{"Host1",1.0},{"Host2", 10.0}}));
One the simulation is completed, energy measurement time stamps can be accessed as follows:
auto energy_consumption_timestamps = simulation->getOutput().getTrace<wrench::SimulationTimestampEnergyConsumption>();
See the documentation of wrench::SimulationOutput
for more details.