Added memory pool logging
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-instruction.cpp
index e9709b5..f42041f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -43,9 +43,7 @@ RenderInstruction::RenderInstruction()
   mRenderLists.Reserve(6);
 }
 
-RenderInstruction::~RenderInstruction()
-{ // pointer container releases the renderlists
-}
+RenderInstruction::~RenderInstruction() = default;
 
 RenderList& RenderInstruction::GetNextFreeRenderList(size_t capacityRequired)
 {
@@ -127,6 +125,20 @@ void RenderInstruction::Reset(Camera*              camera,
   }
 }
 
+std::size_t RenderInstruction::GetCapacity()
+{
+  std::size_t                        capacity{0u};
+  RenderListContainer::Iterator      iter = mRenderLists.Begin();
+  RenderListContainer::ConstIterator end  = mRenderLists.End();
+  for(; iter != end; ++iter)
+  {
+    capacity += ((*iter)->GetCachedItemCount() * (sizeof(RenderItem) + sizeof(RenderItem*)));
+    capacity += sizeof(RenderList);
+  }
+  capacity += sizeof(RenderInstruction);
+  return capacity;
+}
+
 } // namespace SceneGraph
 
 } // namespace Internal