Merge branch 'devel/master' into tizen
[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/image-actor-impl.h>
30 #include <dali/internal/event/actors/layer-impl.h>
31
32 #include <dali/internal/event/animation/animation-impl.h>
33 #include <dali/internal/event/animation/animator-connector.h>
34 #include <dali/internal/event/animation/constraint-impl.h>
35 #include <dali/internal/update/animation/property-accessor.h>
36 #include <dali/internal/update/animation/scene-graph-animation.h>
37 #include <dali/internal/update/animation/scene-graph-constraint.h>
38
39
40 #include <dali/internal/event/images/image-impl.h>
41 #include <dali/internal/event/images/image-factory-cache.h>
42
43 #include <dali/internal/event/resources/resource-ticket.h>
44 #include <dali/internal/event/resources/image-ticket.h>
45
46 #include <dali/internal/update/nodes/node.h>
47 #include <dali/internal/update/nodes/scene-graph-layer.h>
48
49 #include <dali/internal/update/node-attachments/node-attachment.h>
50 #include <dali/internal/update/node-attachments/scene-graph-camera-attachment.h>
51
52 #include <dali/internal/update/rendering/scene-graph-renderer.h>
53 #include <dali/internal/update/resources/texture-metadata.h>
54
55 #include <dali/internal/render/gl-resources/bitmap-texture.h>
56 #include <dali/internal/render/renderers/render-geometry.h>
57 #include <dali/internal/render/renderers/render-property-buffer.h>
58 #include <dali/internal/render/renderers/render-renderer.h>
59 #include <dali/internal/render/renderers/render-sampler.h>
60
61 using Dali::Internal::GestureEventProcessor;
62 using Dali::Internal::ThreadLocalStorage;
63
64 namespace Dali
65 {
66
67 namespace Integration
68 {
69
70 void EnableProfiling( ProfilingType type )
71 {
72   GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
73
74   switch( type )
75   {
76     case PROFILING_TYPE_PAN_GESTURE:
77     {
78       eventProcessor.EnablePanGestureProfiling();
79       break;
80     }
81     case PROFILING_TYPE_END:
82     {
83       // nothing to do
84       break;
85     }
86   }
87 }
88
89 namespace Profiling
90 {
91
92 const int ANIMATION_MEMORY_SIZE(
93   sizeof( Internal::Animation ) +
94   sizeof( Internal::AnimatorConnector<float> ) +
95   sizeof( Internal::SceneGraph::Animation ) );
96 const int CONSTRAINT_MEMORY_SIZE(
97   sizeof( Internal::Constraint<float> ) +
98   sizeof( Internal::SceneGraph::Constraint<float, Internal::PropertyAccessor<float> > ) );
99 const int ACTOR_MEMORY_SIZE(
100   sizeof( Internal::Actor ) +
101   sizeof( Internal::SceneGraph::Node ) +
102   sizeof( Internal::SceneGraph::NodeAttachment ));
103 const int CAMERA_ACTOR_MEMORY_SIZE(
104   sizeof( Internal::CameraActor ) +
105   sizeof( Internal::SceneGraph::Node ) +
106   sizeof( Internal::SceneGraph::CameraAttachment ) );
107 const int IMAGE_ACTOR_MEMORY_SIZE(
108   sizeof( Internal::ImageActor ) +
109   sizeof( Internal::SceneGraph::Node ) +
110   sizeof( Internal::Render::Renderer ));
111 const int LAYER_MEMORY_SIZE(
112   sizeof( Internal::Layer ) +
113   sizeof( Internal::SceneGraph::Layer ) +
114   sizeof( Internal::SceneGraph::NodeAttachment ) );
115 const int IMAGE_MEMORY_SIZE(
116   sizeof( Internal::Image ) +
117   sizeof( Internal::ImageFactoryCache::Request ) +
118   sizeof( Integration::Bitmap ) +
119   sizeof( Internal::TextureMetadata ) +
120   sizeof( Internal::BitmapTexture ) +
121   sizeof( Internal::ImageTicket ) );
122 const int RENDERER_MEMORY_SIZE(
123   sizeof( Internal::Renderer ) +
124   sizeof( Internal::SceneGraph::Renderer ) +
125   sizeof( Internal::Render::Renderer ) );
126 const int GEOMETRY_MEMORY_SIZE(
127   sizeof( Internal::Geometry ) +
128   sizeof( Internal::Render::Geometry) );
129 const int PROPERTY_BUFFER_MEMORY_SIZE(
130   sizeof( Internal::PropertyBuffer ) +
131   sizeof( Internal::Render::PropertyBuffer ) );
132 const int TEXTURE_SET_MEMORY_SIZE(
133   sizeof( Internal::TextureSet ) +
134   sizeof( Internal::SceneGraph::TextureSet ) );
135 const int SAMPLER_MEMORY_SIZE(
136   sizeof( Internal::Sampler ) +
137   sizeof( Internal::Render::Sampler ) );
138 const int SHADER_MEMORY_SIZE(
139   sizeof( Internal::Shader ) +
140   sizeof( Internal::SceneGraph::Shader ) );
141
142 } // namespace Profiling
143
144 } // namespace Integration
145
146 } // namespace Dali