1
0
Fork 0

Improvements to performance monitoring.

* Ensure that subsystems are named.
* Nasal timers are named appropriately
This commit is contained in:
Richard Harrison 2019-02-10 17:24:55 +01:00
parent f57d7329c2
commit 5253215065
10 changed files with 20 additions and 10 deletions

View file

@ -120,7 +120,8 @@ static ComponentForge componentForge;
Autopilot::Autopilot( SGPropertyNode_ptr rootNode, SGPropertyNode_ptr configNode ) : Autopilot::Autopilot( SGPropertyNode_ptr rootNode, SGPropertyNode_ptr configNode ) :
_name("unnamed autopilot"), _name("unnamed autopilot"),
_serviceable(true), _serviceable(true),
_rootNode(rootNode) _rootNode(rootNode),
SGSubsystemGroup("Autopilot")
{ {
if (componentForge.empty()) if (componentForge.empty())
{ {

View file

@ -37,7 +37,7 @@ public:
virtual void addAutopilot( const std::string & name, SGPropertyNode_ptr apNode, SGPropertyNode_ptr config ) = 0; virtual void addAutopilot( const std::string & name, SGPropertyNode_ptr apNode, SGPropertyNode_ptr config ) = 0;
virtual void removeAutopilot( const std::string & name ) = 0; virtual void removeAutopilot( const std::string & name ) = 0;
protected: protected:
FGXMLAutopilotGroup() : SGSubsystemGroup() {} FGXMLAutopilotGroup() : SGSubsystemGroup("FGXMLAutopilotGroup") {}
}; };

View file

@ -42,6 +42,7 @@ namespace flightgear
{ {
CockpitDisplayManager::CockpitDisplayManager () CockpitDisplayManager::CockpitDisplayManager ()
: SGSubsystemGroup("CockpitDisplayManager")
{ {
} }

View file

@ -80,6 +80,7 @@ void FG3DCloudsListener::valueChanged( SGPropertyNode * node )
} }
FGEnvironmentMgr::FGEnvironmentMgr () : FGEnvironmentMgr::FGEnvironmentMgr () :
SGSubsystemGroup("FGEnvironmentMgr"),
_environment(new FGEnvironment()), _environment(new FGEnvironment()),
fgClouds(nullptr), fgClouds(nullptr),
_cloudLayersDirty(true), _cloudLayersDirty(true),

View file

@ -29,6 +29,7 @@ namespace Environment {
class TerrainSampler : public SGSubsystemGroup class TerrainSampler : public SGSubsystemGroup
{ {
public: public:
TerrainSampler() : SGSubsystemGroup("TerrainSampler") {}
static TerrainSampler * createInstance( SGPropertyNode_ptr rootNode ); static TerrainSampler * createInstance( SGPropertyNode_ptr rootNode );
}; };

View file

@ -60,7 +60,7 @@
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
FGInput::FGInput () FGInput::FGInput () : SGSubsystemGroup("FGInput")
{ {
if( fgGetBool("/sim/input/no-mouse-input",false) ) { if( fgGetBool("/sim/input/no-mouse-input",false) ) {
SG_LOG(SG_INPUT,SG_ALERT,"Mouse input disabled!"); SG_LOG(SG_INPUT,SG_ALERT,"Mouse input disabled!");

View file

@ -49,6 +49,7 @@
#include "tcas.hxx" #include "tcas.hxx"
FGInstrumentMgr::FGInstrumentMgr () : FGInstrumentMgr::FGInstrumentMgr () :
SGSubsystemGroup("FGInstrumentMgr"),
_explicitGps(false) _explicitGps(false)
{ {
} }

View file

@ -144,7 +144,7 @@ FGGlobals *globals = NULL;
// Constructor // Constructor
FGGlobals::FGGlobals() : FGGlobals::FGGlobals() :
renderer( new FGRenderer ), renderer( new FGRenderer ),
subsystem_mgr( new SGSubsystemMgr ), subsystem_mgr( new SGSubsystemMgr("subsystem_mgr") ),
event_mgr( new SGEventMgr ), event_mgr( new SGEventMgr ),
sim_time_sec( 0.0 ), sim_time_sec( 0.0 ),
fg_root( "" ), fg_root( "" ),

View file

@ -93,14 +93,19 @@ void FGNasalModuleListener::valueChanged(SGPropertyNode*)
class TimerObj : public SGReferenced class TimerObj : public SGReferenced
{ {
public: public:
TimerObj(FGNasalSys* sys, naRef f, naRef self, double interval) : TimerObj(Context *c, FGNasalSys* sys, naRef f, naRef self, double interval) :
_sys(sys), _sys(sys),
_func(f), _func(f),
_self(self), _self(self),
_interval(interval) _interval(interval)
{ {
char nm[128]; char nm[128];
snprintf(nm, 128, "nasal-timer-%p", this); if (c) {
snprintf(nm, 128, "maketimer-%s:%d", naStr_data(naGetSourceFile(c, 0)), naGetLine(c, 0));
}
else {
snprintf(nm, 128, "maketimer-%p", this);
}
_name = nm; _name = nm;
_gcRoot = naGCSave(f); _gcRoot = naGCSave(f);
_gcSelf = naGCSave(self); _gcSelf = naGCSave(self);
@ -547,7 +552,7 @@ static naRef f_makeTimer(naContext c, naRef me, int argc, naRef* args)
func = args[2]; func = args[2];
} }
TimerObj* timerObj = new TimerObj(nasalSys, func, self, args[0].num); TimerObj* timerObj = new TimerObj(c, nasalSys, func, self, args[0].num);
return nasal::to_nasal(c, timerObj); return nasal::to_nasal(c, timerObj);
} }
@ -1400,7 +1405,7 @@ void FGNasalSys::setTimer(naContext c, int argc, naRef* args)
bool simtime = (argc > 2 && naTrue(args[2])) ? false : true; bool simtime = (argc > 2 && naTrue(args[2])) ? false : true;
// A unique name for the timer based on the file name and line number of the function. // A unique name for the timer based on the file name and line number of the function.
std::string name = "NasalTimer-"; std::string name = "settimer-";
name.append(naStr_data(naGetSourceFile(c, 0))); name.append(naStr_data(naGetSourceFile(c, 0)));
name.append(":"); name.append(":");
name.append(std::to_string(naGetLine(c, 0))); name.append(std::to_string(naGetLine(c, 0)));

View file

@ -28,7 +28,7 @@
#include "vacuum.hxx" #include "vacuum.hxx"
FGSystemMgr::FGSystemMgr () FGSystemMgr::FGSystemMgr () :SGSubsystemGroup("FGSystemMgr")
{ {
SGPropertyNode_ptr config_props = new SGPropertyNode; SGPropertyNode_ptr config_props = new SGPropertyNode;