diff --git a/Makefile.am b/Makefile.am index e6edb49..7a46ad3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -157,6 +157,7 @@ src_backend_libbackend_la_SOURCES = \ src/backend/concrete_environment.cc \ src/backend/concrete_history.cc \ src/backend/concrete_simulation.cc \ + src/backend/concrete_statistics.cc \ src/backend/cpu_policies_gatekeeper.cc \ src/backend/cpu_policy.cc \ src/backend/cpu_policy_exception.cc \ @@ -189,6 +190,7 @@ src_backend_libbackend_la_SOURCES = \ src/backend/resource_policy_lifo.cc \ src/backend/resource_policy_manager.cc \ src/backend/schedulable.cc \ + src/backend/schedulable_statistics.cc \ src/backend/scheduler.cc \ src/backend/serialize_visitor.cc \ src/backend/serializer.cc \ @@ -202,9 +204,11 @@ src_backend_libbackend_la_SOURCES = \ src/backend/static_schedulable.cc \ src/backend/static_sub_request.cc \ src/backend/static_thread.cc \ + src/backend/statistics.cc \ src/backend/string_utils.cc \ src/backend/sub_request.cc \ src/backend/thread.cc \ + src/backend/thread_statistics.cc \ src/backend/user_interrupt_exception.cc # Put here header files that will be installed for the user @@ -238,13 +242,15 @@ pkginclude_HEADERS += \ src/backend/sgpemv2/resource_policy_manager.hh \ src/backend/sgpemv2/process.hh \ src/backend/sgpemv2/schedulable.hh \ - src/backend/sgpemv2/scheduler.hh \ + src/backend/sgpemv2/schedulable_statistics.hh \ + src/backend/sgpemv2/scheduler.hh \ src/backend/sgpemv2/serialize_visitor.hh \ src/backend/sgpemv2/serializer.hh \ src/backend/sgpemv2/serializer_error.hh \ src/backend/sgpemv2/serializers_gatekeeper.hh \ src/backend/sgpemv2/simulation.hh \ src/backend/sgpemv2/simulation_observer.hh \ + src/backend/sgpemv2/statistics.hh \ src/backend/sgpemv2/string_utils.hh \ src/backend/sgpemv2/sub_request.hh \ src/backend/sgpemv2/thread.hh \ @@ -257,6 +263,7 @@ noinst_HEADERS += \ src/backend/concrete_environment.hh \ src/backend/concrete_history.hh \ src/backend/concrete_simulation.hh \ + src/backend/concrete_statistics.hh \ src/backend/dynamic_process.hh \ src/backend/dynamic_request.hh \ src/backend/dynamic_resource.hh \ @@ -268,7 +275,8 @@ noinst_HEADERS += \ src/backend/static_resource.hh \ src/backend/static_schedulable.hh \ src/backend/static_sub_request.hh \ - src/backend/static_thread.hh + src/backend/static_thread.hh \ + src/backend/thread_statistics.hh # ############################################################ diff --git a/src/backend/concrete_statistics.cc b/src/backend/concrete_statistics.cc new file mode 100644 index 0000000..11db894 --- /dev/null +++ b/src/backend/concrete_statistics.cc @@ -0,0 +1,34 @@ +// src/backend/concrete_statistics.cc - Copyright 2005, 2006, University +// of Padova, dept. of Pure and Applied +// Mathematics +// +// This file is part of SGPEMv2. +// +// This is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// SGPEMv2 is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with SGPEMv2; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#include "concrete_statistics.hh" + +using namespace sgpem; + +ConcreteStatistics::ConcreteStatistics() +{} + + +std::vector +ConcreteStatistics::get_schedulable_statistics(const int& instant) const +{ + return std::vector(); +} + diff --git a/src/backend/concrete_statistics.hh b/src/backend/concrete_statistics.hh new file mode 100644 index 0000000..818d92c --- /dev/null +++ b/src/backend/concrete_statistics.hh @@ -0,0 +1,45 @@ +// src/backend/concrete_statistics.hh - Copyright 2005, 2006, University +// of Padova, dept. of Pure and Applied +// Mathematics +// +// This file is part of SGPEMv2. +// +// This is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// SGPEMv2 is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with SGPEMv2; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#ifndef CONCRETE_STATISTICS_HH +#define CONCRETE_STATISTICS_HH 1 + +#include "config.h" + +#include "sgpemv2/statistics.hh" +#include + + +namespace sgpem +{ + class ConcreteStatistics; + + class ConcreteStatistics : public Statistics + { + public: + ConcreteStatistics(); + + std::vector get_schedulable_statistics(const int& instant) const; + + + }; +} + +#endif diff --git a/src/backend/schedulable_statistics.cc b/src/backend/schedulable_statistics.cc new file mode 100644 index 0000000..d2e7bd4 --- /dev/null +++ b/src/backend/schedulable_statistics.cc @@ -0,0 +1,30 @@ +// src/backend/schedulable_statistics.cc - Copyright 2005, 2006, University +// of Padova, dept. of Pure and Applied +// Mathematics +// +// This file is part of SGPEMv2. +// +// This is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// SGPEMv2 is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with SGPEMv2; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#include "sgpemv2/schedulable_statistics.hh" + +using namespace sgpem; + +SchedulableStatistics::SchedulableStatistics() +{} + +SchedulableStatistics::~SchedulableStatistics() +{} + diff --git a/src/backend/sgpemv2/schedulable_statistics.hh b/src/backend/sgpemv2/schedulable_statistics.hh new file mode 100644 index 0000000..4cf6782 --- /dev/null +++ b/src/backend/sgpemv2/schedulable_statistics.hh @@ -0,0 +1,50 @@ +// src/backend/schedulable_statistics.hh - Copyright 2005, 2006, University +// of Padova, dept. of Pure and Applied +// Mathematics +// +// This file is part of SGPEMv2. +// +// This is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// SGPEMv2 is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with SGPEMv2; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#ifndef SCHEDULABLE_STATISTICS_HH +#define SCHEDULABLE_STATISTICS_HH 1 + +#include "config.h" + +#include "schedulable.hh" +#include + + +namespace sgpem +{ + class SchedulableStatistics + { + public: + virtual ~SchedulableStatistics(); + + virtual int get_execution_time() const =0; + /*virtual int get_total_waitings() const =0; + virtual int get_response_time() const =0; + virtual int get_turn_around() const =0; + */ + virtual const Schedulable* get_core() const =0; + + protected: + + SchedulableStatistics(); + }; +} + +#endif diff --git a/src/backend/sgpemv2/statistics.hh b/src/backend/sgpemv2/statistics.hh new file mode 100755 index 0000000..00b89e9 --- /dev/null +++ b/src/backend/sgpemv2/statistics.hh @@ -0,0 +1,53 @@ +// src/backend/statistics.hh - Copyright 2005, 2006, University +// of Padova, dept. of Pure and Applied +// Mathematics +// +// This file is part of SGPEMv2. +// +// This is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// SGPEMv2 is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with SGPEMv2; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#ifndef STATISTICS_HH +#define STATISTICS_HH 1 + +#include "config.h" +#include "sgpemv2/templates/singleton.hh" +#include "schedulable_statistics.hh" +#include + +#include + +namespace sgpem +{ + class Statistics; + class ConcreteStatistics; + + class SG_DLLEXPORT Statistics : public Singleton + { + public: + //typedef std::vector SchedulableStatistics; + + virtual ~Statistics() = 0; + static Statistics& get_instance(); + + virtual std::vector get_schedulable_statistics(const int& instant) const = 0; + + protected: + + Statistics(); // Constructor + + }; +} + +#endif diff --git a/src/backend/statistics.cc b/src/backend/statistics.cc new file mode 100755 index 0000000..44641b0 --- /dev/null +++ b/src/backend/statistics.cc @@ -0,0 +1,39 @@ +// src/backend/statistics.cc - Copyright 2005, 2006, University +// of Padova, dept. of Pure and Applied +// Mathematics +// +// This file is part of SGPEMv2. +// +// This is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// SGPEMv2 is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with SGPEMv2; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#include "sgpemv2/statistics.hh" +#include "concrete_statistics.hh" + +// Do not include in header file: +#include "sgpemv2/templates/singleton.tcc" + +using namespace sgpem; + +Statistics::~Statistics() +{} + +Statistics::Statistics() +{} + +Statistics& +Statistics::get_instance() +{ + return Singleton::get_instance(); +} \ No newline at end of file diff --git a/src/backend/thread_statistics.cc b/src/backend/thread_statistics.cc new file mode 100644 index 0000000..efb2bc0 --- /dev/null +++ b/src/backend/thread_statistics.cc @@ -0,0 +1,49 @@ +// src/backend/thread_statistics.cc - Copyright 2005, 2006, University +// of Padova, dept. of Pure and Applied +// Mathematics +// +// This file is part of SGPEMv2. +// +// This is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// SGPEMv2 is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with SGPEMv2; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#include "thread_statistics.hh" +#include "sgpemv2/simulation.hh" +#include "sgpemv2/history.hh" +#include "sgpemv2/environment.hh" + + +using namespace sgpem; + +ThreadStatistics::ThreadStatistics(const Thread* core, const int& instant): _core(core) +{ + +} + +ThreadStatistics::~ThreadStatistics() +{ +} + +int +ThreadStatistics::get_execution_time() const +{ + return 99; +} + + +const Thread* +ThreadStatistics::get_core() const +{ + return _core; +} diff --git a/src/backend/thread_statistics.hh b/src/backend/thread_statistics.hh new file mode 100644 index 0000000..106a971 --- /dev/null +++ b/src/backend/thread_statistics.hh @@ -0,0 +1,51 @@ +// src/backend/thread_statistics.hh - Copyright 2005, 2006, University +// of Padova, dept. of Pure and Applied +// Mathematics +// +// This file is part of SGPEMv2. +// +// This is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// SGPEMv2 is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with SGPEMv2; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#ifndef CONCRETE_STATISTICS_HH +#define CONCRETE_STATISTICS_HH 1 + +#include "config.h" + +#include "sgpemv2/schedulable_statistics.hh" +#include "sgpemv2/thread.hh" + +#include + + +namespace sgpem +{ + class ThreadStatistics : public SchedulableStatistics + { + public: + ThreadStatistics(const Thread* core, const int& instant); + ~ThreadStatistics(); + + int get_execution_time() const; + /* int get_total_waitings() const; + int get_response_time() const; + int get_turn_around() const; + */ const Thread* get_core() const; + + private: + const Thread* _core; + }; +} + +#endif