- CpuAction *action = static_cast<CpuAction*>(xbt_heap_pop(getActionHeap()));
- XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
- if (TRACE_is_enabled()) {
- Cpu *cpu = static_cast<Cpu*>(lmm_constraint_id(lmm_get_cnst_from_var(getMaxminSystem(), action->getVariable(), 0)));
- TRACE_surf_host_set_utilization(cpu->getCname(), action->getCategory(),
- lmm_variable_getvalue(action->getVariable()), action->getLastUpdate(),
- now - action->getLastUpdate());
- }
-
- action->finish(Action::State::done);
- XBT_CDEBUG(surf_kernel, "Action %p finished", action);
-
- /* set the remains to 0 due to precision problems when updating the remaining amount */
- action->setRemains(0);
- }
- if (TRACE_is_enabled()) {
- //defining the last timestamp that we can safely dump to trace file
- //without losing the event ascending order (considering all CPU's)
- double smaller = -1;
- ActionList *actionSet = getRunningActionSet();
- ActionList::iterator it(actionSet->begin());
- ActionList::iterator itend(actionSet->end());
- for (; it != itend; ++it) {
- CpuAction *action = static_cast<CpuAction*>(&*it);
- if (smaller < 0 || action->getLastUpdate() < smaller)
- smaller = action->getLastUpdate();
- }
- if (smaller > 0) {
- TRACE_last_timestamp_to_dump = smaller;
- }