MCPcopy Create free account
hub / github.com/comaps/comaps / GetMemorySnapshot

Method GetMemorySnapshot

libs/drape/utils/gpu_mem_tracker.cpp:41–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41GPUMemTracker::GPUMemorySnapshot GPUMemTracker::GetMemorySnapshot()
42{
43 GPUMemorySnapshot memStat;
44
45 {
46 std::lock_guard<std::mutex> g(m_mutex);
47 for (auto const & kv : m_memTracker)
48 {
49 TagMemorySnapshot & tagStat = memStat.m_tagStats[kv.first.first];
50 tagStat.m_objectsCount++;
51 tagStat.m_alocatedInMb += kv.second.first;
52 tagStat.m_usedInMb += kv.second.second;
53
54 memStat.m_summaryAllocatedInMb += kv.second.first;
55 memStat.m_summaryUsedInMb += kv.second.second;
56 }
57 memStat.m_averageAllocations = m_averageAllocations;
58 }
59
60 auto constexpr kByteToMb = static_cast<float>(1024 * 1024);
61 for (auto & it : memStat.m_tagStats)
62 {
63 it.second.m_alocatedInMb /= kByteToMb;
64 it.second.m_usedInMb /= kByteToMb;
65 }
66 memStat.m_summaryAllocatedInMb /= kByteToMb;
67 memStat.m_summaryUsedInMb /= kByteToMb;
68
69 return memStat;
70}
71
72void GPUMemTracker::AddAllocated(std::string const & tag, uint32_t id, uint32_t size)
73{

Callers 2

DoMethod · 0.80
TakeGPUMemorySnapshotMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected