1 #ifndef __DALI_ADAPTOR_OBJECT_PROFILER_H__
2 #define __DALI_ADAPTOR_OBJECT_PROFILER_H__
5 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/object/object-registry.h>
24 #include <dali/public-api/object/type-registry.h>
25 #include <dali/public-api/signals/connection-tracker.h>
38 * Class to profile the number of instances of Objects in the system
40 class ObjectProfiler : public ConnectionTracker
46 * @param timeInterval to specify the frequency of reporting
48 ObjectProfiler( unsigned int timeInterval );
56 * Display a list of types with the current number of instances in the system
58 void DisplayInstanceCounts();
62 * If timer is running, display the instance counts
67 * Callback used when objects are created. Increases instance count for that object type
68 * @param[in] handle of the created object
70 void OnObjectCreated(BaseHandle handle);
73 * Callback used when objects are created. Decreases instance count for that object type
74 * @param[in] object The object being destroyed
76 void OnObjectDestroyed(const Dali::RefObject* object);
79 * Get the memory size of the given object
81 int GetMemorySize(const std::string& name, int count);
85 using InstanceCountPair = std::pair< const std::string, int >;
86 using InstanceTypePair = std::pair< BaseObject*, std::string >;
88 Dali::ObjectRegistry mObjectRegistry;
90 std::vector< InstanceCountPair > mInstanceCountContainer;
91 std::vector< InstanceTypePair > mInstanceTypes;
98 #endif // __DALI_ADAPTOR_OBJECT_PROFILER_H__