Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Uncomment code, and fix meomry leaks in WorkstationVMHL13.
[simgrid.git] / src / surf / vm_workstation_hl13.cpp
index f036730..d9299c0 100644 (file)
@@ -1,9 +1,9 @@
-/*
- * vm_workstation.cpp
- *
- *  Created on: Nov 12, 2013
- *      Author: bedaride
- */
+/* Copyright (c) 2013-2014. 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. */
+
 #include "vm_workstation_hl13.hpp"
 #include "cpu_cas01.hpp"
 
@@ -324,15 +324,15 @@ WorkstationVMHL13::~WorkstationVMHL13()
   delete cpu;
 
   /* Free the network resource of the VM. */
-       // Nothing has to be done, because net_elmts is just a pointer on the physical one
+  // Nothing has to be done, because net_elmts is just a pointer on the physical one
 
   /* Free the storage resource of the VM. */
   // Not relevant yet
 
-       /* Free the workstation resource of the VM. */
+  /* Free the workstation resource of the VM. */
 }
 
-void WorkstationVMHL13::updateState(tmgr_trace_event_t event_type, double value, double date) {
+void WorkstationVMHL13::updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {
   THROW_IMPOSSIBLE;             /* This model does not implement parallel tasks */
 }
 
@@ -429,11 +429,8 @@ void WorkstationVMHL13::migrate(surf_resource_t ind_dst_pm)
      e_surf_action_state_t state = p_action->getState();
      if (state != SURF_ACTION_DONE)
        XBT_CRITICAL("FIXME: may need a proper handling, %d", state);
-     if (p_action->getRemains() > 0)
-       XBT_CRITICAL("FIXME: need copy the state(?), %f", p_action->getRemains());
-
-     int ret = p_action->unref();
-     xbt_assert(ret == 1, "Bug: some resource still remains");
+     if (p_action->getRemainsNoUpdate() > 0)
+       XBT_CRITICAL("FIXME: need copy the state(?), %f", p_action->getRemainsNoUpdate());
 
      /* keep the bound value of the cpu action of the VM. */
      double old_bound = p_action->getBound();
@@ -442,6 +439,9 @@ void WorkstationVMHL13::migrate(surf_resource_t ind_dst_pm)
        new_cpu_action->setBound(old_bound);
      }
 
+     int ret = p_action->unref();
+     xbt_assert(ret == 1, "Bug: some resource still remains");
+
      p_action = new_cpu_action;
    }