From 4be1fff62955ee8030dfe80612b5e0d3a1cf384d Mon Sep 17 00:00:00 2001 From: elvez Date: Sun, 17 Sep 2006 23:28:48 +0000 Subject: [PATCH] - Fixed some bugs in test-statistics, there are still a lot of problems, it seems... git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1270 3ecf2c5c-341e-0410-92b4-d18e462d057c --- Makefile.am | 4 +- src/testsuite/test-statistics.cc | 70 +++++++++++++++++++++----------- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/Makefile.am b/Makefile.am index 550c886..4ab5a99 100644 --- a/Makefile.am +++ b/Makefile.am @@ -497,11 +497,11 @@ src_testsuite_test_history_SOURCES = \ src_testsuite_test_statistics_CPPFLAGS = \ -I@top_srcdir@/src/backend \ - $(GLIBMM_CFLAGS) + $(GLIBMM_CFLAGS) $(GTHREAD_CFLAGS) src_testsuite_test_statistics_LDFLAGS = \ -Wl,-rpath -Wl,"$(pkglibdir)" \ src/backend/libbackend.la \ - $(GLIBMM_LIBS) + $(GLIBMM_LIBS) $(GTHREAD_LIBS) src_testsuite_test_statistics_SOURCES = \ src/backend/statistics.cc \ src/backend/concrete_process_statistics.cc \ diff --git a/src/testsuite/test-statistics.cc b/src/testsuite/test-statistics.cc index 62073eb..aa89e2f 100644 --- a/src/testsuite/test-statistics.cc +++ b/src/testsuite/test-statistics.cc @@ -24,8 +24,6 @@ #include "config.h" #include "gettext.h" -#include - #include #include #include @@ -33,12 +31,20 @@ #include #include +#include #include +#include #include +#include #include #include #include #include +#include + +#include +#include +#include using namespace sgpem; using namespace std; @@ -49,6 +55,9 @@ using Glib::ustring; int main(int argc, char** argv) { + // Set up Glib thread support + Glib::thread_init(); + ostream& info = cout; ostream& test = cerr; @@ -57,36 +66,49 @@ main(int argc, char** argv) // Initialize all preferences and load plugins PluginManager::get_instance(); -Simulation& sim=Simulation::get_instance(); + vector modules = PluginManager::get_instance().get_module_list(); -History& hi=sim.get_history(); + for (vector::iterator it = modules.begin(); it != modules.end(); ++it) + (*it)->set_enabled(true); -Process& pz1=hi.add_process("P1",0,2); -hi.add_thread("T1",pz1,3,0,2); + Simulation& sim=Simulation::get_instance(); -Process& pz2=hi.add_process("P2",1,3); -hi.add_thread("T2",pz2,7,1,3); - -Process& pz3=hi.add_process("P3",3,5); -hi.add_thread("T3",pz3,4,3,5); + History& hi=sim.get_history(); -Process& pz4=hi.add_process("P4",5,3); -hi.add_thread("T4",pz4,6,5,4); + Process& pz1=hi.add_process("P1",0,2); + hi.add_thread("T1",pz1,3,0,2); -Process& pz5=hi.add_process("P5",8,2); -hi.add_thread("T5",pz5,2,8,2); + Process& pz2=hi.add_process("P2",1,3); + hi.add_thread("T2",pz2,7,1,3); -cout<get_avail_policies(); -CPUPolicy* p=policies[0]; -sim.set_policy(p); -sim.run(); + Process& pz5=hi.add_process("P5",8,2); + hi.add_thread("T5",pz5,2,8,2); + + cout<get_avail_policies(); + CPUPolicy* cpu_p=cpu_policies[0]; + sim.set_policy(cpu_p); + + typedef ResourcePoliciesGatekeeper::Managers ResourceManagerVec; + typedef ResourcePoliciesGatekeeper::Manager::Policies ResourcePolicyVec; + + ResourceManagerVec resource_managers = ResourcePoliciesGatekeeper::get_instance().get_registered(); + ResourcePolicyVec resource_policies = resource_managers[0]->get_avail_policies(); + ResourcePolicy* resource_p=resource_policies[0]; + sim.set_resource_policy(resource_p); + sim.run(); info << "Simulation Started\n";