Commit b2584324 authored by Pascal Palenda's avatar Pascal Palenda
Browse files

Apply compatibility changes

parent 96b76c70
......@@ -18,6 +18,7 @@
#include "ITATimer.h"
#include "ITAStringUtils.h"
#include "ITA/SimulationScheduler/Utils/utils.h"
#include "ITAStopWatch.h"
using namespace ITA::SimulationScheduler;
......@@ -136,9 +137,12 @@ struct TimerClass : ITATimerEventHandler
{
const int runs = 5000;
std::unique_ptr<RoomAcoustics::CMasterSimulationController> masterController;
ITAStopWatch sw;
void handleTimerEvent ( const ITATimer& tSource ) override
{
sw.start();
auto update = std::make_unique<CUpdateScene> ( 0 );
auto source = std::make_unique<C3DObject> (
......@@ -152,6 +156,8 @@ struct TimerClass : ITATimerEventHandler
currentTimes [update->GetID ( )] = std::make_pair<double, double> ( ITAClock::getDefaultClock ( )->getTime ( ), -1 );
masterController->PushUpdate ( std::move ( update ) );
sw.stop();
}
};
......@@ -193,20 +199,27 @@ int main ( )
std::stringstream ss;
std::vector<double> percentages = { 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 };
ITAStopWatch sw;
//std::vector<double> percentages = { 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 };
//std::vector<double> percentages = { 0.0, 0.5, 1.0 };
std::vector<double> percentages;
for (auto i = 0; i < 101; ++i)
percentages.push_back(i*0.01);
auto oConfig = RoomAcoustics::CMasterSimulationController::MasterSimulationControllerConfig ( );
auto schedulerConfig = std::make_shared<CScheduler::LocalSchedulerConfig> ( );
auto workerConfig = std::make_shared<DummyWorker::DummyWorkerConfig> ( );
auto filterConfig = std::make_shared<DummyFilter::DummyFilterConfig> ( );
filterConfig->sFilterName = "Filter";
CFilterNetwork::FilterNetworkConfig networkConfig;
networkConfig.sStartFilter = filterConfig->sFilterName;
//networkConfig.sStartFilter = filterConfig->sFilterName;
schedulerConfig->oFilterNetworkConfig = networkConfig;
for ( auto busy : percentages )
{
......@@ -214,69 +227,90 @@ int main ( )
schedulerConfig->vpWorkerConfigs.clear ( );
schedulerConfig->vpWorkerConfigs.push_back ( workerConfig );
oConfig.oDSSchedulerConfig = schedulerConfig;
oConfig.oERSchedulerConfig = schedulerConfig;
oConfig.oDDSchedulerConfig = schedulerConfig;
obj.masterController = std::make_unique<RoomAcoustics::CMasterSimulationController> ( oConfig );
obj.masterController->AttachResultHandler ( resultHandler );
currentTimes.clear ( );
for ( auto audible : percentages )
std::cout << "busy: " << busy << "\n";
oTimer.attach ( &obj );
//if ( !oTimer.isActive ( ) )
// oTimer.start ( );
for (auto i = 0; i < obj.runs + 10; ++i)
{
filterConfig->audibleUpdatePercent = audible;
networkConfig.vpFilterConfigs.clear ( );
networkConfig.vpFilterConfigs.push_back ( filterConfig );
sw.start();
auto update = std::make_unique<CUpdateScene>(0);
schedulerConfig->oFilterNetworkConfig = networkConfig;
auto source = std::make_unique<C3DObject>(
VistaVector3D(1, 1.5, 1), VistaQuaternion(0, 0, 0, 1), C3DObject::Type::source, 1);
auto receiver = std::make_unique<C3DObject>(
VistaVector3D(-0.5, 1.5, -0.5), VistaQuaternion(0, 0, 0, 1), C3DObject::Type::receiver, 1);
oConfig.oDSSchedulerConfig = schedulerConfig;
oConfig.oERSchedulerConfig = schedulerConfig;
oConfig.oDDSchedulerConfig = schedulerConfig;
update->SetSourceReceiverPair(std::move(source),
std::move(receiver));
obj.masterController = std::make_unique<RoomAcoustics::CMasterSimulationController> ( oConfig );
currentTimes[update->GetID()] = std::make_pair<double, double>(ITAClock::getDefaultClock()->getTime(), -1);
obj.masterController->AttachResultHandler ( resultHandler );
obj.masterController->PushUpdate(std::move(update));
double dNow = ITAClock::getDefaultClock()->getTime();
currentTimes.clear ( );
while (ITAClock::getDefaultClock()->getTime() - dNow < (1 / updateRate))
{
}
std::cout << "audible: " << audible << ", busy: " << busy << "\n";
sw.stop();
oTimer.attach ( &obj );
}
if ( !oTimer.isActive ( ) )
oTimer.start ( );
//VistaTimeUtils::Sleep ( obj.runs * oTimer.getDuration ( ) * 1000 );
VistaTimeUtils::Sleep ( obj.runs * oTimer.getDuration ( ) * 1000 );
if ( oTimer.isActive ( ) )
oTimer.stop ( );
//if ( oTimer.isActive ( ) )
// oTimer.stop ( );
obj.masterController->PushUpdate ( std::make_unique<CUpdateConfig> ( CUpdateConfig::ConfigChangeType::shutdown ) );
obj.masterController->PushUpdate ( std::make_unique<CUpdateConfig> ( CUpdateConfig::ConfigChangeType::shutdown ) );
std::vector<double> startTimes ( currentTimes.size ( ) );
std::vector<double> endTimes ( currentTimes.size ( ) );
std::vector<double> startTimes ( currentTimes.size ( ) );
std::vector<double> endTimes ( currentTimes.size ( ) );
std::transform ( currentTimes.begin ( ),
currentTimes.end ( ),
startTimes.begin ( ),
[&] ( const std::pair<int, std::pair<double, double>>& obj ) -> double
{
return obj.second.first - startTime;
} );
std::transform ( currentTimes.begin ( ),
currentTimes.end ( ),
startTimes.begin ( ),
[&] ( const std::pair<int, std::pair<double, double>>& obj ) -> double
{
return obj.second.first - startTime;
} );
std::transform ( currentTimes.begin ( ),
currentTimes.end ( ),
endTimes.begin ( ),
[&] ( const std::pair<int, std::pair<double, double>>& obj ) -> double
{
return obj.second.second - startTime;
} );
std::transform ( currentTimes.begin ( ),
currentTimes.end ( ),
endTimes.begin ( ),
[&] ( const std::pair<int, std::pair<double, double>>& obj ) -> double
{
return obj.second.second - startTime;
} );
ss << "audible: " << audible << " busy: " << busy << " startTimes, ";
ss << "busy: " << busy << " startTimes, ";
ss << Utils::DataTypeUtils::ConvertToString ( startTimes ) << "\n";
ss << Utils::DataTypeUtils::ConvertToString ( startTimes ) << "\n";
ss << "audible: " << audible << " busy: " << busy << " endTimes, ";
ss << "busy: " << busy << " endTimes, ";
ss << Utils::DataTypeUtils::ConvertToString ( endTimes ) << "\n";
}
ss << Utils::DataTypeUtils::ConvertToString ( endTimes ) << "\n";
}
std::cout << sw.ToString() << "\n";
std::ofstream myfile;
myfile.open ( "results.txt" );
myfile << ss.str ( );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment