1 #ifndef __DALI_INTERNAL_ADAPTOR_PERFORMANCE_SERVER_H__
2 #define __DALI_INTERNAL_ADAPTOR_PERFORMANCE_SERVER_H__
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/common/dali-vector.h>
23 #include <dali/devel-api/threading/mutex.h>
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>
41 class EnvironmentOptions;
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
48 class PerformanceServer : public PerformanceInterface, public StatContextLogInterface
54 * @param[in] adaptorServices adaptor internal services
55 * @param[in] environmentOptions environment options
57 PerformanceServer( AdaptorInternalServices& adaptorServices,
58 const EnvironmentOptions& environmentOptions );
63 virtual ~PerformanceServer();
66 * @copydoc PerformanceLogger::AddContext()
68 virtual ContextId AddContext( const char* name );
71 * @copydoc PerformanceLogger::RemoveContext()
73 virtual void RemoveContext( ContextId contextId );
76 * @copydoc PerformanceInterface::AddMarker( MarkerType markerType )
78 virtual void AddMarker( MarkerType markerType );
81 * @copydoc PerformanceLogger::AddMarker( MarkerType markerType, ContextId contextId )
83 virtual void AddMarker( MarkerType markerType, ContextId contextId );
86 * @copydoc PerformanceInterface::SetLogging()
88 virtual void SetLogging( unsigned int statisticsLogOptions,
89 unsigned int timeStampOutput,
90 unsigned int logFrequency );
93 * @copydoc PerformanceLogger::SetLoggingFrequency()
95 virtual void SetLoggingFrequency( unsigned int logFrequency, ContextId contextId );
98 * @copydoc PerformanceLogger::EnableLogging()
100 virtual void EnableLogging( bool enable, ContextId contextId );
102 public: //StatLogInterface
105 * @copydoc StatLogInterface::LogContextStatistics()
107 virtual void LogContextStatistics( const char* const text );
112 * @brief log the marker out to kernel/ DALi log
113 * @param[in] marker performance marker
114 * @param[in] description marker description
116 void LogMarker( const PerformanceMarker& marker, const char* const description );
120 const EnvironmentOptions& mEnvironmentOptions; ///< environment options
121 TraceInterface& mKernelTrace; ///< kernel trace interface
122 TraceInterface& mSystemTrace; ///< system trace interface
123 Dali::Mutex mLogMutex; ///< mutex
125 #if defined(NETWORK_LOGGING_ENABLED)
126 NetworkPerformanceServer mNetworkServer; ///< network server
127 bool mNetworkControlEnabled; ///< Whether network control is enabled
130 StatContextManager mStatContextManager; ///< Stat context manager
131 unsigned int mStatisticsLogBitmask; ///< statistics log level
132 unsigned int mPerformanceOutputBitmask; ///< performance marker output
134 bool mLoggingEnabled:1; ///< whether logging update / render to a log is enabled
135 bool mLogFunctionInstalled:1; ///< whether the log function is installed
139 } // namespace Internal
141 } // namespace Adaptor