forked from organicmaps/organicmaps
added debugging to StoragePool and fixed primaryStorage consumer starvation deadlock.
This commit is contained in:
parent
767c68d14d
commit
1fba8663d8
7 changed files with 43 additions and 9 deletions
|
@ -21,11 +21,12 @@ struct BasePoolTraits
|
|||
{
|
||||
TElemFactory m_factory;
|
||||
ThreadedList<TElem> m_pool;
|
||||
bool m_IsDebugging;
|
||||
|
||||
typedef TElem elem_t;
|
||||
|
||||
BasePoolTraits(TElemFactory const & factory)
|
||||
: m_factory(factory)
|
||||
: m_factory(factory), m_IsDebugging(false)
|
||||
{
|
||||
m_pool.SetName(factory.ResName());
|
||||
}
|
||||
|
@ -68,14 +69,22 @@ struct SeparateFreePoolTraits : TBase
|
|||
typedef typename base_t::elem_t elem_t;
|
||||
|
||||
ThreadedList<elem_t> m_freePool;
|
||||
int m_maxFreePoolSize;
|
||||
|
||||
SeparateFreePoolTraits(TElemFactory const & factory)
|
||||
: base_t(factory)
|
||||
: base_t(factory), m_maxFreePoolSize(0)
|
||||
{}
|
||||
|
||||
void Free(elem_t const & elem)
|
||||
{
|
||||
m_freePool.PushBack(elem);
|
||||
if (base_t::m_IsDebugging)
|
||||
{
|
||||
int oldMaxFreePoolSize = m_maxFreePoolSize;
|
||||
m_maxFreePoolSize = max(m_maxFreePoolSize, (int)m_freePool.Size());
|
||||
if (oldMaxFreePoolSize != m_maxFreePoolSize)
|
||||
LOG(LINFO, ("freePool maximum size has reached", m_maxFreePoolSize, "elements"));
|
||||
}
|
||||
}
|
||||
|
||||
void MergeImpl(list<elem_t> & l)
|
||||
|
@ -88,6 +97,9 @@ struct SeparateFreePoolTraits : TBase
|
|||
base_t::m_pool.PushBack(*it);
|
||||
}
|
||||
|
||||
// if ((base_t::m_IsDebugging) && (!base_t::m_pool.GetName().empty()))
|
||||
// LOG(LINFO, ("pool for", base_t::m_pool.GetName(), "has", base_t::m_pool.Size(), "elements"));
|
||||
|
||||
l.clear();
|
||||
}
|
||||
|
||||
|
@ -178,6 +190,7 @@ public:
|
|||
virtual void Cancel() = 0;
|
||||
virtual bool IsCancelled() const = 0;
|
||||
virtual void Merge() = 0;
|
||||
virtual void SetIsDebugging(bool flag) = 0;
|
||||
};
|
||||
|
||||
// This class tracks OpenGL resources allocation in
|
||||
|
@ -236,4 +249,9 @@ public:
|
|||
{
|
||||
m_traits->Merge();
|
||||
}
|
||||
|
||||
void SetIsDebugging(bool isDebugging)
|
||||
{
|
||||
m_traits->m_IsDebugging = isDebugging;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -71,6 +71,11 @@ public:
|
|||
m_resName = name;
|
||||
}
|
||||
|
||||
string const & GetName() const
|
||||
{
|
||||
return m_resName;
|
||||
}
|
||||
|
||||
bool WaitNonEmpty()
|
||||
{
|
||||
double StartWaitTime = m_Timer.ElapsedSeconds();
|
||||
|
|
|
@ -203,6 +203,7 @@ bool Framework::IsEmptyModel() const
|
|||
|
||||
void Framework::PrepareToShutdown()
|
||||
{
|
||||
SetRenderPolicy(0);
|
||||
}
|
||||
|
||||
void Framework::SetMaxWorldRect()
|
||||
|
|
|
@ -257,7 +257,7 @@ void ScreenCoverage::Draw(yg::gl::Screen * s, ScreenBase const & screen)
|
|||
if (m_stylesCache)
|
||||
s->setAdditionalSkinPage(m_stylesCache->cachePage());
|
||||
|
||||
m_infoLayer.draw(s, m_screen.PtoGMatrix() * screen.GtoPMatrix());
|
||||
m_infoLayer.draw(s, m_screen.PtoGMatrix() * screen.GtoPMatrix());
|
||||
}
|
||||
|
||||
void ScreenCoverage::EndFrame(yg::gl::Screen *s)
|
||||
|
|
|
@ -42,11 +42,12 @@ TilingRenderPolicyST::TilingRenderPolicyST(VideoTimer * videoTimer,
|
|||
sizeof(yg::gl::Vertex),
|
||||
10000 * sizeof(unsigned short),
|
||||
sizeof(unsigned short),
|
||||
12,
|
||||
60,
|
||||
true,
|
||||
false,
|
||||
2,
|
||||
"primaryStorage");
|
||||
"primaryStorage",
|
||||
true);
|
||||
|
||||
rmp.m_smallStoragesParams = yg::ResourceManager::StoragePoolParams(2000 * sizeof(yg::gl::Vertex),
|
||||
sizeof(yg::gl::Vertex),
|
||||
|
@ -169,6 +170,7 @@ TilingRenderPolicyST::TilingRenderPolicyST(VideoTimer * videoTimer,
|
|||
p.m_visualScale = GetPlatform().VisualScale();
|
||||
p.m_useGuiResources = true;
|
||||
p.m_isSynchronized = false;
|
||||
// p.m_isDebugging = true;
|
||||
|
||||
m_drawer.reset(new DrawerYG(p));
|
||||
|
||||
|
|
|
@ -98,7 +98,8 @@ namespace yg
|
|||
m_isFixedBufferSize(true),
|
||||
m_isFixedBufferCount(true),
|
||||
m_scalePriority(0),
|
||||
m_poolName(poolName)
|
||||
m_poolName(poolName),
|
||||
m_isDebugging(false)
|
||||
{}
|
||||
|
||||
ResourceManager::StoragePoolParams::StoragePoolParams(size_t vbSize,
|
||||
|
@ -109,7 +110,8 @@ namespace yg
|
|||
bool isFixedBufferSize,
|
||||
bool isFixedBufferCount,
|
||||
int scalePriority,
|
||||
string const & poolName)
|
||||
string const & poolName,
|
||||
bool isDebugging)
|
||||
: m_vbSize(vbSize),
|
||||
m_vertexSize(vertexSize),
|
||||
m_ibSize(ibSize),
|
||||
|
@ -118,7 +120,8 @@ namespace yg
|
|||
m_isFixedBufferSize(isFixedBufferSize),
|
||||
m_isFixedBufferCount(isFixedBufferCount),
|
||||
m_scalePriority(scalePriority),
|
||||
m_poolName(poolName)
|
||||
m_poolName(poolName),
|
||||
m_isDebugging(isDebugging)
|
||||
{}
|
||||
|
||||
bool ResourceManager::StoragePoolParams::isFixed() const
|
||||
|
@ -492,6 +495,8 @@ namespace yg
|
|||
pool.reset(new TMergeableStoragePoolImpl(new TMergeableStoragePoolTraits(TStorageFactory(p.m_vbSize, p.m_ibSize, m_params.m_useVA, m_params.m_useSingleThreadedOGL, p.m_poolName.c_str()), p.m_storagesCount)));
|
||||
else
|
||||
pool.reset(new TNonMergeableStoragePoolImpl(new TNonMergeableStoragePoolTraits(TStorageFactory(p.m_vbSize, p.m_ibSize, m_params.m_useVA, m_params.m_useSingleThreadedOGL, p.m_poolName.c_str()), p.m_storagesCount)));
|
||||
|
||||
pool->SetIsDebugging(p.m_isDebugging);
|
||||
}
|
||||
else
|
||||
LOG(LINFO, ("no ", p.m_poolName, " resource"));
|
||||
|
|
|
@ -89,6 +89,8 @@ namespace yg
|
|||
|
||||
string m_poolName;
|
||||
|
||||
bool m_isDebugging;
|
||||
|
||||
StoragePoolParams(size_t vbSize,
|
||||
size_t vertexSize,
|
||||
size_t ibSize,
|
||||
|
@ -97,7 +99,8 @@ namespace yg
|
|||
bool isFixedBufferSize,
|
||||
bool isFixedBufferCount,
|
||||
int scalePriority,
|
||||
string const & poolName);
|
||||
string const & poolName,
|
||||
bool isDebugging = false);
|
||||
|
||||
StoragePoolParams(string const & poolName);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue