[Impeller] fixed units for memory measurement (flutter/engine#53687)
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
parent
d6cff07930
commit
2f24c4214f
@ -99,7 +99,8 @@ void DebugAllocatorStats::Decrement(size_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t DebugAllocatorStats::GetAllocationSizeMB() {
|
size_t DebugAllocatorStats::GetAllocationSizeMB() {
|
||||||
size_t new_value = size_ / 1000000;
|
// RAM is measured in MiB, thus a divisor of 2^20 instead of 1,000,000.
|
||||||
|
size_t new_value = size_ / (1024 * 1024);
|
||||||
return new_value;
|
return new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ TEST_P(AllocatorMTLTest, DebugTraceMemoryStatistics) {
|
|||||||
TextureDescriptor desc;
|
TextureDescriptor desc;
|
||||||
desc.format = PixelFormat::kR8G8B8A8UNormInt;
|
desc.format = PixelFormat::kR8G8B8A8UNormInt;
|
||||||
desc.storage_mode = StorageMode::kDeviceTransient;
|
desc.storage_mode = StorageMode::kDeviceTransient;
|
||||||
desc.size = {1000, 1000};
|
desc.size = {1024, 1024};
|
||||||
auto texture_1 = allocator->CreateTexture(desc);
|
auto texture_1 = allocator->CreateTexture(desc);
|
||||||
|
|
||||||
EXPECT_EQ(allocator->DebugGetHeapUsage(), 0u);
|
EXPECT_EQ(allocator->DebugGetHeapUsage(), 0u);
|
||||||
|
@ -519,7 +519,7 @@ size_t AllocatorVK::DebugGetHeapUsage() const {
|
|||||||
total_usage += budget.usage;
|
total_usage += budget.usage;
|
||||||
}
|
}
|
||||||
// Convert bytes to MB.
|
// Convert bytes to MB.
|
||||||
total_usage *= 1e-6;
|
total_usage /= (1024 * 1024);
|
||||||
return total_usage;
|
return total_usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user