1 #ifndef __DALI_INTERNAL_PERFORMANCE_LOGGER_H__
2 #define __DALI_INTERNAL_PERFORMANCE_LOGGER_H__
5 * Copyright (c) 2014 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.
21 #include <base/interfaces/performance-interface.h>
24 #include <dali/public-api/object/base-object.h>
25 #include <performance-logger.h>
36 class PerformanceLogger;
38 typedef IntrusivePtr<PerformanceLogger> PerformanceLoggerPtr;
41 * @brief Interface for the performance logger
43 class PerformanceLogger : public BaseObject
48 * @brief Create a new logger
50 * @param[in] name The name of the logger. This needs to be a compile-time literal and alive for the whole lifetime of the performance logger.
51 * @return a new logger
53 static PerformanceLoggerPtr New( const char* name );
57 * @param[in] name The name to assing to the logger
59 PerformanceLogger( const char* name );
64 virtual ~PerformanceLogger();
67 * Add a performance marker
69 * @param markerType Performance marker type
71 void AddMarker( Dali::PerformanceLogger::Marker markerType );
74 * Set the logging frequency
76 * @param logFrequency how often to log out in seconds
78 void SetLoggingFrequency( unsigned int logFrequency);
81 * Set logging on or off for this logger
83 * @param[in] enable Enable logging or not
85 void EnableLogging( bool enable );
87 private: // Implementation
90 PerformanceLogger( const PerformanceLogger& );
91 PerformanceLogger& operator=( const PerformanceLogger& );
95 PerformanceInterface::ContextId mContext; ///< Context of this logger
99 // Helpers for public-api forwarding methods
101 inline static Internal::Adaptor::PerformanceLogger& GetImplementation( Dali::PerformanceLogger& logger )
103 DALI_ASSERT_ALWAYS( logger && "PerformanceLogger handle is empty" );
105 BaseObject& handle = logger.GetBaseObject();
107 return static_cast< Internal::Adaptor::PerformanceLogger& >( handle );
110 inline static const Internal::Adaptor::PerformanceLogger& GetImplementation( const Dali::PerformanceLogger& logger )
112 DALI_ASSERT_ALWAYS( logger && "PerformanceLogger handle is empty" );
114 const BaseObject& handle = logger.GetBaseObject();
116 return static_cast< const Internal::Adaptor::PerformanceLogger& >( handle );
119 } // namespace Adaptor
121 } // namespace Internal
125 #endif // __DALI_INTERNAL_PERFORMANCE_LOGGER_H__