593a4015af7b3e9b630d0e888e519a1bde6cda23
[platform/core/uifw/dali-adaptor.git] / adaptors / base / performance-logging / 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 <base/interfaces/performance-interface.h>
23 #include <base/performance-logging/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    * Constructor
43    * @param type marker type
44    */
45   PerformanceMarker( PerformanceInterface::MarkerType type );
46
47   /**
48    * Constructor
49    * @param type marker type
50    * @param time time stamp
51    */
52   PerformanceMarker( PerformanceInterface::MarkerType type,  FrameTimeStamp time );
53
54   /**
55    * @return the time stamp
56    */
57   const FrameTimeStamp& GetTimeStamp() const
58   {
59     return mTimeStamp;
60   }
61
62   /**
63    * @return the type of marker
64    */
65   PerformanceInterface::MarkerType GetType() const
66   {
67     return mType;
68   }
69
70   /**
71    * @param start the start marker
72    * @param end the end marker
73    * @return difference in microseconds between two markers
74    */
75   static unsigned int MicrosecondDiff( const PerformanceMarker& start, const PerformanceMarker& end  );
76
77 private:
78
79   PerformanceInterface::MarkerType mType;         ///< marker type
80   FrameTimeStamp mTimeStamp;                      ///< frame time stamp
81
82 };
83
84 } // namespace Adaptor
85
86 } // namespace Internal
87
88 } // namespace Dali
89
90 #endif // __DALI_INTERNAL_ADAPTOR_PERFORMANCE_MARKER_H__