From: Martin Quinson Date: Sun, 3 Jan 2016 21:45:46 +0000 (+0100) Subject: cleanups in CpuCas01: overrides, initialize fields, kill non-obviously dead code X-Git-Tag: v3_13~1367 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f702e82d4a8bbafc08f94b2d561c757dd675ec17?hp=031334b15ce9ce7e6a4d40d57c8bb80dbb14fec5 cleanups in CpuCas01: overrides, initialize fields, kill non-obviously dead code --- diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 26df06f386..d38b452506 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2011, 2013-2015. The SimGrid Team. +/* Copyright (c) 2009-2011, 2013-2016. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -17,25 +17,22 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_cas, surf_cpu, *********/ void surf_cpu_model_init_Cas01() { - char *optim = xbt_cfg_get_string(_sg_cfg_set, "cpu/optim"); - xbt_assert(!surf_cpu_model_pm); xbt_assert(!surf_cpu_model_vm); + char *optim = xbt_cfg_get_string(_sg_cfg_set, "cpu/optim"); if (!strcmp(optim, "TI")) { surf_cpu_model_init_ti(); return; } surf_cpu_model_pm = new simgrid::surf::CpuCas01Model(); + xbt_dynar_push(all_existing_models, &surf_cpu_model_pm); + surf_cpu_model_vm = new simgrid::surf::CpuCas01Model(); + xbt_dynar_push(all_existing_models, &surf_cpu_model_vm); sg_platf_postparse_add_cb(simgrid::surf::cpu_add_traces); - - simgrid::surf::Model *model_pm = surf_cpu_model_pm; - simgrid::surf::Model *model_vm = surf_cpu_model_vm; - xbt_dynar_push(all_existing_models, &model_pm); - xbt_dynar_push(all_existing_models, &model_vm); } namespace simgrid { @@ -63,19 +60,7 @@ CpuCas01Model::CpuCas01Model() : simgrid::surf::CpuModel() p_cpuRunningActionSetThatDoesNotNeedBeingChecked = new ActionList(); - if (getUpdateMechanism() == UM_LAZY) { - shareResources = &CpuCas01Model::shareResourcesLazy; - updateActionsState = &CpuCas01Model::updateActionsStateLazy; - - } else if (getUpdateMechanism() == UM_FULL) { - shareResources = &CpuCas01Model::shareResourcesFull; - updateActionsState = &CpuCas01Model::updateActionsStateFull; - } else - xbt_die("Invalid cpu update mechanism!"); - - if (!p_maxminSystem) { - p_maxminSystem = lmm_system_new(m_selectiveUpdate); - } + p_maxminSystem = lmm_system_new(m_selectiveUpdate); if (getUpdateMechanism() == UM_LAZY) { p_actionHeap = xbt_heap_new(8, NULL); @@ -303,11 +288,6 @@ CpuAction *CpuCas01::sleep(double duration) return action; } -double CpuCas01::getCurrentPowerPeak() -{ - return m_speedPeak; -} - /********** * Action * **********/ diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index 294b8d7b60..d3e1275d2a 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2013-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2013-2016. 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. */ @@ -28,16 +27,13 @@ public: CpuCas01Model(); ~CpuCas01Model(); - double (CpuCas01Model::*shareResources)(double now); - void (CpuCas01Model::*updateActionsState)(double now, double delta); - Cpu *createCpu(simgrid::Host *host, xbt_dynar_t speedPeak, int pstate, double speedScale, tmgr_trace_t speedTrace, int core, e_surf_resource_state_t state_initial, - tmgr_trace_t state_trace); - double shareResourcesFull(double now); - void addTraces(); + tmgr_trace_t state_trace) override; + double shareResourcesFull(double now) override; + void addTraces() override; ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked; }; @@ -51,17 +47,17 @@ public: int pstate, double speedScale, tmgr_trace_t speedTrace, int core, e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace) ; ~CpuCas01(); - void updateState(tmgr_trace_event_t event_type, double value, double date); - CpuAction *execute(double size); - CpuAction *sleep(double duration); + void updateState(tmgr_trace_event_t event_type, double value, double date) override; + CpuAction *execute(double size) override; + CpuAction *sleep(double duration) override; - double getCurrentPowerPeak(); bool isUsed() override; void setStateEvent(tmgr_trace_event_t stateEvent); void setPowerEvent(tmgr_trace_event_t stateEvent); - xbt_dynar_t getSpeedPeakList(); + xbt_dynar_t getSpeedPeakList(); private: + tmgr_trace_event_t p_stateEvent; tmgr_trace_event_t p_speedEvent; }; diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index f175f4c534..516a2c95b6 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2004-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2004-2016. 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. */ @@ -378,7 +377,7 @@ public: protected: ActionLmmListPtr p_modifiedSet; - lmm_system_t p_maxminSystem; + lmm_system_t p_maxminSystem = nullptr; e_UM_t p_updateMechanism = UM_UNDEFINED; int m_selectiveUpdate; xbt_heap_t p_actionHeap;