Skip to content

Commit

Permalink
Fix debugging/stats flags in proxsim.
Browse files Browse the repository at this point in the history
In proxsim, set flags before any simulator/handler initialization
occurs. Fix RebuildingQueryHandler to pass these flags along so that
they actually print out their info. Previously the flags weren't
passed along and RebuildingQueryHandler does almost no work itself, so
it never printed any information.
  • Loading branch information
ewencp committed Feb 16, 2013
1 parent e4f646a commit 991a188
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
18 changes: 17 additions & 1 deletion libprox/include/prox/geom/RebuildingQueryHandler.hpp
Expand Up @@ -126,6 +126,7 @@ class RebuildingQueryHandler :
mLocUpdateProvider->removeUpdateListener(this);
}


virtual void initialize(LocationServiceCacheType* loc_cache, LocationUpdateProviderType* loc_up_provider, bool static_objects, bool replicated, ShouldTrackCallback should_track_cb = 0) {
// Rebuilding doesn't make sense if you're using replicated data.
assert(!replicated);
Expand All @@ -139,7 +140,15 @@ class RebuildingQueryHandler :

// Construct
mPrimaryHandler = mImplConstructor();
// And pass along
// Pass along all debug/analysis settings
mPrimaryHandler->trackChecks(QueryHandlerType::mTrackChecks);
mPrimaryHandler->shouldRestructure(QueryHandlerType::mShouldRestructure);
mPrimaryHandler->setReportRestructures(QueryHandlerType::mReportRestructures);
mPrimaryHandler->reportHealth(QueryHandlerType::mReportHealth);
mPrimaryHandler->reportHealthFrequency(QueryHandlerType::mReportHealthFrequency);
mPrimaryHandler->reportCost(QueryHandlerType::mReportCost);
mPrimaryHandler->reportQueryStats(QueryHandlerType::mReportQueryStats);
// And pass along the remainder of settings and initialize
mPrimaryHandler->setAggregateListener(this);
mPrimaryHandler->initialize(mLocCache, this, mStaticObjects, false, mShouldTrackCB);
}
Expand Down Expand Up @@ -438,6 +447,13 @@ class RebuildingQueryHandler :
if (exiting()) return;

mRebuildingHandler = mImplConstructor();
mRebuildingHandler->trackChecks(QueryHandlerType::mTrackChecks);
mRebuildingHandler->shouldRestructure(QueryHandlerType::mShouldRestructure);
mRebuildingHandler->setReportRestructures(QueryHandlerType::mReportRestructures);
mRebuildingHandler->reportHealth(QueryHandlerType::mReportHealth);
mRebuildingHandler->reportHealthFrequency(QueryHandlerType::mReportHealthFrequency);
mRebuildingHandler->reportCost(QueryHandlerType::mReportCost);
mRebuildingHandler->reportQueryStats(QueryHandlerType::mReportQueryStats);
mRebuildingHandler->setAggregateListener(this);
mRebuildingHandler->initialize(mLocCache, this, mStaticObjects, false, mShouldTrackCB);
mRebuildingHandler->bulkLoad(mRebuildObjectList);
Expand Down
23 changes: 13 additions & 10 deletions proxsim/geom/main.cpp
Expand Up @@ -312,16 +312,10 @@ int main(int argc, char** argv) {
// Sometimes we're not perfect, but let's aim for 99% of the target objects.
assert(simulator->allObjectsSize() >= .99f * nobjects);

simulator->initialize(churn_rate, SolidAngle(query_angle_min), SolidAngle(query_angle_max), query_max_distance, query_max_results);

if (!csvmotionfile.empty() && !static_queries)
simulator->createCSVQueries(nqueries, csvmotionfile);
else
simulator->createRandomQueries(nqueries, static_queries);

simulator->run();

// Optional logging, triggers
// Optional logging, triggers. Set before calling simulator initialize so
// they are called before handler->initialize, which, with rebuilding query
// handlers, will ensure that the settings are propagated to the real query
// handlers.
handler->trackChecks(track_checks);
handler->shouldRestructure(restructure);
handler->reportHealth(report_health);
Expand All @@ -333,6 +327,15 @@ int main(int argc, char** argv) {
simulator->forceRebuild(force_rebuild);
simulator->forceInitialRebuild(force_initial_rebuild);

simulator->initialize(churn_rate, SolidAngle(query_angle_min), SolidAngle(query_angle_max), query_max_distance, query_max_results);

if (!csvmotionfile.empty() && !static_queries)
simulator->createCSVQueries(nqueries, csvmotionfile);
else
simulator->createRandomQueries(nqueries, static_queries);

simulator->run();

renderer->run();
simulator->shutdown();

Expand Down

0 comments on commit 991a188

Please sign in to comment.