(PanGesture)Added environment variable to change pan gesture prediction mode
[platform/core/uifw/dali-adaptor.git] / adaptors / base / performance-logging / performance-server.h
1 #ifndef __DALI_INTERNAL_ADAPTOR_PERFORMANCE_SERVER_H__
2 #define __DALI_INTERNAL_ADAPTOR_PERFORMANCE_SERVER_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //     http://floralicense.org/license/
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19
20 // INTERNAL INCLUDES
21 #include <base/performance-logging/frame-time-stats.h>
22 #include <dali/public-api/common/dali-vector.h>
23 #include <base/interfaces/adaptor-internal-services.h>
24
25 // EXTERNAL INCLUDES
26 #include <boost/thread/mutex.hpp>
27
28 namespace Dali
29 {
30
31 namespace Internal
32 {
33
34 namespace Adaptor
35 {
36
37 class EnvironmentOptions;
38 /**
39  * Concrete implementation of performance interface.
40  * Adaptor classes should never include this file, they
41  * just need to include the abstract class performance-interface.h
42  */
43 class PerformanceServer : public PerformanceInterface
44 {
45
46 public:
47
48   /**
49    * Constructor
50    * @param adaptorServices adaptor internal services
51    * @param environmentOptions environment options
52    */
53   PerformanceServer( AdaptorInternalServices& adaptorServices,
54                      const EnvironmentOptions& environmentOptions );
55
56   /**
57    * Destructor
58    */
59   virtual ~PerformanceServer();
60
61   /**
62    * @copydoc PerformanceInterface::AddMarker()
63    */
64   virtual void AddMarker( PerformanceMarker::MarkerType markerType);
65
66   /**
67    * @copydoc PerformanceInterface::SetLogging()
68    */
69   virtual void SetLogging( unsigned int level, unsigned int interval);
70
71
72 private:
73
74   /**
75    * Helper
76    */
77   void AddMarkerToLog( PerformanceMarker marker );
78
79   /**
80    * Helper
81    */
82   void LogMarker(const char* name, const FrameTimeStats& frameStats);
83
84   /**
85    * log markers out
86    */
87   void LogMarkers();
88
89 private:
90
91   bool mLoggingEnabled:1;         ///< whether logging update / render to a log is enabled
92   bool mLogFunctionInstalled:1;   ///< whether the log function is installed
93   unsigned int mLogLevel;         ///< log level
94
95   unsigned int mLogFrequencyMicroseconds; ///< if logging is enabled, what frequency to log out at in micro-seconds
96
97   FrameTimeStats mUpdateStats;    ///< update time statistics
98   FrameTimeStats mRenderStats;    ///< render time statistics
99   FrameTimeStats mEventStats;     ///< event time statistics
100
101   Integration::PlatformAbstraction& mPlatformAbstraction; ///< platform abstraction
102
103   typedef Dali::Vector<PerformanceMarker > MarkerVector;
104   MarkerVector mMarkers;              ///< vector of markers
105   boost::mutex mDataMutex;            ///< mutex
106   const EnvironmentOptions& mEnvironmentOptions;      ///< environment options
107   KernelTraceInterface& mKernelTrace; ///< kernel trace interface
108
109 };
110
111
112 } // namespace Internal
113
114 } // namespace Adaptor
115
116 } // namespace Dali
117
118 #endif