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.
22 #include <dali/public-api/object/base-object.h>
25 #include <base/interfaces/performance-interface.h>
26 #include <performance-logger.h>
37 class PerformanceLogger;
39 typedef IntrusivePtr<PerformanceLogger> PerformanceLoggerPtr;
42 * @brief Interface for the performance logger
44 class PerformanceLogger : public BaseObject
49 * @brief Create a new logger
51 * @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.
52 * @return a new logger
54 static PerformanceLoggerPtr New( const char* name );
58 * @param[in] name The name to assing to the logger
60 PerformanceLogger( const char* name );
65 virtual ~PerformanceLogger();
68 * Add a performance marker
70 * @param markerType Performance marker type
72 void AddMarker( Dali::PerformanceLogger::Marker markerType );
75 * Set the logging frequency
77 * @param logFrequency how often to log out in seconds
79 void SetLoggingFrequency( unsigned int logFrequency);
82 * Set logging on or off for this logger
84 * @param[in] enable Enable logging or not
86 void EnableLogging( bool enable );
88 private: // Implementation
91 PerformanceLogger( const PerformanceLogger& );
92 PerformanceLogger& operator=( const PerformanceLogger& );
96 PerformanceInterface::ContextId mContext; ///< Context of this logger
100 // Helpers for public-api forwarding methods
102 inline static Internal::Adaptor::PerformanceLogger& GetImplementation( Dali::PerformanceLogger& logger )
104 DALI_ASSERT_ALWAYS( logger && "PerformanceLogger handle is empty" );
106 BaseObject& handle = logger.GetBaseObject();
108 return static_cast< Internal::Adaptor::PerformanceLogger& >( handle );
111 inline static const Internal::Adaptor::PerformanceLogger& GetImplementation( const Dali::PerformanceLogger& logger )
113 DALI_ASSERT_ALWAYS( logger && "PerformanceLogger handle is empty" );
115 const BaseObject& handle = logger.GetBaseObject();
117 return static_cast< const Internal::Adaptor::PerformanceLogger& >( handle );
120 } // namespace Adaptor
122 } // namespace Internal
126 #endif // __DALI_INTERNAL_PERFORMANCE_LOGGER_H__