Revert "[Tizen] Revert "Remove StereoMode""
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / common / performance-marker.h
1 #ifndef __DALI_INTERNAL_ADAPTOR_PERFORMANCE_MARKER_H__
2 #define __DALI_INTERNAL_ADAPTOR_PERFORMANCE_MARKER_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 // INTERNAL INCLUDES
22 #include <dali/internal/system/common/performance-interface.h>
23 #include <dali/internal/system/common/frame-time-stamp.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 namespace Adaptor
32 {
33
34 /**
35  * Marker used to record an event with a time stamp in Dali
36  */
37 class PerformanceMarker
38 {
39 public:
40
41
42   /**
43    * Bitmask used to filter different types of markers based
44    * on what group they belong to.
45    */
46   enum MarkerFilter
47   {
48     FILTERING_DISABLED   = 0,      ///< disabled
49     V_SYNC_EVENTS        = 1 << 0, ///< v-sync
50     UPDATE               = 1 << 1, ///< update start / end
51     RENDER               = 1 << 2, ///< render start / end
52     EVENT_PROCESS        = 1 << 3, ///< process events start / end
53     SWAP_BUFFERS         = 1 << 4, ///< swap buffers start / end
54     LIFE_CYCLE_EVENTS    = 1 << 5, ///< pause / resume
55     RESOURCE_EVENTS      = 1 << 6, ///< resource events
56     CUSTOM_EVENTS        = 1 << 7
57   };
58
59   /**
60    * Marker event type
61    */
62   enum MarkerEventType
63   {
64     SINGLE_EVENT,           ///< event is something that has no duration associated with it
65     START_TIMED_EVENT,      ///< start of a timed event
66     END_TIMED_EVENT         ///< end of a timed event
67
68   };
69
70
71   /**
72    * @brief Constructor
73    * @param[in] type marker type
74    */
75   PerformanceMarker( PerformanceInterface::MarkerType type );
76
77   /**
78    * @brief Constructor
79    * @param[in] type marker type
80    * @param[in] time time stamp
81    */
82   PerformanceMarker( PerformanceInterface::MarkerType type,  FrameTimeStamp time );
83
84   /**
85    * @return the time stamp
86    */
87   const FrameTimeStamp& GetTimeStamp() const
88   {
89     return mTimeStamp;
90   }
91
92   /**
93    * @return the type of marker
94    */
95   PerformanceInterface::MarkerType GetType() const
96   {
97     return mType;
98   }
99
100   /**
101    * @return the event type of marker
102    */
103   MarkerEventType GetEventType() const;
104
105   /**
106    * @return the filter type of marker
107    */
108   MarkerFilter GetFilterType() const;
109
110
111   /**
112    * @return marker name
113    */
114   const char* GetName( ) const;
115
116   /**
117    * @param start the start marker
118    * @param end the end marker
119    * @return difference in microseconds between two markers
120    */
121   static unsigned int MicrosecondDiff( const PerformanceMarker& start, const PerformanceMarker& end  );
122
123   /**
124    * @return if a marker is enabled as part of a group
125    */
126   bool IsFilterEnabled( MarkerFilter filter ) const;
127 private:
128
129   PerformanceInterface::MarkerType mType;         ///< marker type
130   FrameTimeStamp mTimeStamp;                      ///< frame time stamp
131
132 };
133
134 } // namespace Adaptor
135
136 } // namespace Internal
137
138 } // namespace Dali
139
140 #endif // __DALI_INTERNAL_ADAPTOR_PERFORMANCE_MARKER_H__