Skip to content

Commit

Permalink
fix: fix perf timer logs being garbage
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazrius committed Nov 19, 2023
1 parent d39f8c0 commit bb8ef1d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion FLHookSDK
2 changes: 1 addition & 1 deletion include/API/Utils/PerfTimer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ class DLL PerfTimer
private:
mstime tmStart = 0;
ulong max = 0;
std::wstring_view function;
std::wstring function;
ulong warning;
};
7 changes: 4 additions & 3 deletions source/Utils/PerfTimer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "PCH.hpp"
#include "PCH.hpp"

#include "API/Utils/PerfTimer.hpp"

Expand All @@ -14,12 +14,13 @@ ulong PerfTimer::Stop()
{
if (timeDelta > max && timeDelta > warning)
{
Logger::Log(LogLevel::Info, std::format(L"Spent {} ms in {}, longest so far.", timeDelta, function));
auto str = std::format(L"Spent {} μs in {}, longest so far.", timeDelta, function);
Logger::Log(LogLevel::Info, std::format(L"Spent {} μs in {}, longest so far.", timeDelta, function));
max = timeDelta;
}
else if (timeDelta > 100)
{
Logger::Log(LogLevel::Info, std::format(L"Spent {} ms in {}", timeDelta, function));
Logger::Log(LogLevel::Info, std::format(L"Spent {} μs in {}", timeDelta, function));
}
}
return timeDelta;
Expand Down

0 comments on commit bb8ef1d

Please sign in to comment.