- Revert garbled commit of fpaparel for process_statistics.hh. I've no time to lose with careless thinkerers.
- Make ConcreteSimulation::step() private as it should always have been - Delete useless SchedulableStateWidget class git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1208 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
86a844c21f
commit
094c58a580
|
@ -388,7 +388,6 @@ sgpemv2_SOURCES = \
|
|||
src/parse_opts.cc \
|
||||
src/ready_queue_widget.cc \
|
||||
src/resources_widget.cc \
|
||||
src/schedulable_state_widget.cc \
|
||||
src/schedulables_statistics_widget.cc \
|
||||
src/schedulables_tree_widget.cc \
|
||||
src/simulation_controller.cc \
|
||||
|
@ -411,7 +410,6 @@ noinst_HEADERS += \
|
|||
src/parse_opts.hh \
|
||||
src/ready_queue_widget.hh \
|
||||
src/resources_widget.hh \
|
||||
src/schedulable_state_widget.hh \
|
||||
src/schedulables_statistics_widget.hh \
|
||||
src/schedulables_tree_widget.hh \
|
||||
src/schedulables_statistics_widget.hh \
|
||||
|
|
|
@ -48,8 +48,6 @@ namespace sgpem
|
|||
|
||||
void stop();
|
||||
|
||||
bool step() throw(UserInterruptException, NullPolicyException, MalformedPolicyException);
|
||||
|
||||
void set_mode(mode new_mode);
|
||||
|
||||
mode get_mode() const;
|
||||
|
@ -70,13 +68,14 @@ namespace sgpem
|
|||
CPUPolicy* get_policy();
|
||||
ResourcePolicy * get_resource_policy();
|
||||
|
||||
|
||||
private:
|
||||
state _state;
|
||||
mode _mode;
|
||||
ConcreteHistory _history;
|
||||
CPUPolicy* _policy;
|
||||
ResourcePolicy* _resource_policy;
|
||||
|
||||
bool step() throw(UserInterruptException, NullPolicyException, MalformedPolicyException);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -34,43 +34,6 @@
|
|||
|
||||
namespace sgpem
|
||||
{
|
||||
<<<<<<< .mine
|
||||
/** \brief Represents the statistics of a Process
|
||||
|
||||
Represents the statistics of a Process. This class is created by "Statistics" class
|
||||
and presents only "getters" methods which execute no calculations: they only return the
|
||||
internal results calulated at construction time. To retrieve these results the whole History
|
||||
(until the instant specified through Statistics::calculateStatisticsAt(int)) and the owned threads's
|
||||
statistics are scanned. For the documentation af all methods refere to class SchedulableStatistics.
|
||||
*/
|
||||
class ProcessStatistics : public SchedulableStatistics
|
||||
{
|
||||
public:
|
||||
~ProcessStatistics();
|
||||
|
||||
int get_execution_time() const =0;
|
||||
int get_execution_progress() const =0;
|
||||
int get_total_inactivity() const =0;
|
||||
int get_response_time() const =0;
|
||||
virtual float get_average_response_time() const =0;
|
||||
int get_turn_around() const =0;
|
||||
int get_efficiency() const =0;
|
||||
int get_resource_usage_time() const =0;
|
||||
int get_resource_waitings_time() const =0;
|
||||
|
||||
const Process* get_core() const =0;
|
||||
|
||||
/** \brief Returns the statistics of all owned threads
|
||||
\returns a vector of pointers to the statistics of all owned threads. These statistics are
|
||||
calculated at construction time: this method is only a "getter".
|
||||
\attention Don't delete() these pointers or memory corruption will occur!
|
||||
*/
|
||||
virtual std::vector<const ThreadStatistics*> get_threads_statistics() const =0;
|
||||
|
||||
protected:
|
||||
ProcessStatistics();
|
||||
};
|
||||
=======
|
||||
class ProcessStatistics : public SchedulableStatistics
|
||||
{
|
||||
public:
|
||||
|
@ -84,7 +47,6 @@ namespace sgpem
|
|||
protected:
|
||||
ProcessStatistics();
|
||||
};
|
||||
>>>>>>> .r1204
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace sgpem
|
|||
exact formula is: #_terminated_processes / current_instant
|
||||
|
||||
\returns The average of terminated processes during one instant
|
||||
*//
|
||||
*/
|
||||
virtual float get_average_processes_throughput() const =0;
|
||||
|
||||
/**
|
||||
|
@ -83,7 +83,7 @@ namespace sgpem
|
|||
exact formula is: #_terminated_threads / current_instant
|
||||
|
||||
\returns The average of terminated threads during one instant
|
||||
*//
|
||||
*/
|
||||
virtual float get_average_threads_throughput() const =0;
|
||||
|
||||
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
// src/schedulable_state_widget.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 "gettext.h"
|
||||
|
||||
#include "schedulable_state_widget.hh"
|
||||
|
||||
#include <sgpemv2/templates/smartp.tcc>
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
||||
memory::smart_ptr<Gtk::Tooltips>
|
||||
SchedulableStateWidget::_global_ttips = NULL;
|
||||
|
||||
|
||||
SchedulableStateWidget::SchedulableStateWidget(Schedulable::state st)
|
||||
: Glib::ObjectBase("sgpem_SchedulableStateWidget"), CairoWidget(), _color(1, 1, 1)
|
||||
{
|
||||
// Yes, we leak, but this will be up until the end of the app
|
||||
if(!_global_ttips) _global_ttips = new Gtk::Tooltips();
|
||||
_ttips = _global_ttips;
|
||||
|
||||
set_scaling_mode(scaling_to_w);
|
||||
set_state(st);
|
||||
}
|
||||
|
||||
SchedulableStateWidget::~SchedulableStateWidget()
|
||||
{
|
||||
_ttips->unset_tip(*this);
|
||||
_ttips = memory::smart_ptr<Gtk::Tooltips>::null;
|
||||
if(_global_ttips.alive_refs() == 1)
|
||||
_global_ttips = memory::smart_ptr<Gtk::Tooltips>::null;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SchedulableStateWidget::set_state(Schedulable::state new_state)
|
||||
{
|
||||
Glib::ustring tip;
|
||||
switch(new_state)
|
||||
{
|
||||
case Schedulable::state_future:
|
||||
_color = Color(1, 1, 1); // White
|
||||
tip = _("Future");
|
||||
break;
|
||||
case Schedulable::state_ready:
|
||||
_color = Color(1, 1, 0); // Yellow
|
||||
tip = _("Ready");
|
||||
break;
|
||||
case Schedulable::state_running:
|
||||
_color = Color(0, 1, 0); // Green
|
||||
tip = _("Running");
|
||||
break;
|
||||
case Schedulable::state_blocked:
|
||||
_color = Color(1, 0, 0); // Red
|
||||
tip = _("Blocked");
|
||||
break;
|
||||
case Schedulable::state_terminated:
|
||||
_color = Color(0, 0, 0); // Black
|
||||
tip = _("Terminated");
|
||||
break;
|
||||
}
|
||||
|
||||
if(is_realized())
|
||||
{
|
||||
assert(has_no_window() == false);
|
||||
_ttips->set_tip(*this, tip);
|
||||
}
|
||||
|
||||
queue_draw();
|
||||
}
|
||||
|
||||
void
|
||||
SchedulableStateWidget::draw_widget(cairo_t* ctx)
|
||||
{
|
||||
CairoElements ce(ctx);
|
||||
static const Point center(.5f, .5f);
|
||||
ce.draw_3dsphere(center, .49f, _color);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SchedulableStateWidget::calc_drawing_size(size_t& width, size_t& height) const
|
||||
{
|
||||
width = 1;
|
||||
height = 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SchedulableStateWidget::calc_widget_size(size_t& width, size_t& height) const
|
||||
{
|
||||
static const size_t min_size = 15; // px
|
||||
|
||||
if(width != height)
|
||||
if(width < min_size || height < min_size)
|
||||
width = height = min_size;
|
||||
else
|
||||
width = height = std::min(width, height);
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
// src/schedulable_state_widget.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_STATE_WIDGET_HH
|
||||
#define SCHEDULABLE_STATE_WIDGET_HH 1
|
||||
|
||||
|
||||
|
||||
#include <sgpemv2/schedulable.hh>
|
||||
#include "cairo_elements.hh"
|
||||
#include "cairo_widget.hh"
|
||||
|
||||
#include <sgpemv2/templates/smartp.tcc>
|
||||
|
||||
#include "gtkmm/tooltips.h"
|
||||
|
||||
namespace sgpem
|
||||
{
|
||||
class SchedulableStateWidget : public CairoWidget
|
||||
{
|
||||
public:
|
||||
SchedulableStateWidget(Schedulable::state st);
|
||||
~SchedulableStateWidget();
|
||||
|
||||
void set_state(Schedulable::state new_state);
|
||||
|
||||
protected:
|
||||
virtual void draw_widget(cairo_t* ctx);
|
||||
|
||||
// with this method CairoWidget tells the needed drawing dimensions
|
||||
virtual void calc_drawing_size(size_t& width, size_t& height) const;
|
||||
|
||||
// with this method CairoWidget tells the needed widget dimensions
|
||||
virtual void calc_widget_size(size_t& width, size_t& height) const;
|
||||
|
||||
private:
|
||||
static memory::smart_ptr<Gtk::Tooltips> _global_ttips;
|
||||
|
||||
Color _color;
|
||||
memory::smart_ptr<Gtk::Tooltips> _ttips;
|
||||
};
|
||||
|
||||
} //~ namespace sgpem
|
||||
|
||||
|
||||
#endif //~ SCHEDULABLE_STATE_WIDGET_HH
|
Loading…
Reference in New Issue