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