- 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
This commit is contained in:
elvez 2006-09-17 23:28:48 +00:00
parent 897462a1e0
commit 4be1fff629
2 changed files with 48 additions and 26 deletions

View File

@ -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 \

View File

@ -24,8 +24,6 @@
#include "config.h"
#include "gettext.h"
#include <glibmm/ustring.h>
#include<vector>
#include <cassert>
#include <iostream>
@ -33,12 +31,20 @@
#include <sgpemv2/simulation.hh>
#include <sgpemv2/cpu_policies_gatekeeper.hh>
#include <sgpemv2/resource_policies_gatekeeper.hh>
#include <sgpemv2/cpu_policy_manager.hh>
#include <sgpemv2/resource_policy_manager.hh>
#include <sgpemv2/cpu_policy.hh>
#include <sgpemv2/resource_policy.hh>
#include <sgpemv2/plugin_manager.hh>
#include <sgpemv2/statistics.hh>
#include <sgpemv2/process_statistics.hh>
#include <sgpemv2/thread_statistics.hh>
#include <sgpemv2/module.hh>
#include <glibmm/module.h>
#include <glibmm/ustring.h>
#include <glibmm/thread.h>
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<Module*> modules = PluginManager::get_instance().get_module_list();
History& hi=sim.get_history();
for (vector<Module*>::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<<sim.get_mode();
Process& pz3=hi.add_process("P3",3,5);
hi.add_thread("T3",pz3,4,3,5);
typedef CPUPoliciesGatekeeper::Managers ManagerVec;
typedef CPUPoliciesGatekeeper::Manager::Policies PolicyVec;
Process& pz4=hi.add_process("P4",5,3);
hi.add_thread("T4",pz4,6,5,4);
ManagerVec managers = CPUPoliciesGatekeeper::get_instance().get_registered();
PolicyVec policies = managers[0]->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<<sim.get_mode();
typedef CPUPoliciesGatekeeper::Managers CpuManagerVec;
typedef CPUPoliciesGatekeeper::Manager::Policies CpuPolicyVec;
CpuManagerVec cpu_managers = CPUPoliciesGatekeeper::get_instance().get_registered();
CpuPolicyVec cpu_policies = cpu_managers[0]->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";