1 #ifndef __DALI_INTERNAL_BASE_PERFORMANCE_INTERFACE_H__
2 #define __DALI_INTERNAL_BASE_PERFORMANCE_INTERFACE_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
31 * Abstract Performance Interface.
32 * Used by the Adaptor to store performance metrics.
35 class PerformanceInterface
39 typedef unsigned short ContextId; ///< Type to represent a context ID
42 * bitmask of logging options
47 ENABLED = 1 << 0, ///< Bit 0, log all
48 LOG_UPDATE_RENDER = 1 << 1, ///< Bit 1, log update and render times
49 LOG_EVENT_PROCESS = 1 << 2, ///< Bit 2, log event process times
50 LOG_EVENTS_TO_KERNEL = 1 << 3 ///< Bit 3, log all events to kernel trace
54 * enum for difference performance markers.
55 * Please modify the name lookup table in performance-interface.cpp
56 * file if adding new markers.
60 VSYNC = 0, ///< V-Sync
61 UPDATE_START , ///< Update start
62 UPDATE_END , ///< Update end
63 RENDER_START , ///< Render start
64 RENDER_END , ///< Render end
65 SWAP_START , ///< SwapBuffers Start
66 SWAP_END , ///< SwapBuffers End
67 PROCESS_EVENTS_START, ///< Process events start (e.g. touch event)
68 PROCESS_EVENTS_END, ///< Process events end
69 PAUSED , ///< Pause start
70 RESUME , ///< Resume start
71 START , ///< The start of custom tracking
72 END ///< The end of custom tracking
78 PerformanceInterface() {}
83 virtual ~PerformanceInterface() {};
86 * Add a new context with a given name
88 * @param[in] name The name of the context
89 * @return Return the unique id for this context
91 virtual ContextId AddContext( const char* name ) = 0;
94 * Remove a context from use
96 * @param[in] contextId The ID of the context to remove
98 virtual void RemoveContext( ContextId contextId ) = 0;
101 * Add a performance marker
102 * This function can be called from ANY THREAD.
103 * The default context 0 Event/Update/Render is assumed.
104 * @param markerType performance marker type
106 virtual void AddMarker( MarkerType markerType ) = 0;
109 * Add a performance marker
110 * This function can be called from ANY THREAD.
111 * @param markerType performance marker type
112 * @param contextId The context of the marker. This must be one generated by AddContext.
114 virtual void AddMarker( MarkerType markerType, ContextId contextId ) = 0;
117 * Set the logging level and frequency
118 * @param level 0 = disabled, 1 = enabled
119 * @param logFrequency how often to log out in seconds
121 virtual void SetLogging( unsigned int level, unsigned int logFrequency) = 0;
124 * Set the logging frequency
126 * @param logFrequency how often to log out in seconds
128 virtual void SetLoggingFrequency( unsigned int logFrequency, ContextId contextId ) = 0;
131 * Set logging on or off for a particular context
133 * @param[in] enable Enable logging or not
134 * @param[in] contextId The id of the context to log. This must be one generated by AddContext.
136 virtual void EnableLogging( bool enable, ContextId contextId ) = 0;
140 // Undefined copy constructor.
141 PerformanceInterface( const PerformanceInterface& );
143 // Undefined assignment operator.
144 PerformanceInterface& operator=( const PerformanceInterface& );
148 } // namespace Internal
150 } // namespace Adaptor