- 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:
parent
897462a1e0
commit
4be1fff629
|
@ -497,11 +497,11 @@ src_testsuite_test_history_SOURCES = \
|
||||||
|
|
||||||
src_testsuite_test_statistics_CPPFLAGS = \
|
src_testsuite_test_statistics_CPPFLAGS = \
|
||||||
-I@top_srcdir@/src/backend \
|
-I@top_srcdir@/src/backend \
|
||||||
$(GLIBMM_CFLAGS)
|
$(GLIBMM_CFLAGS) $(GTHREAD_CFLAGS)
|
||||||
src_testsuite_test_statistics_LDFLAGS = \
|
src_testsuite_test_statistics_LDFLAGS = \
|
||||||
-Wl,-rpath -Wl,"$(pkglibdir)" \
|
-Wl,-rpath -Wl,"$(pkglibdir)" \
|
||||||
src/backend/libbackend.la \
|
src/backend/libbackend.la \
|
||||||
$(GLIBMM_LIBS)
|
$(GLIBMM_LIBS) $(GTHREAD_LIBS)
|
||||||
src_testsuite_test_statistics_SOURCES = \
|
src_testsuite_test_statistics_SOURCES = \
|
||||||
src/backend/statistics.cc \
|
src/backend/statistics.cc \
|
||||||
src/backend/concrete_process_statistics.cc \
|
src/backend/concrete_process_statistics.cc \
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
||||||
#include <glibmm/ustring.h>
|
|
||||||
|
|
||||||
#include<vector>
|
#include<vector>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -33,12 +31,20 @@
|
||||||
|
|
||||||
#include <sgpemv2/simulation.hh>
|
#include <sgpemv2/simulation.hh>
|
||||||
#include <sgpemv2/cpu_policies_gatekeeper.hh>
|
#include <sgpemv2/cpu_policies_gatekeeper.hh>
|
||||||
|
#include <sgpemv2/resource_policies_gatekeeper.hh>
|
||||||
#include <sgpemv2/cpu_policy_manager.hh>
|
#include <sgpemv2/cpu_policy_manager.hh>
|
||||||
|
#include <sgpemv2/resource_policy_manager.hh>
|
||||||
#include <sgpemv2/cpu_policy.hh>
|
#include <sgpemv2/cpu_policy.hh>
|
||||||
|
#include <sgpemv2/resource_policy.hh>
|
||||||
#include <sgpemv2/plugin_manager.hh>
|
#include <sgpemv2/plugin_manager.hh>
|
||||||
#include <sgpemv2/statistics.hh>
|
#include <sgpemv2/statistics.hh>
|
||||||
#include <sgpemv2/process_statistics.hh>
|
#include <sgpemv2/process_statistics.hh>
|
||||||
#include <sgpemv2/thread_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 sgpem;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -49,6 +55,9 @@ using Glib::ustring;
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
// Set up Glib thread support
|
||||||
|
Glib::thread_init();
|
||||||
|
|
||||||
ostream& info = cout;
|
ostream& info = cout;
|
||||||
ostream& test = cerr;
|
ostream& test = cerr;
|
||||||
|
|
||||||
|
@ -57,36 +66,49 @@ main(int argc, char** argv)
|
||||||
// Initialize all preferences and load plugins
|
// Initialize all preferences and load plugins
|
||||||
PluginManager::get_instance();
|
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);
|
Simulation& sim=Simulation::get_instance();
|
||||||
hi.add_thread("T1",pz1,3,0,2);
|
|
||||||
|
|
||||||
Process& pz2=hi.add_process("P2",1,3);
|
History& hi=sim.get_history();
|
||||||
hi.add_thread("T2",pz2,7,1,3);
|
|
||||||
|
|
||||||
Process& pz3=hi.add_process("P3",3,5);
|
Process& pz1=hi.add_process("P1",0,2);
|
||||||
hi.add_thread("T3",pz3,4,3,5);
|
hi.add_thread("T1",pz1,3,0,2);
|
||||||
|
|
||||||
Process& pz4=hi.add_process("P4",5,3);
|
Process& pz2=hi.add_process("P2",1,3);
|
||||||
hi.add_thread("T4",pz4,6,5,4);
|
hi.add_thread("T2",pz2,7,1,3);
|
||||||
|
|
||||||
Process& pz5=hi.add_process("P5",8,2);
|
Process& pz3=hi.add_process("P3",3,5);
|
||||||
hi.add_thread("T5",pz5,2,8,2);
|
hi.add_thread("T3",pz3,4,3,5);
|
||||||
|
|
||||||
cout<<sim.get_mode();
|
Process& pz4=hi.add_process("P4",5,3);
|
||||||
|
hi.add_thread("T4",pz4,6,5,4);
|
||||||
|
|
||||||
|
Process& pz5=hi.add_process("P5",8,2);
|
||||||
|
hi.add_thread("T5",pz5,2,8,2);
|
||||||
|
|
||||||
|
cout<<sim.get_mode();
|
||||||
|
|
||||||
|
|
||||||
typedef CPUPoliciesGatekeeper::Managers ManagerVec;
|
typedef CPUPoliciesGatekeeper::Managers CpuManagerVec;
|
||||||
typedef CPUPoliciesGatekeeper::Manager::Policies PolicyVec;
|
typedef CPUPoliciesGatekeeper::Manager::Policies CpuPolicyVec;
|
||||||
|
|
||||||
ManagerVec managers = CPUPoliciesGatekeeper::get_instance().get_registered();
|
CpuManagerVec cpu_managers = CPUPoliciesGatekeeper::get_instance().get_registered();
|
||||||
PolicyVec policies = managers[0]->get_avail_policies();
|
CpuPolicyVec cpu_policies = cpu_managers[0]->get_avail_policies();
|
||||||
CPUPolicy* p=policies[0];
|
CPUPolicy* cpu_p=cpu_policies[0];
|
||||||
sim.set_policy(p);
|
sim.set_policy(cpu_p);
|
||||||
sim.run();
|
|
||||||
|
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";
|
info << "Simulation Started\n";
|
||||||
|
|
Loading…
Reference in New Issue