X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/55adab7a8befc268fcb2f71d2df5e04ec5ff2dfb..82fd162ad0b5fc51a715b6e6e6df55bb52a18b44:/src/surf/cpu_ti.cpp diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 9173e1df1f..454efa886d 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2015. The SimGrid Team. +/* Copyright (c) 2013-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ CpuTiTrace::CpuTiTrace(tmgr_trace_t speedTrace) nbPoints_ = speedTrace->event_list.size() + 1; timePoints_ = new double[nbPoints_]; integral_ = new double[nbPoints_]; - for (auto val : speedTrace->event_list) { + for (auto const& val : speedTrace->event_list) { timePoints_[i] = time; integral_[i] = integral; integral += val.date_ * val.value_; @@ -273,7 +273,7 @@ CpuTiTgmr::CpuTiTgmr(tmgr_trace_t speedTrace, double value) : type_ = TRACE_DYNAMIC; /* count the total time of trace file */ - for (auto val : speedTrace->event_list) + for (auto const& val : speedTrace->event_list) total_time += val.date_; trace_ = new CpuTiTrace(speedTrace); @@ -380,10 +380,9 @@ void CpuTiModel::updateActionsState(double now, double /*delta*/) while ((xbt_heap_size(tiActionHeap_) > 0) && (xbt_heap_maxkey(tiActionHeap_) <= now)) { CpuTiAction *action = static_cast(xbt_heap_pop(tiActionHeap_)); XBT_DEBUG("Action %p: finish", action); - action->finish(); + action->finish(Action::State::done); /* set the remains to 0 due to precision problems when updating the remaining amount */ action->setRemains(0); - action->setState(Action::State::done); /* update remaining amount of all actions */ action->cpu_->updateRemainingAmount(surf_get_clock()); } @@ -665,6 +664,7 @@ CpuTiAction::CpuTiAction(CpuTiModel *model_, double cost, bool failed, CpuTi *cp : CpuAction(model_, cost, failed) , cpu_(cpu) { + indexHeap_ = -1; cpu_->modified(true); }