- 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,6 +66,11 @@ main(int argc, char** argv)
// Initialize all preferences and load plugins
PluginManager::get_instance();
vector<Module*> modules = PluginManager::get_instance().get_module_list();
for (vector<Module*>::iterator it = modules.begin(); it != modules.end(); ++it)
(*it)->set_enabled(true);
Simulation& sim=Simulation::get_instance();
History& hi=sim.get_history();
@ -79,13 +93,21 @@ hi.add_thread("T5",pz5,2,8,2);
cout<<sim.get_mode();
typedef CPUPoliciesGatekeeper::Managers ManagerVec;
typedef CPUPoliciesGatekeeper::Manager::Policies PolicyVec;
typedef CPUPoliciesGatekeeper::Managers CpuManagerVec;
typedef CPUPoliciesGatekeeper::Manager::Policies CpuPolicyVec;
ManagerVec managers = CPUPoliciesGatekeeper::get_instance().get_registered();
PolicyVec policies = managers[0]->get_avail_policies();
CPUPolicy* p=policies[0];
sim.set_policy(p);
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();