mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-22 23:04:35 +00:00
Statistics: added printing of original recording time.
This commit is contained in:
parent
1016cc682c
commit
03764c6ea0
@ -579,27 +579,28 @@ void SecondsToFriendlyStr(float seconds, std::string& out)
|
|||||||
|
|
||||||
char s[32];
|
char s[32];
|
||||||
|
|
||||||
// #.# ns
|
// #.### ns
|
||||||
if(seconds < 1e-6)
|
if(seconds < 1e-6)
|
||||||
{
|
{
|
||||||
sprintf_s(s, "%.4f ns", seconds * 1e-9);
|
sprintf_s(s, "%.3f ns", seconds * 1e-9);
|
||||||
out += s;
|
out += s;
|
||||||
}
|
}
|
||||||
// #.# us
|
// #.### us
|
||||||
else if(seconds < 1e-3)
|
else if(seconds < 1e-3)
|
||||||
{
|
{
|
||||||
sprintf_s(s, "%.4f us", seconds * 1e-6);
|
sprintf_s(s, "%.3f us", seconds * 1e-6);
|
||||||
out += s;
|
out += s;
|
||||||
}
|
}
|
||||||
// #.# ms
|
// #.### ms
|
||||||
else if(seconds < 1.f)
|
else if(seconds < 1.f)
|
||||||
{
|
{
|
||||||
sprintf_s(s, "%.4f ms", seconds * 1e-3);
|
sprintf_s(s, "%.3f ms", seconds * 1e-3);
|
||||||
out += s;
|
out += s;
|
||||||
}
|
}
|
||||||
|
// #.### s
|
||||||
else if(seconds < 60.f)
|
else if(seconds < 60.f)
|
||||||
{
|
{
|
||||||
sprintf_s(s, "%.4f s", seconds);
|
sprintf_s(s, "%.3f s", seconds);
|
||||||
out += s;
|
out += s;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -56,6 +56,7 @@ struct StrRange
|
|||||||
explicit StrRange(const std::string& s) : beg(s.data()), end(s.data() + s.length()) { }
|
explicit StrRange(const std::string& s) : beg(s.data()), end(s.data() + s.length()) { }
|
||||||
|
|
||||||
size_t length() const { return end - beg; }
|
size_t length() const { return end - beg; }
|
||||||
|
void to_str(std::string& out) { out.assign(beg, end); }
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool StrRangeEq(const StrRange& lhs, const char* rhsSz)
|
static inline bool StrRangeEq(const StrRange& lhs, const char* rhsSz)
|
||||||
@ -83,6 +84,12 @@ static inline bool StrRangeToPtr(const StrRange& s, uint64_t& out)
|
|||||||
out = (uint64_t)strtoull(s.beg, &end, 16);
|
out = (uint64_t)strtoull(s.beg, &end, 16);
|
||||||
return end == s.end;
|
return end == s.end;
|
||||||
}
|
}
|
||||||
|
static inline bool StrRangeToFloat(const StrRange& s, float& out)
|
||||||
|
{
|
||||||
|
char* end = (char*)s.end;
|
||||||
|
out = strtof(s.beg, &end);
|
||||||
|
return end == s.end;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// LineSplit class
|
// LineSplit class
|
||||||
@ -301,6 +308,8 @@ private:
|
|||||||
std::unordered_map<uint64_t, Pool> m_Pools;
|
std::unordered_map<uint64_t, Pool> m_Pools;
|
||||||
std::unordered_map<uint64_t, Allocation> m_Allocations;
|
std::unordered_map<uint64_t, Allocation> m_Allocations;
|
||||||
|
|
||||||
|
// Copy of column [1] from previously parsed line.
|
||||||
|
std::string m_LastLineTimeStr;
|
||||||
Statistics m_Stats;
|
Statistics m_Stats;
|
||||||
|
|
||||||
void Destroy(const Allocation& alloc);
|
void Destroy(const Allocation& alloc);
|
||||||
@ -356,6 +365,8 @@ void Player::ExecuteLine(size_t lineNumber, const StrRange& line)
|
|||||||
|
|
||||||
if(csvSplit.GetCount() >= FIRST_PARAM_INDEX)
|
if(csvSplit.GetCount() >= FIRST_PARAM_INDEX)
|
||||||
{
|
{
|
||||||
|
csvSplit.GetRange(1).to_str(m_LastLineTimeStr);
|
||||||
|
|
||||||
// Update VMA current frame index.
|
// Update VMA current frame index.
|
||||||
StrRange frameIndexStr = csvSplit.GetRange(2);
|
StrRange frameIndexStr = csvSplit.GetRange(2);
|
||||||
uint32_t frameIndex;
|
uint32_t frameIndex;
|
||||||
@ -729,6 +740,14 @@ void Player::PrintStats()
|
|||||||
printf(" Total allocations created: %zu\n", m_Stats.GetAllocationCreationCount());
|
printf(" Total allocations created: %zu\n", m_Stats.GetAllocationCreationCount());
|
||||||
printf(" Total buffers created: %zu\n", m_Stats.GetBufferCreationCount());
|
printf(" Total buffers created: %zu\n", m_Stats.GetBufferCreationCount());
|
||||||
printf(" Total images created: %zu\n", m_Stats.GetImageCreationCount());
|
printf(" Total images created: %zu\n", m_Stats.GetImageCreationCount());
|
||||||
|
|
||||||
|
float lastTime;
|
||||||
|
if(!m_LastLineTimeStr.empty() && StrRangeToFloat(StrRange(m_LastLineTimeStr), lastTime))
|
||||||
|
{
|
||||||
|
std::string origTimeStr;
|
||||||
|
SecondsToFriendlyStr(lastTime, origTimeStr);
|
||||||
|
printf(" Original recording time: %s\n", origTimeStr.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::ValidateFunctionParameterCount(size_t lineNumber, const CsvSplit& csvSplit, size_t expectedParamCount, bool lastUnbound)
|
bool Player::ValidateFunctionParameterCount(size_t lineNumber, const CsvSplit& csvSplit, size_t expectedParamCount, bool lastUnbound)
|
||||||
|
Loading…
Reference in New Issue
Block a user