1 #ifndef DALI_INTERNAL_ADAPTOR_PERFORMANCE_SERVER_H
2 #define DALI_INTERNAL_ADAPTOR_PERFORMANCE_SERVER_H
5 * Copyright (c) 2021 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/devel-api/threading/mutex.h>
23 #include <dali/public-api/common/dali-vector.h>
26 #include <dali/internal/adaptor/common/adaptor-internal-services.h>
27 #include <dali/internal/network/common/network-performance-server.h>
28 #include <dali/internal/system/common/frame-time-stats.h>
29 #include <dali/internal/system/common/performance-marker.h>
30 #include <dali/internal/system/common/stat-context-manager.h>
38 class EnvironmentOptions;
41 * Concrete implementation of performance interface.
42 * Adaptor classes should never include this file, they
43 * just need to include the abstract class performance-interface.h
45 class PerformanceServer : public PerformanceInterface, public StatContextLogInterface
50 * @param[in] adaptorServices adaptor internal services
51 * @param[in] environmentOptions environment options
53 PerformanceServer(AdaptorInternalServices& adaptorServices,
54 const EnvironmentOptions& environmentOptions);
59 virtual ~PerformanceServer();
62 * @copydoc PerformanceLogger::AddContext()
64 ContextId AddContext(const char* name) override;
67 * @copydoc PerformanceLogger::GetContextId()
69 virtual ContextId GetContextId( const char* name );
72 * @copydoc PerformanceLogger::RemoveContext()
74 void RemoveContext(ContextId contextId) override;
77 * @copydoc PerformanceInterface::AddMarker( MarkerType markerType )
79 void AddMarker(MarkerType markerType) override;
82 * @copydoc PerformanceLogger::AddMarker( MarkerType markerType, ContextId contextId )
84 void AddMarker(MarkerType markerType, ContextId contextId) override;
87 * @copydoc PerformanceInterface::SetLogging()
89 virtual void SetLogging(unsigned int statisticsLogOptions,
90 unsigned int timeStampOutput,
91 unsigned int logFrequency);
94 * @copydoc PerformanceLogger::SetLoggingFrequency()
96 void SetLoggingFrequency(unsigned int logFrequency, ContextId contextId) override;
99 * @copydoc PerformanceLogger::EnableLogging()
101 void EnableLogging(bool enable, ContextId contextId) override;
103 public: //StatLogInterface
105 * @copydoc StatLogInterface::LogContextStatistics()
107 void LogContextStatistics(const char* const text) override;
111 * @brief log the marker out to kernel/ DALi log
112 * @param[in] marker performance marker
113 * @param[in] description marker description
115 void LogMarker(const PerformanceMarker& marker, const char* const description);
118 const EnvironmentOptions& mEnvironmentOptions; ///< environment options
119 TraceInterface& mKernelTrace; ///< kernel trace interface
120 TraceInterface& mSystemTrace; ///< system trace interface
121 Dali::Mutex mLogMutex; ///< mutex
123 #if defined(NETWORK_LOGGING_ENABLED)
124 NetworkPerformanceServer mNetworkServer; ///< network server
125 bool mNetworkControlEnabled; ///< Whether network control is enabled
128 StatContextManager mStatContextManager; ///< Stat context manager
129 unsigned int mStatisticsLogBitmask; ///< statistics log level
130 unsigned int mPerformanceOutputBitmask; ///< performance marker output
132 bool mLoggingEnabled : 1; ///< whether logging update / render to a log is enabled
133 bool mLogFunctionInstalled : 1; ///< whether the log function is installed
136 } // namespace Adaptor
138 } // namespace Internal
142 #endif // DALI_INTERNAL_ADAPTOR_PERFORMANCE_SERVER_H