Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Introduce sg_storage_size_t type
[simgrid.git] / src / surf / surf_action.c
index 4ae2774..891a70e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2010. The SimGrid Team.
+/* Copyright (c) 2009-2013. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -382,8 +382,10 @@ void update_resource_energy(surf_model_t model, surf_action_lmm_t action)
                                                                                  (model->model_private->maxmin_system,
                                                                                                  action->variable, 0));
 
-       double load = lmm_constraint_get_usage(cpu_model->constraint) / cpu_model->power_peak;
-       cpu_update_energy(cpu_model, load);
+        if( cpu_model->energy->last_updated < surf_get_clock()) {
+               double load = lmm_constraint_get_usage(cpu_model->constraint) / cpu_model->power_peak;
+               cpu_update_energy(cpu_model, load);
+        }
     }
 }