New Constraints
[platform/core/uifw/dali-core.git] / dali / integration-api / profiling.cpp
1 /*
2  * Copyright (c) 2014 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/text-actor-impl.h>
30 #include <dali/internal/event/actors/image-actor-impl.h>
31 #include <dali/internal/event/actors/mesh-actor-impl.h>
32 #include <dali/internal/event/actors/layer-impl.h>
33
34 #include <dali/internal/event/actor-attachments/actor-attachment-impl.h>
35 #include <dali/internal/event/actor-attachments/camera-attachment-impl.h>
36 #include <dali/internal/event/actor-attachments/text-attachment-impl.h>
37 #include <dali/internal/event/actor-attachments/image-attachment-impl.h>
38 #include <dali/internal/event/actor-attachments/mesh-attachment-impl.h>
39
40 #include <dali/internal/event/animation/animation-impl.h>
41 #include <dali/internal/event/animation/animator-connector.h>
42 #include <dali/internal/event/animation/constraint-impl.h>
43 #include <dali/internal/update/animation/property-accessor.h>
44 #include <dali/internal/update/animation/scene-graph-animation.h>
45 #include <dali/internal/update/animation/scene-graph-constraint.h>
46
47
48 #include <dali/internal/event/images/image-impl.h>
49 #include <dali/internal/event/images/image-factory-cache.h>
50 #include <dali/internal/common/text-parameters.h>
51 #include <dali/internal/event/modeling/mesh-impl.h>
52 #include <dali/internal/event/modeling/material-impl.h>
53
54 #include <dali/internal/event/resources/resource-ticket.h>
55 #include <dali/internal/event/resources/image-ticket.h>
56
57 #include <dali/internal/update/nodes/node.h>
58 #include <dali/internal/update/nodes/scene-graph-layer.h>
59 #include <dali/internal/update/modeling/internal-mesh-data.h>
60 #include <dali/internal/update/modeling/scene-graph-animatable-mesh.h>
61 #include <dali/internal/update/modeling/scene-graph-material.h>
62 #include <dali/internal/update/modeling/scene-graph-mesh.h>
63
64 #include <dali/internal/update/node-attachments/node-attachment.h>
65 #include <dali/internal/update/node-attachments/scene-graph-camera-attachment.h>
66 #include <dali/internal/update/node-attachments/scene-graph-image-attachment.h>
67 #include <dali/internal/update/node-attachments/scene-graph-mesh-attachment.h>
68 #include <dali/internal/update/node-attachments/scene-graph-text-attachment.h>
69
70 #include <dali/internal/update/resources/bitmap-metadata.h>
71
72 #include <dali/internal/render/gl-resources/bitmap-texture.h>
73
74 #include <dali/internal/render/renderers/render-material.h>
75 #include <dali/internal/render/renderers/scene-graph-image-renderer.h>
76 #include <dali/internal/render/renderers/scene-graph-text-renderer.h>
77 #include <dali/internal/render/renderers/scene-graph-mesh-renderer.h>
78
79 using Dali::Internal::GestureEventProcessor;
80 using Dali::Internal::ThreadLocalStorage;
81
82 namespace Dali
83 {
84
85 namespace Integration
86 {
87
88 void EnableProfiling( ProfilingType type )
89 {
90   GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
91
92   switch( type )
93   {
94     case PROFILING_TYPE_PAN_GESTURE:
95     {
96       eventProcessor.EnablePanGestureProfiling();
97     }
98
99     default:
100     {
101       // Do nothing
102       break;
103     }
104   }
105 }
106
107 namespace Profiling
108 {
109
110 const int ANIMATION_MEMORY_SIZE(
111   sizeof( Internal::Animation ) +
112   sizeof( Internal::AnimatorConnector<float> ) +
113   sizeof( Internal::SceneGraph::Animation ) );
114 const int CONSTRAINT_MEMORY_SIZE(
115   sizeof( Internal::Constraint<float> ) +
116   sizeof( Internal::SceneGraph::Constraint<float, Internal::PropertyAccessor<float> > ) );
117 const int ACTOR_MEMORY_SIZE(
118   sizeof( Internal::Actor ) +
119   sizeof( Internal::ActorAttachment ) +
120   sizeof( Internal::SceneGraph::Node ) +
121   sizeof( Internal::SceneGraph::NodeAttachment ));
122 const int CAMERA_ACTOR_MEMORY_SIZE(
123   sizeof( Internal::CameraActor ) +
124   sizeof( Internal::CameraAttachment ) +
125   sizeof( Internal::SceneGraph::Node ) +
126   sizeof( Internal::SceneGraph::CameraAttachment ) );
127 const int TEXT_ACTOR_MEMORY_SIZE(
128   sizeof( Internal::TextActor ) +
129   sizeof( Internal::TextAttachment ) +
130   sizeof( Internal::SceneGraph::Node ) +
131   sizeof( Internal::SceneGraph::TextAttachment ) +
132   sizeof( Internal::TextParameters ) +
133   sizeof( Internal::SceneGraph::TextRenderer ) );
134 const int MESH_ACTOR_MEMORY_SIZE(
135   sizeof( Internal::MeshActor ) +
136   sizeof( Internal::MeshAttachment ) +
137   sizeof( Internal::SceneGraph::Node ) +
138   sizeof( Internal::SceneGraph::MeshAttachment ) +
139   sizeof( Internal::SceneGraph::MeshRenderer ) );
140 const int IMAGE_ACTOR_MEMORY_SIZE(
141   sizeof( Internal::ImageActor ) +
142   sizeof( Internal::ImageAttachment ) +
143   sizeof( Internal::SceneGraph::Node ) +
144   sizeof( Internal::SceneGraph::ImageAttachment ) +
145   sizeof( Internal::SceneGraph::ImageRenderer ));
146 const int LAYER_MEMORY_SIZE(
147   sizeof( Internal::Layer ) +
148   sizeof( Internal::ActorAttachment ) +
149   sizeof( Internal::SceneGraph::Layer ) +
150   sizeof( Internal::SceneGraph::NodeAttachment ) );
151 const int IMAGE_MEMORY_SIZE(
152   sizeof( Internal::Image ) +
153   sizeof( Internal::ImageFactoryCache::Request ) +
154   sizeof( Integration::Bitmap ) +
155   sizeof( Internal::BitmapMetadata ) +
156   sizeof( Internal::BitmapTexture ) +
157   sizeof( Internal::ImageTicket ) );
158 const int MESH_MEMORY_SIZE(
159   sizeof( Internal::Mesh ) +
160   sizeof( Internal::MeshData ) +
161   sizeof( Internal::SceneGraph::Mesh ) +
162   sizeof( Internal::ResourceTicket ) );
163 const int MATERIAL_MEMORY_SIZE(
164   sizeof( Internal::Material ) +
165   sizeof( Internal::SceneGraph::Material ) +
166   sizeof( Internal::SceneGraph::RenderMaterial ) );
167
168 } // namespace Profiling
169
170 } // namespace Integration
171
172 } // namespace Dali