Rename some subsystems for naming consistency.
if (!enabled)
return;
- FGTrafficManager *tmgr = (FGTrafficManager*) globals->get_subsystem("Traffic Manager");
+ FGTrafficManager *tmgr = (FGTrafficManager*) globals->get_subsystem("traffic-manager");
_dt = dt;
ai_list_iterator ai_list_itr = ai_list.begin();
FGAIManager* FGSubmodelMgr::aiManager()
{
- return (FGAIManager*)globals->get_subsystem("ai_model");
+ return (FGAIManager*)globals->get_subsystem("ai-model");
}
void FGSubmodelMgr::init()
#include <simgear/debug/logstream.hxx>
#include <simgear/structure/exception.hxx>
#include <simgear/structure/event_mgr.hxx>
+#include <simgear/structure/SGPerfMon.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sg_dir.hxx>
#include <simgear/misc/sgstream.hxx>
////////////////////////////////////////////////////////////////////
globals->add_subsystem("properties", new FGProperties);
+
+ ////////////////////////////////////////////////////////////////////
+ // Add the performance monitoring system.
+ ////////////////////////////////////////////////////////////////////
+ globals->add_subsystem("performance-mon",
+ new SGPerformanceMonitor(globals->get_subsystem_mgr(),
+ fgGetNode("/sim/performance", true)));
+
////////////////////////////////////////////////////////////////////
// Initialize the material property subsystem.
////////////////////////////////////////////////////////////////////
// sub system infrastructure.
////////////////////////////////////////////////////////////////////
- globals->add_subsystem("Old ATC", new FGATCMgr, SGSubsystemMgr::INIT);
+ globals->add_subsystem("ATC-old", new FGATCMgr, SGSubsystemMgr::INIT);
////////////////////////////////////////////////////////////////////
// Initialize the ATC subsystem
// Initialise the AI Model Manager
////////////////////////////////////////////////////////////////////
SG_LOG(SG_GENERAL, SG_INFO, " AI Model Manager");
- globals->add_subsystem("ai_model", new FGAIManager, SGSubsystemMgr::POST_FDM);
- globals->add_subsystem("submodel_mgr", new FGSubmodelMgr, SGSubsystemMgr::POST_FDM);
+ globals->add_subsystem("ai-model", new FGAIManager, SGSubsystemMgr::POST_FDM);
+ globals->add_subsystem("submodel-mgr", new FGSubmodelMgr, SGSubsystemMgr::POST_FDM);
// It's probably a good idea to initialize the top level traffic manager
// After the AI and ATC systems have been initialized properly.
// AI Traffic manager
- globals->add_subsystem("Traffic Manager", new FGTrafficManager, SGSubsystemMgr::POST_FDM);
+ globals->add_subsystem("traffic-manager", new FGTrafficManager, SGSubsystemMgr::POST_FDM);
////////////////////////////////////////////////////////////////////
// Add a new 2D panel.
// Force reupdating the positions of the ai 3d models. They are used for
// initializing ground level for the FDM.
- globals->get_subsystem("ai_model")->reinit();
+ globals->get_subsystem("ai-model")->reinit();
// Initialize the FDM
globals->get_subsystem("flight")->reinit();
// deallocation of AIModel objects. To ensure we can safely
// shut down all subsystems, make sure we take down the
// AIModels system first.
- SGSubsystem* ai = subsystem_mgr->remove("ai_model");
+ SGSubsystem* ai = subsystem_mgr->remove("ai-model");
if (ai) {
ai->unbind();
delete ai;
static SGPropertyNode_ptr frame_signal
= fgGetNode("/sim/signals/frame", true);
- static SGPropertyNode_ptr _statisticsFlag
- = fgGetNode("/sim/timing-statistics/enabled", true);
- static SGPropertyNode_ptr _statisticsInterval
- = fgGetNode("/sim/timing-statistics/interval-s", true);
- static SGPropertyNode_ptr _statiticsMinJitter
- = fgGetNode("/sim/timing-statistics/min-jitter-ms", true);
- static SGPropertyNode_ptr _statiticsMinTime
- = fgGetNode("/sim/timing-statistics/min-time-ms", true);
-
frame_signal->fireValueChanged();
SG_LOG( SG_GENERAL, SG_DEBUG, "Running Main Loop");
}
}
- // print timing statistics
- static bool _lastStatisticsFlag = false;
- if (_lastStatisticsFlag != _statisticsFlag->getBoolValue())
- {
- // flag has changed, update subsystem manager
- _lastStatisticsFlag = _statisticsFlag->getBoolValue();
- globals->get_subsystem_mgr()->collectDebugTiming(_lastStatisticsFlag);
- }
- if (_lastStatisticsFlag)
- {
- static double elapsed = 0;
- elapsed += real_dt;
- if (elapsed >= _statisticsInterval->getDoubleValue())
- {
- // print and reset timing statistics
- globals->get_subsystem_mgr()->printTimingStatistics(_statiticsMinTime->getDoubleValue(),
- _statiticsMinJitter->getDoubleValue());
- elapsed = 0;
- }
- }
-
simgear::AtomicChangeListener::fireChangeListeners();
SG_LOG( SG_GENERAL, SG_DEBUG, "" );
mp->setCallSign(callsign);
mMultiPlayerMap[callsign] = mp;
- FGAIManager *aiMgr = (FGAIManager*)globals->get_subsystem("ai_model");
+ FGAIManager *aiMgr = (FGAIManager*)globals->get_subsystem("ai-model");
if (aiMgr) {
aiMgr->attach(mp);
if (modelPath.empty())
return;
FGAIManager *aiMgr;
- aiMgr = static_cast<FGAIManager*>(globals->get_subsystem("ai_model"));
+ aiMgr = static_cast<FGAIManager*>(globals->get_subsystem("ai-model"));
if (!aiMgr)
return;
// frame-rate / worst-case latency / update-rate counters
_frameRate = fgGetNode("/sim/frame-rate", true);
_frameLatency = fgGetNode("/sim/frame-latency-max-ms", true);
+ _frameRateWorst = fgGetNode("/sim/frame-rate-worst", true);
_lastFrameTime = 0;
_frameLatencyMax = 0.0;
_frameCount = 0;
if ((_impl->get_cur_time() != _lastFrameTime)) {
_frameRate->setIntValue(_frameCount);
_frameLatency->setDoubleValue(_frameLatencyMax*1000);
+ if (_frameLatencyMax>0)
+ _frameRateWorst->setIntValue(1/_frameLatencyMax);
_frameCount = 0;
_frameLatencyMax = 0.0;
}
// frame-rate / worst-case latency / update-rate counters
SGPropertyNode_ptr _frameRate;
+ SGPropertyNode_ptr _frameRateWorst;
SGPropertyNode_ptr _frameLatency;
time_t _lastFrameTime;
double _frameLatencyMax;
if (AIManagerRef) {
// Check if this aircraft has been released.
- FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("Traffic Manager");
+ FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("traffic-manager");
if (tmgr->isReleased(AIManagerRef)) {
AIManagerRef = 0;
} else {
airline);
if (fp->isValidPlan()) {
aircraft->SetFlightPlan(fp);
- FGAIManager* aimgr = (FGAIManager *) globals-> get_subsystem("ai_model");
+ FGAIManager* aimgr = (FGAIManager *) globals-> get_subsystem("ai-model");
aimgr->attach(aircraft);
AIManagerRef = aircraft->getID();
return true;
{
time_t now = time(NULL) + fgGetLong("/sim/time/warp");
- FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("Traffic Manager");
+ FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("traffic-manager");
FGScheduledFlightVecIterator fltBegin, fltEnd;
fltBegin = tmgr->getFirstFlight(req);
fltEnd = tmgr->getLastFlight(req);