]> git.mxchange.org Git - simgear.git/blob - simgear/structure/SGPerfMon.hxx
Fix for libCurl pipelining and connection count.
[simgear.git] / simgear / structure / SGPerfMon.hxx
1 // SGPerfMon.hxx -- Performance Tracing
2 //
3 // Written by Thorsten Brehm, started November 2011.
4 //
5 // Copyright (C) 2011 Thorsten Brehm - brehmt (at) gmail com
6 //
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.
11 //
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.
16 //
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.
20 //
21
22 #ifndef __SGPERFMON_HXX
23 #define __SGPERFMON_HXX
24
25 #include <simgear/props/props.hxx>
26 #include <simgear/structure/subsystem_mgr.hxx>
27 #include <simgear/timing/timestamp.hxx>
28
29 class SampleStatistic;
30
31 ///////////////////////////////////////////////////////////////////////////////
32 // SG Performance Monitor  ////////////////////////////////////////////////////
33 ///////////////////////////////////////////////////////////////////////////////
34
35 class SGPerformanceMonitor : public SGSubsystem
36 {
37
38 public:
39     SGPerformanceMonitor(SGSubsystemMgr* subSysMgr, SGPropertyNode_ptr root);
40
41     virtual void bind   (void);
42     virtual void unbind (void);
43     virtual void init   (void);
44     virtual void update (double dt);
45
46 private:
47     static void subSystemMgrHook(void* userData, const std::string& name, SampleStatistic* timeStat);
48
49     void reportTiming(const std::string& name, SampleStatistic* timeStat);
50
51     SGTimeStamp _lastUpdate;
52     SGSubsystemMgr* _subSysMgr;
53     SGPropertyNode_ptr _root;
54     SGPropertyNode_ptr _statiticsSubsystems;
55     SGPropertyNode_ptr _statisticsFlag;
56     SGPropertyNode_ptr _statisticsInterval;
57
58     bool _isEnabled;
59     int _count;
60 };
61
62 #endif // __SGPERFMON_HXX