30992d00e7bf8bca5addbd4d3b357c53c2ea4ec9
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / performance-logger.h
1 #ifndef __DALI_PERFORMANCE_LOGGER_H__
2 #define __DALI_PERFORMANCE_LOGGER_H__
3
4 /*
5  * Copyright (c) 2015 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-handle.h>
23
24 namespace Dali
25 {
26
27 namespace Internal DALI_INTERNAL
28 {
29 namespace Adaptor
30 {
31 class PerformanceLogger;
32 }
33 }
34
35 /**
36  * @brief Performance logger class
37  */
38 class DALI_IMPORT_API PerformanceLogger : public BaseHandle
39 {
40 public:
41
42   /**
43    * Enum for events that can be logged
44    */
45   enum Marker
46   {
47     START_EVENT,      ///< The start of timing
48     END_EVENT         ///< The end of timing
49   };
50
51   /**
52    * @brief Constructor, creates an uninitialized logger.
53    *
54    * Call New to fully construct a logger.
55    */
56   PerformanceLogger();
57
58   /**
59    * @brief Create a new logger
60    *
61    * @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.
62    * @return a new logger
63    */
64   static PerformanceLogger New( const char* name );
65
66   /**
67    * @brief Copy constructor.
68    *
69    * @param[in] logger The handle to copy. The copied handle will point at the same implementation
70    */
71   PerformanceLogger( const PerformanceLogger& logger );
72
73   /**
74    * @brief Assignment operator.
75    *
76    * @param[in] logger The handle to copy. This handle will point at the same implementation
77    * as the copied handle.
78    * @return Reference to this logger handle
79    */
80   PerformanceLogger& operator=( const PerformanceLogger& logger );
81
82   /**
83    * @brief Destructor
84    *
85    * This is non-virtual since derived Handle types must not contain data or virtual methods.
86    */
87   ~PerformanceLogger();
88
89   /**
90    * @brief Downcast an Object handle to PerformanceLogger handle.
91    *
92    * If handle points to a PerformanceLogger object the downcast produces a valid
93    * handle. If not the returned handle is left uninitialized.
94    *
95    * @param[in] handle to An object
96    * @return handle to a PerformanceLogger object or an uninitialized handle
97    */
98   static PerformanceLogger DownCast( BaseHandle handle );
99
100   /**
101    * Add a performance marker
102    *
103    * @param markerType Performance marker type
104    */
105   void AddMarker( Marker markerType );
106
107   /**
108    * Set the logging frequency
109    *
110    * @param logFrequency how often to log out in seconds
111    */
112   void SetLoggingFrequency( unsigned int logFrequency);
113
114   /**
115    * Set logging on or off for this logger
116    *
117    * @param[in] enable Enable logging or not
118    */
119   void EnableLogging( bool enable );
120
121   // Not intended for application developers
122
123   /**
124    * Creates a new handle from the implementation.
125    * @param[in] impl A pointer to the object.
126    */
127   explicit DALI_INTERNAL PerformanceLogger( Internal::Adaptor::PerformanceLogger* impl );
128
129 };
130
131 } // namespace Dali
132
133 #endif // __DALI_PERFORMANCE_LOGGER_H__