- added scheduler and other incomplete backend classes
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@319 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
98cc6fb20b
commit
e2a0c3f248
21 changed files with 820 additions and 237 deletions
68
src/main.cc
68
src/main.cc
|
@ -27,10 +27,10 @@
|
|||
|
||||
#include "templates/smartp.hh"
|
||||
#include "backend/history.hh"
|
||||
#include "backend/slice.hh"
|
||||
#include "backend/schedulable.hh"
|
||||
#include "backend/schedulable_list.hh"
|
||||
#include "backend/schedulable_status.hh"
|
||||
#include "backend/simulation_status.hh"
|
||||
#include "backend/slice.hh"
|
||||
#include "backend/process.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
@ -68,32 +68,45 @@ main(int argc, char* argv[])
|
|||
Process p1("P1", 0,10,1);
|
||||
Process p2("P2", 0,30,2);
|
||||
Process p3("P3", 5,15,3);
|
||||
Process p4("P4", 6,5,3);
|
||||
Process p5("P5", 1,10,3);
|
||||
Process p6("P6", 10,2,1);
|
||||
|
||||
SchedulableStatus ss1(p1);
|
||||
SchedulableStatus ss1(p1); ss1.set_state(SchedulableStatus::state_running);
|
||||
SchedulableStatus ss2(p2);
|
||||
SchedulableStatus ss3(p3);
|
||||
SchedulableStatus ss4(p4); ss4.set_state(SchedulableStatus::state_running);
|
||||
SchedulableStatus ss5(p5);
|
||||
SchedulableStatus ss6(p6);
|
||||
|
||||
SimulationStatus sim1; sim1.set_running(p1);
|
||||
SimulationStatus sim2; sim2.set_running(p2);
|
||||
SimulationStatus sim3; sim3.set_running(p3);
|
||||
// SimulationStatus sim1; sim1.set_running(p1);
|
||||
|
||||
History h(History::getInstance());
|
||||
//************** TEST HISTORY
|
||||
|
||||
h.enqueue_slice(sim1);
|
||||
h.enqueue_slice(sim1);
|
||||
h.enqueue_slice(sim2);
|
||||
h.enqueue_slice(sim1);
|
||||
h.enqueue_slice(sim2);
|
||||
h.enqueue_slice(sim1);
|
||||
h.enqueue_slice(sim2);
|
||||
h.enqueue_slice(sim3);
|
||||
h.enqueue_slice(sim3);
|
||||
h.enqueue_slice(sim1);
|
||||
h.enqueue_slice(sim3);
|
||||
h.enqueue_slice(sim1);
|
||||
SchedulableList l1;
|
||||
l1.add_at_top(ss1); l1.add_at_top(ss2); l1.add_at_top(ss3);
|
||||
|
||||
h.truncate_at(3);
|
||||
SchedulableList l2;
|
||||
l2.add_at_top(ss4); l2.add_at_top(ss5); l2.add_at_top(ss6);
|
||||
|
||||
History h(History::get_instance());
|
||||
h.enqueue_slice(l1); //stato iniziale
|
||||
h.enqueue_slice(l2);
|
||||
|
||||
smart_ptr<const sgpem::SchedulableList> quale;
|
||||
|
||||
quale = h.get_simulation_status_at(0); //stato iniziale
|
||||
|
||||
cout << quale->get_item_at(0)->get_schedulable()->get_name();
|
||||
smart_ptr<const sgpem::SchedulableStatus> quale2 = h.get_scheduled_at(1);
|
||||
cout << quale2->get_schedulable()->get_name();
|
||||
|
||||
h.truncate_at(0);
|
||||
quale = h.get_simulation_status_at(0); //stato iniziale
|
||||
|
||||
cout << bool(quale) << " " << quale->get_item_at(0)->get_schedulable()->get_name();
|
||||
|
||||
/*
|
||||
smart_ptr<const sgpem::SimulationStatus> quale;
|
||||
|
||||
quale = h.get_simulation_status_at(0);
|
||||
|
@ -112,8 +125,23 @@ main(int argc, char* argv[])
|
|||
if (quale2) cout << "\n" << quale2->get_schedulable()->get_name(); else cout << "NO";
|
||||
quale2 = h.get_scheduled_at(2);
|
||||
if (quale2) cout << "\n" << quale2->get_schedulable()->get_name(); else cout << "NO";
|
||||
*/
|
||||
|
||||
//************** TEST QUEUE
|
||||
cout << "\n\nTEST QUEUE\n";
|
||||
|
||||
/* SchedulableQueue sq;
|
||||
sq.add_at_top(ss1);
|
||||
sq.add_at_top(ss2);
|
||||
sq.add_at_bottom(ss3);
|
||||
cout << sq.get_item_at(0)->get_schedulable()->get_name() << "\n";
|
||||
cout << sq.get_item_at(1)->get_schedulable()->get_name() << "\n";
|
||||
cout << sq.get_item_at(2)->get_schedulable()->get_name() << "\n";
|
||||
sq.insert_at(0,2);
|
||||
cout << sq.get_item_at(0)->get_schedulable()->get_name() << "\n";
|
||||
cout << sq.get_item_at(1)->get_schedulable()->get_name() << "\n";
|
||||
cout << sq.get_item_at(2)->get_schedulable()->get_name() << "\n";
|
||||
*/
|
||||
cout << "\n\n";
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue