1 // SGPerfMon.hxx -- Performance Tracing
3 // Written by Thorsten Brehm, started November 2011.
5 // Copyright (C) 2011 Thorsten Brehm - brehmt (at) gmail com
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef __SGPERFMON_HXX
23 #define __SGPERFMON_HXX
25 #include <simgear/props/props.hxx>
26 #include <simgear/structure/subsystem_mgr.hxx>
27 #include <simgear/timing/timestamp.hxx>
29 class SampleStatistic;
31 ///////////////////////////////////////////////////////////////////////////////
32 // SG Performance Monitor ////////////////////////////////////////////////////
33 ///////////////////////////////////////////////////////////////////////////////
35 class SGPerformanceMonitor : public SGSubsystem
39 SGPerformanceMonitor(SGSubsystemMgr* subSysMgr, SGPropertyNode_ptr root);
41 virtual void bind (void);
42 virtual void unbind (void);
43 virtual void init (void);
44 virtual void update (double dt);
47 static void subSystemMgrHook(void* userData, const std::string& name, SampleStatistic* timeStat);
49 void reportTiming(const std::string& name, SampleStatistic* timeStat);
51 SGTimeStamp _lastUpdate;
52 SGSubsystemMgr* _subSysMgr;
53 SGPropertyNode_ptr _root;
54 SGPropertyNode_ptr _statiticsSubsystems;
55 SGPropertyNode_ptr _statisticsFlag;
56 SGPropertyNode_ptr _statisticsInterval;
62 #endif // __SGPERFMON_HXX