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>
34 PerformanceInterface::MarkerType type;
35 const char* const name;
36 PerformanceMarker::MarkerFilter group;
37 PerformanceMarker::MarkerEventType eventType;
41 const NamePair MARKER_LOOKUP[] =
43 // timed event names must be postfixed with with _START and _END
44 // this is to allow tracers to extract the event name by removing the _START, _END strings
46 {PerformanceInterface::VSYNC, "V_SYNC", PerformanceMarker::V_SYNC_EVENTS, PerformanceMarker::SINGLE_EVENT },
47 {PerformanceInterface::UPDATE_START, "UPDATE_START", PerformanceMarker::UPDATE, PerformanceMarker::START_TIMED_EVENT},
48 {PerformanceInterface::UPDATE_END, "UPDATE_END", PerformanceMarker::UPDATE, PerformanceMarker::END_TIMED_EVENT },
49 {PerformanceInterface::RENDER_START, "RENDER_START", PerformanceMarker::RENDER, PerformanceMarker::START_TIMED_EVENT},
50 {PerformanceInterface::RENDER_END, "RENDER_END", PerformanceMarker::RENDER, PerformanceMarker::END_TIMED_EVENT },
51 {PerformanceInterface::SWAP_START, "SWAP_START", PerformanceMarker::SWAP_BUFFERS, PerformanceMarker::START_TIMED_EVENT},
52 {PerformanceInterface::SWAP_END, "SWAP_END", PerformanceMarker::SWAP_BUFFERS, PerformanceMarker::END_TIMED_EVENT },
53 {PerformanceInterface::PROCESS_EVENTS_START, "PROCESS_EVENT_START", PerformanceMarker::EVENT_PROCESS, PerformanceMarker::START_TIMED_EVENT},
54 {PerformanceInterface::PROCESS_EVENTS_END, "PROCESS_EVENT_END", PerformanceMarker::EVENT_PROCESS, PerformanceMarker::END_TIMED_EVENT },
55 {PerformanceInterface::PAUSED, "PAUSED", PerformanceMarker::LIFE_CYCLE_EVENTS, PerformanceMarker::SINGLE_EVENT },
56 {PerformanceInterface::RESUME, "RESUMED", PerformanceMarker::LIFE_CYCLE_EVENTS, PerformanceMarker::SINGLE_EVENT },
57 {PerformanceInterface::START, "START", PerformanceMarker::CUSTOM_EVENTS, PerformanceMarker::START_TIMED_EVENT},
58 {PerformanceInterface::END, "END", PerformanceMarker::CUSTOM_EVENTS, PerformanceMarker::END_TIMED_EVENT }
63 PerformanceMarker::PerformanceMarker(PerformanceInterface::MarkerType type)
68 PerformanceMarker::PerformanceMarker(PerformanceInterface::MarkerType type, FrameTimeStamp frameInfo)
74 const char* PerformanceMarker::GetName() const
76 return MARKER_LOOKUP[mType].name;
79 PerformanceMarker::MarkerEventType PerformanceMarker::GetEventType() const
81 return MARKER_LOOKUP[mType].eventType;
84 PerformanceMarker::MarkerFilter PerformanceMarker::GetFilterType() const
86 return MARKER_LOOKUP[mType].group;
89 unsigned int PerformanceMarker::MicrosecondDiff(const PerformanceMarker& start, const PerformanceMarker& end)
91 return FrameTimeStamp::MicrosecondDiff(start.mTimeStamp, end.mTimeStamp);
94 bool PerformanceMarker::IsFilterEnabled(MarkerFilter filter) const
96 return (filter & MARKER_LOOKUP[mType].group);
99 } // namespace Adaptor
101 } // namespace Internal