sgpemv2/src/testsuite/test-python_loader.cc

67 lines
2.2 KiB
C++
Raw Normal View History

// src/testsuite/test-python_loader.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
/* This executable tests for workingness of the PythonPolicyManager
* class and its closely related cousins. More documentation to be written
* here, thanks very much. */
#include "backend/pyloader/python_policy_manager.hh"
#include "backend/process.hh"
#include "backend/schedulable_status.hh"
#include "backend/schedulable_list.hh"
#include "backend/scheduler.hh"
#include <cassert>
int
main(int, char** ) {
using namespace sgpem;
// Create an INITIAL STATE
Process p1("P1", 0,5,1);
Process p2("P2", 0,5,2);
Process p3("P3", 5,3,3);
Process p4("P4", 6,2,3);
Process p5("P5", 1,2,3);
Process p6("P6", 10,2,1);
SchedulableStatus ss1(p1);
SchedulableStatus ss2(p2);
SchedulableStatus ss3(p3);
SchedulableStatus ss4(p4);
SchedulableStatus ss5(p5);
SchedulableStatus ss6(p6);
SchedulableList initial;
initial.add_at_bottom(ss1);
initial.add_at_bottom(ss2);
initial.add_at_bottom(ss3);
initial.add_at_bottom(ss4);
initial.add_at_bottom(ss5);
initial.add_at_bottom(ss6);
History::get_instance().enqueue_slice(initial);
PythonPolicyManager* ppm = PythonPolicyManager::get_instance();
ppm->init();
Policy& pol = ppm->get_policy();
pol.configure();
std::cout << pol.get_time_slice() << std::endl;
pol.sort_queue(Scheduler::event_schedulable_arrival);
}