Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename some symbols around Link::isShared to make their purpose clear
[simgrid.git] / src / surf / host_ptask_L07.hpp
index 66c5b03..86acc7d 100644 (file)
@@ -1,9 +1,11 @@
-/* Copyright (c) 2013-2014. The SimGrid Team.
+/* Copyright (c) 2013-2015. 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 <xbt/base.h>
+
 #include "host_interface.hpp"
 
 #ifndef HOST_L07_HPP_
  * Classes *
  ***********/
 
-class HostL07Model;
-class CpuL07Model;
-class NetworkL07Model;
-
-class HostL07;
-class CpuL07;
-class LinkL07;
+class XBT_PRIVATE HostL07Model;
+class XBT_PRIVATE CpuL07Model;
+class XBT_PRIVATE NetworkL07Model;
 
-class L07Action;
+class XBT_PRIVATE HostL07;
+class XBT_PRIVATE CpuL07;
+class XBT_PRIVATE LinkL07;
 
+class XBT_PRIVATE L07Action;
 /*********
  * Tools *
  *********/
@@ -37,21 +38,20 @@ public:
 
   double shareResources(double now);
   void updateActionsState(double now, double delta);
-  Host *createHost(const char *name);
+  Host *createHost(const char *name,RoutingEdge *netElm, Cpu *cpu);
   Action *executeParallelTask(int host_nb,
-                                        void **host_list,
-                                        double *flops_amount,
-                                        double *bytes_amount,
-                                        double rate);
+                              sg_host_t *host_list,
+                                                         double *flops_amount,
+                                                         double *bytes_amount,
+                                                         double rate);
   xbt_dynar_t getRoute(Host *src, Host *dst);
-  Action *communicate(Host *src, Host *dst, double size, double rate);
   void addTraces();
   NetworkModel *p_networkModel;
 };
 
 class CpuL07Model : public CpuModel {
 public:
-  CpuL07Model() : CpuModel("cpuL07") {};
+  CpuL07Model(HostL07Model *hmodel) : CpuModel() {p_hostModel = hmodel;};
   ~CpuL07Model() {surf_cpu_model_pm = NULL;};
   Cpu *createCpu(const char *name,  xbt_dynar_t powerPeak,
                           int pstate, double power_scale,
@@ -66,7 +66,7 @@ public:
 
 class NetworkL07Model : public NetworkModel {
 public:
-  NetworkL07Model() : NetworkModel() {};
+  NetworkL07Model(HostL07Model *hmodel) : NetworkModel() {p_hostModel = hmodel;};
   ~NetworkL07Model() {surf_network_model = NULL;};
   Link* createLink(const char *name,
                                                   double bw_initial,
@@ -79,8 +79,10 @@ public:
                                                   e_surf_link_sharing_policy_t
                                                   policy, xbt_dict_t properties);
 
-  Action *communicate(RoutingEdge */*src*/, RoutingEdge */*dst*/, double /*size*/, double /*rate*/) {DIE_IMPOSSIBLE;};
+  Action *communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
   void addTraces() {DIE_IMPOSSIBLE;};
+  bool shareResourcesIsIdempotent() {return true;}
+
   HostL07Model *p_hostModel;
 };
 
@@ -91,17 +93,11 @@ public:
 class HostL07 : public Host {
 public:
   HostL07(HostModel *model, const char* name, xbt_dict_t props, RoutingEdge *netElm, Cpu *cpu);
-  //bool isUsed();
   bool isUsed() {DIE_IMPOSSIBLE;};
   void updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {DIE_IMPOSSIBLE;};
-  Action *execute(double size);
-  Action *sleep(double duration);
+  Action *execute(double size) {return p_cpu->execute(size);};
+  Action *sleep(double duration) {return p_cpu->sleep(duration);};
   e_surf_resource_state_t getState();
-  double getPowerPeakAt(int pstate_index);
-  int getNbPstates();
-  void setPstate(int pstate_index);
-  int  getPstate();
-  double getConsumedEnergy();
 };
 
 class CpuL07 : public Cpu {
@@ -113,10 +109,9 @@ public:
                 double power_scale, double power_initial, tmgr_trace_t power_trace,
      int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
   bool isUsed();
-  //bool isUsed() {DIE_IMPOSSIBLE;};
   void updateState(tmgr_trace_event_t event_type, double value, double date);
-  CpuAction *execute(double /*size*/) {DIE_IMPOSSIBLE;};
-  CpuAction *sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
+  Action *execute(double size);
+  Action *sleep(double duration);
 
   double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
   double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
@@ -143,7 +138,7 @@ public:
   void updateState(tmgr_trace_event_t event_type, double value, double date);
   double getBandwidth();
   double getLatency();
-  bool isShared();
+  int sharingPolicy();
   void updateBandwidth(double value, double date=surf_get_clock());
   void updateLatency(double value, double date=surf_get_clock());
 
@@ -157,10 +152,10 @@ public:
  * Action *
  **********/
 class L07Action : public HostAction {
-  friend Action *HostL07::execute(double size);
-  friend Action *HostL07::sleep(double duration);
+  friend Action *CpuL07::execute(double size);
+  friend Action *CpuL07::sleep(double duration);
   friend Action *HostL07Model::executeParallelTask(int host_nb,
-                                                     void **host_list,
+                                                   sg_host_t*host_list,
                                                    double *flops_amount,
                                                                                                   double *bytes_amount,
                                                    double rate);