Skip to content

Commit

Permalink
Address feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Aug 16, 2020
1 parent c8a06d4 commit 449f80b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions Common/Vulkan/VulkanMemory.cpp
Expand Up @@ -278,7 +278,7 @@ bool VulkanDeviceAllocator::AllocateFromSlab(Slab &slab, size_t &start, size_t b

// Remember the size so we can free.
slab.allocSizes[start] = blocks;
slab.tags[start] = { tag, (float)time_now_d(), 0.0f };
slab.tags[start] = { tag, time_now_d(), 0.0 };
slab.totalUsage += blocks;
return true;
}
Expand Down Expand Up @@ -436,15 +436,15 @@ bool VulkanDeviceAllocator::AllocateSlab(VkDeviceSize minBytes, int memoryTypeIn
}

void VulkanDeviceAllocator::ReportOldUsage() {
float now = time_now_d();
static const float OLD_AGE = 10.0f;
double now = time_now_d();
static const double OLD_AGE = 10.0;
for (size_t i = 0; i < slabs_.size(); ++i) {
const auto &slab = slabs_[i];

bool hasOldAllocs = false;
for (auto it : slab.tags) {
const auto info = it.second;
float touchedAge = now - info.touched;
double touchedAge = now - info.touched;
if (touchedAge >= OLD_AGE) {
hasOldAllocs = true;
break;
Expand All @@ -456,8 +456,8 @@ void VulkanDeviceAllocator::ReportOldUsage() {
for (auto it : slab.tags) {
const auto info = it.second;

float createAge = now - info.created;
float touchedAge = now - info.touched;
double createAge = now - info.created;
double touchedAge = now - info.touched;
NOTICE_LOG(G3D, " * %s (created %fs ago, used %fs ago)", info.tag.c_str(), createAge, touchedAge);
}
}
Expand Down
4 changes: 2 additions & 2 deletions Common/Vulkan/VulkanMemory.h
Expand Up @@ -176,8 +176,8 @@ class VulkanDeviceAllocator {

struct UsageInfo {
std::string tag;
float created;
float touched;
double created;
double touched;
};

struct Slab {
Expand Down

0 comments on commit 449f80b

Please sign in to comment.