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