2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/system/common/performance-marker.h>
22 #include <dali/integration-api/debug.h>
40 PerformanceInterface::MarkerType type;
41 const char* const name;
42 PerformanceMarker::MarkerFilter group;
43 PerformanceMarker::MarkerEventType eventType;
46 const NamePair MARKER_LOOKUP[] =
48 // timed event names must be postfixed with with _START and _END
49 // this is to allow tracers to extract the event name by removing the _START, _END strings
51 { PerformanceInterface::VSYNC , "V_SYNC" , PerformanceMarker::V_SYNC_EVENTS, PerformanceMarker::SINGLE_EVENT },
52 { PerformanceInterface::UPDATE_START , "UPDATE_START" , PerformanceMarker::UPDATE, PerformanceMarker::START_TIMED_EVENT },
53 { PerformanceInterface::UPDATE_END , "UPDATE_END" , PerformanceMarker::UPDATE, PerformanceMarker::END_TIMED_EVENT },
54 { PerformanceInterface::RENDER_START , "RENDER_START" , PerformanceMarker::RENDER, PerformanceMarker::START_TIMED_EVENT },
55 { PerformanceInterface::RENDER_END , "RENDER_END" , PerformanceMarker::RENDER, PerformanceMarker::END_TIMED_EVENT },
56 { PerformanceInterface::SWAP_START , "SWAP_START" , PerformanceMarker::SWAP_BUFFERS, PerformanceMarker::START_TIMED_EVENT },
57 { PerformanceInterface::SWAP_END , "SWAP_END" , PerformanceMarker::SWAP_BUFFERS, PerformanceMarker::END_TIMED_EVENT },
58 { PerformanceInterface::PROCESS_EVENTS_START, "PROCESS_EVENT_START" , PerformanceMarker::EVENT_PROCESS, PerformanceMarker::START_TIMED_EVENT },
59 { PerformanceInterface::PROCESS_EVENTS_END, "PROCESS_EVENT_END" , PerformanceMarker::EVENT_PROCESS, PerformanceMarker::END_TIMED_EVENT },
60 { PerformanceInterface::PAUSED , "PAUSED" , PerformanceMarker::LIFE_CYCLE_EVENTS, PerformanceMarker::SINGLE_EVENT },
61 { PerformanceInterface::RESUME , "RESUMED" , PerformanceMarker::LIFE_CYCLE_EVENTS, PerformanceMarker::SINGLE_EVENT },
62 { PerformanceInterface::START , "START" , PerformanceMarker::CUSTOM_EVENTS, PerformanceMarker::START_TIMED_EVENT },
63 { PerformanceInterface::END , "END" , PerformanceMarker::CUSTOM_EVENTS, PerformanceMarker::END_TIMED_EVENT }
65 } // un-named namespace
69 PerformanceMarker::PerformanceMarker( PerformanceInterface::MarkerType type )
74 PerformanceMarker::PerformanceMarker( PerformanceInterface::MarkerType type, FrameTimeStamp frameInfo )
80 const char* PerformanceMarker::GetName( ) const
82 return MARKER_LOOKUP[ mType ].name;
85 PerformanceMarker::MarkerEventType PerformanceMarker::GetEventType() const
87 return MARKER_LOOKUP[ mType ].eventType;
90 PerformanceMarker::MarkerFilter PerformanceMarker::GetFilterType() const
92 return MARKER_LOOKUP[ mType ].group;
95 unsigned int PerformanceMarker::MicrosecondDiff( const PerformanceMarker& start,const PerformanceMarker& end )
97 return FrameTimeStamp::MicrosecondDiff( start.mTimeStamp, end.mTimeStamp );
100 bool PerformanceMarker::IsFilterEnabled( MarkerFilter filter ) const
102 return (filter & MARKER_LOOKUP[ mType ].group);
106 } // namespace Adaptor
108 } // namespace Internal