-/* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2017-2019. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
void LinkEnergy::update()
{
+ if (!inited_)
+ init_watts_range_list();
+
double power = get_power();
double now = surf_get_clock();
total_energy_ += power * (now - last_updated_);
void LinkEnergy::init_watts_range_list()
{
-
if (inited_)
return;
inited_ = true;
} catch (std::invalid_argument& ia) {
throw std::invalid_argument(std::string("Invalid busy power value for link ") + this->link_->get_cname());
}
-
- update();
}
}