Merge "Set proper locale to harfbuzz" into devel/master
[platform/core/uifw/dali-adaptor.git] / adaptors / common / performance-logger-impl.h
1 #ifndef __DALI_INTERNAL_PERFORMANCE_LOGGER_H__
2 #define __DALI_INTERNAL_PERFORMANCE_LOGGER_H__
3
4 /*
5  * Copyright (c) 2014 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 INCLUDES
22 #include <dali/public-api/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <base/interfaces/performance-interface.h>
26 #include <performance-logger.h>
27
28 namespace Dali
29 {
30
31 namespace Internal
32 {
33
34 namespace Adaptor
35 {
36
37 class PerformanceLogger;
38
39 typedef IntrusivePtr<PerformanceLogger> PerformanceLoggerPtr;
40
41 /**
42  * @brief Interface for the performance logger
43  */
44 class PerformanceLogger : public BaseObject
45 {
46 public:
47
48   /**
49    * @brief Create a new logger
50    *
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
53    */
54   static PerformanceLoggerPtr New( const char* name );
55
56   /**
57    * Constructor
58    * @param[in] name The name to assing to the logger
59    */
60   PerformanceLogger( const char* name );
61
62   /**
63    * Destructor.
64    */
65   virtual ~PerformanceLogger();
66
67   /**
68    * Add a performance marker
69    *
70    * @param markerType Performance marker type
71    */
72   void AddMarker( Dali::PerformanceLogger::Marker markerType );
73
74   /**
75    * Set the logging frequency
76    *
77    * @param logFrequency how often to log out in seconds
78    */
79   void SetLoggingFrequency( unsigned int logFrequency);
80
81   /**
82    * Set logging on or off for this logger
83    *
84    * @param[in] enable Enable logging or not
85    */
86   void EnableLogging( bool enable );
87
88 private: // Implementation
89
90   // not implemented
91   PerformanceLogger( const PerformanceLogger& );
92   PerformanceLogger& operator=( const PerformanceLogger& );
93
94 private:
95
96   PerformanceInterface::ContextId mContext;   ///< Context of this logger
97
98 };
99
100 // Helpers for public-api forwarding methods
101
102 inline static Internal::Adaptor::PerformanceLogger& GetImplementation( Dali::PerformanceLogger& logger )
103 {
104   DALI_ASSERT_ALWAYS( logger && "PerformanceLogger handle is empty" );
105
106   BaseObject& handle = logger.GetBaseObject();
107
108   return static_cast< Internal::Adaptor::PerformanceLogger& >( handle );
109 }
110
111 inline static const  Internal::Adaptor::PerformanceLogger& GetImplementation( const Dali::PerformanceLogger& logger )
112 {
113   DALI_ASSERT_ALWAYS( logger && "PerformanceLogger handle is empty" );
114
115   const BaseObject& handle = logger.GetBaseObject();
116
117   return static_cast< const Internal::Adaptor::PerformanceLogger& >( handle );
118 }
119
120 } // namespace Adaptor
121
122 } // namespace Internal
123
124 } // namespace Dali
125
126 #endif // __DALI_INTERNAL_PERFORMANCE_LOGGER_H__