Merge "Changed 'virtual' function override declarations to 'override' in automated...
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / common / performance-server.h
1 #ifndef DALI_INTERNAL_ADAPTOR_PERFORMANCE_SERVER_H
2 #define DALI_INTERNAL_ADAPTOR_PERFORMANCE_SERVER_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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
21 // EXTERNAL INCLDUES
22 #include <dali/public-api/common/dali-vector.h>
23 #include <dali/devel-api/threading/mutex.h>
24
25 // INTERNAL INCLUDES
26 #include <dali/internal/system/common/frame-time-stats.h>
27 #include <dali/internal/network/common/network-performance-server.h>
28 #include <dali/internal/adaptor/common/adaptor-internal-services.h>
29 #include <dali/internal/system/common/performance-marker.h>
30 #include <dali/internal/system/common/stat-context-manager.h>
31
32 namespace Dali
33 {
34
35 namespace Internal
36 {
37
38 namespace Adaptor
39 {
40
41 class EnvironmentOptions;
42 class StatContext;
43 /**
44  * Concrete implementation of performance interface.
45  * Adaptor classes should never include this file, they
46  * just need to include the abstract class performance-interface.h
47  */
48 class PerformanceServer : public PerformanceInterface, public StatContextLogInterface
49 {
50 public:
51
52   /**
53    * @brief Constructor
54    * @param[in] adaptorServices adaptor internal services
55    * @param[in] environmentOptions environment options
56    */
57   PerformanceServer( AdaptorInternalServices& adaptorServices,
58                      const EnvironmentOptions& environmentOptions );
59
60   /**
61    * Destructor
62    */
63   virtual ~PerformanceServer();
64
65   /**
66    * @copydoc PerformanceLogger::AddContext()
67    */
68   ContextId AddContext( const char* name ) override;
69
70   /**
71    * @copydoc PerformanceLogger::RemoveContext()
72    */
73   void RemoveContext( ContextId contextId ) override;
74
75   /**
76    * @copydoc PerformanceInterface::AddMarker( MarkerType markerType )
77    */
78   void AddMarker( MarkerType markerType ) override;
79
80   /**
81    * @copydoc PerformanceLogger::AddMarker( MarkerType markerType, ContextId contextId )
82    */
83   void AddMarker( MarkerType markerType, ContextId contextId ) override;
84
85   /**
86    * @copydoc PerformanceInterface::SetLogging()
87    */
88   virtual void SetLogging( unsigned int statisticsLogOptions,
89                            unsigned int timeStampOutput,
90                            unsigned int logFrequency );
91
92   /**
93    * @copydoc PerformanceLogger::SetLoggingFrequency()
94    */
95   void SetLoggingFrequency( unsigned int logFrequency, ContextId contextId ) override;
96
97   /**
98    * @copydoc PerformanceLogger::EnableLogging()
99    */
100   void EnableLogging( bool enable, ContextId contextId ) override;
101
102 public: //StatLogInterface
103
104   /**
105    * @copydoc StatLogInterface::LogContextStatistics()
106    */
107   void LogContextStatistics( const char* const text ) override;
108
109 private:
110
111   /**
112    * @brief log the marker out to kernel/ DALi log
113    * @param[in] marker performance marker
114    * @param[in] description marker description
115    */
116   void LogMarker( const PerformanceMarker& marker, const char* const description );
117
118 private:
119
120   const EnvironmentOptions& mEnvironmentOptions;          ///< environment options
121   TraceInterface& mKernelTrace;                           ///< kernel trace interface
122   TraceInterface& mSystemTrace;                           ///< system trace interface
123   Dali::Mutex mLogMutex;                                  ///< mutex
124
125 #if defined(NETWORK_LOGGING_ENABLED)
126   NetworkPerformanceServer mNetworkServer;                ///< network server
127   bool mNetworkControlEnabled;                            ///< Whether network control is enabled
128 #endif
129
130   StatContextManager mStatContextManager;                 ///< Stat context manager
131   unsigned int mStatisticsLogBitmask;                     ///< statistics log level
132   unsigned int mPerformanceOutputBitmask;                 ///< performance marker output
133
134   bool mLoggingEnabled:1;                                 ///< whether logging update / render to a log is enabled
135   bool mLogFunctionInstalled:1;                           ///< whether the log function is installed
136 };
137
138
139 } // namespace Internal
140
141 } // namespace Adaptor
142
143 } // namespace Dali
144
145 #endif // DALI_INTERNAL_ADAPTOR_PERFORMANCE_SERVER_H