DALi Version 2.2.21
[platform/core/uifw/dali-core.git] / dali / integration-api / profiling.cpp
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/integration-api/profiling.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/integration-api/bitmap.h>
23
24 #include <dali/internal/event/common/thread-local-storage.h>
25 #include <dali/internal/event/events/gesture-event-processor.h>
26
27 #include <dali/internal/event/actors/actor-impl.h>
28 #include <dali/internal/event/actors/camera-actor-impl.h>
29 #include <dali/internal/event/actors/layer-impl.h>
30
31 #include <dali/internal/event/rendering/geometry-impl.h>
32 #include <dali/internal/event/rendering/renderer-impl.h>
33 #include <dali/internal/event/rendering/sampler-impl.h>
34 #include <dali/internal/event/rendering/shader-impl.h>
35 #include <dali/internal/event/rendering/texture-set-impl.h>
36 #include <dali/internal/event/rendering/vertex-buffer-impl.h>
37
38 #include <dali/internal/event/animation/animation-impl.h>
39 #include <dali/internal/event/animation/animator-connector.h>
40 #include <dali/internal/event/animation/constraint-impl.h>
41 #include <dali/internal/update/animation/property-accessor.h>
42 #include <dali/internal/update/animation/scene-graph-animation.h>
43 #include <dali/internal/update/animation/scene-graph-constraint.h>
44
45 #include <dali/internal/update/nodes/node.h>
46 #include <dali/internal/update/nodes/scene-graph-layer.h>
47
48 #include <dali/internal/update/rendering/scene-graph-renderer.h>
49
50 #include <dali/internal/render/renderers/render-geometry.h>
51 #include <dali/internal/render/renderers/render-renderer.h>
52 #include <dali/internal/render/renderers/render-sampler.h>
53 #include <dali/internal/render/renderers/render-vertex-buffer.h>
54 #include <dali/internal/update/render-tasks/scene-graph-camera.h>
55
56 using Dali::Internal::GestureEventProcessor;
57 using Dali::Internal::ThreadLocalStorage;
58
59 namespace Dali
60 {
61 namespace Integration
62 {
63 void EnableProfiling(ProfilingType type)
64 {
65   GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
66
67   switch(type)
68   {
69     case PROFILING_TYPE_PAN_GESTURE:
70     {
71       eventProcessor.EnablePanGestureProfiling();
72       break;
73     }
74     case PROFILING_TYPE_END:
75     {
76       // nothing to do
77       break;
78     }
79   }
80 }
81
82 namespace Profiling
83 {
84 const std::size_t ANIMATION_MEMORY_SIZE(
85   sizeof(Internal::Animation) +
86   sizeof(Internal::AnimatorConnector<float>) +
87   sizeof(Internal::SceneGraph::Animation));
88 const std::size_t CONSTRAINT_MEMORY_SIZE(
89   sizeof(Internal::Constraint<float>) +
90   sizeof(Internal::SceneGraph::Constraint<float, Internal::PropertyAccessor<float> >));
91 const std::size_t ACTOR_MEMORY_SIZE(
92   sizeof(Internal::Actor) +
93   sizeof(Internal::SceneGraph::Node));
94 const std::size_t CAMERA_ACTOR_MEMORY_SIZE(
95   sizeof(Internal::CameraActor) +
96   sizeof(Internal::SceneGraph::Node) +
97   sizeof(Internal::SceneGraph::Camera));
98 const std::size_t LAYER_MEMORY_SIZE(
99   sizeof(Internal::Layer) +
100   sizeof(Internal::SceneGraph::Layer));
101 const std::size_t RENDERER_MEMORY_SIZE(
102   sizeof(Internal::Renderer) +
103   sizeof(Internal::SceneGraph::Renderer) +
104   sizeof(Internal::Render::Renderer));
105 const std::size_t GEOMETRY_MEMORY_SIZE(
106   sizeof(Internal::Geometry) +
107   sizeof(Internal::Render::Geometry));
108 const std::size_t PROPERTY_BUFFER_MEMORY_SIZE(
109   sizeof(Internal::VertexBuffer) +
110   sizeof(Internal::Render::VertexBuffer));
111 const std::size_t TEXTURE_SET_MEMORY_SIZE(
112   sizeof(Internal::TextureSet) +
113   sizeof(Internal::SceneGraph::TextureSet));
114 const std::size_t SAMPLER_MEMORY_SIZE(
115   sizeof(Internal::Sampler) +
116   sizeof(Internal::Render::Sampler));
117 const std::size_t SHADER_MEMORY_SIZE(
118   sizeof(Internal::Shader) +
119   sizeof(Internal::SceneGraph::Shader));
120
121 } // namespace Profiling
122
123 } // namespace Integration
124
125 } // namespace Dali