mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Update platformMemory.cpp
add date and time to output logfile
This commit is contained in:
parent
15ff382469
commit
1050cad372
1 changed files with 6 additions and 1 deletions
|
|
@ -37,6 +37,7 @@
|
||||||
#else
|
#else
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
// If profile paths are enabled, disable profiling of the
|
// If profile paths are enabled, disable profiling of the
|
||||||
// memory manager as that would cause a cyclic dependency
|
// memory manager as that would cause a cyclic dependency
|
||||||
|
|
@ -73,7 +74,7 @@ namespace Memory
|
||||||
static U32 allocCount = 0;
|
static U32 allocCount = 0;
|
||||||
static U32 currentAllocId = 0;
|
static U32 currentAllocId = 0;
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
char gLogFilename[256] = "memlog.txt";
|
char gLogFilename[256] = { 0 };
|
||||||
bool gStackTrace = false;
|
bool gStackTrace = false;
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
|
|
@ -84,6 +85,10 @@ namespace Memory
|
||||||
currentAllocId = 0;
|
currentAllocId = 0;
|
||||||
initialized = true;
|
initialized = true;
|
||||||
|
|
||||||
|
// Generate timestamped log filename
|
||||||
|
std::time_t now = std::time(nullptr);
|
||||||
|
std::tm* localTime = std::localtime(&now);
|
||||||
|
std::strftime(gLogFilename, sizeof(gLogFilename), "memlog_%Y-%m-%d_%H-%M-%S.txt", localTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void shutdown()
|
void shutdown()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue