5353#include " wwprofile.h"
5454#include " FastAllocator.h"
5555#include " wwdebug.h"
56- #include < windows.h>
5756// #include "systimer.h"
5857#include " systimer.h"
5958#include " rawfile.h"
6059#include " ffactory.h"
6160#include " simplevec.h"
6261#include " cpudetect.h"
6362#include < cstdint>
63+ #include < thread>
6464
6565static SimpleDynVecClass<WWProfileHierachyNodeClass*> ProfileCollectVector;
6666static double TotalFrameTimes;
@@ -296,7 +296,7 @@ WWProfileHierachyNodeClass * WWProfileManager::CurrentRootNode = &WWProfileManag
296296int WWProfileManager::FrameCounter = 0 ;
297297int64_t WWProfileManager::ResetTime = 0 ;
298298
299- static unsigned int ThreadID = static_cast < unsigned int >(- 1 ) ;
299+ static std::thread::id ThreadID;
300300
301301
302302/* **********************************************************************************************
@@ -319,7 +319,7 @@ static unsigned int ThreadID = static_cast<unsigned int>(-1);
319319 *=============================================================================================*/
320320void WWProfileManager::Start_Profile ( const char * name )
321321{
322- if (:: GetCurrentThreadId () != ThreadID) {
322+ if (std::this_thread::get_id () != ThreadID) {
323323 return ;
324324 }
325325
@@ -333,7 +333,7 @@ void WWProfileManager::Start_Profile( const char * name )
333333
334334void WWProfileManager::Start_Root_Profile ( const char * name )
335335{
336- if (:: GetCurrentThreadId () != ThreadID) {
336+ if (std::this_thread::get_id () != ThreadID) {
337337 return ;
338338 }
339339
@@ -359,7 +359,7 @@ void WWProfileManager::Start_Root_Profile( const char * name )
359359 *=============================================================================================*/
360360void WWProfileManager::Stop_Profile ( void )
361361{
362- if (:: GetCurrentThreadId () != ThreadID) {
362+ if (std::this_thread::get_id () != ThreadID) {
363363 return ;
364364 }
365365
@@ -372,7 +372,7 @@ void WWProfileManager::Stop_Profile( void )
372372
373373void WWProfileManager::Stop_Root_Profile ( void )
374374{
375- if (:: GetCurrentThreadId () != ThreadID) {
375+ if (std::this_thread::get_id () != ThreadID) {
376376 return ;
377377 }
378378
@@ -400,8 +400,8 @@ void WWProfileManager::Stop_Root_Profile( void )
400400 * 9/24/2000 gth : Created. *
401401 *=============================================================================================*/
402402void WWProfileManager::Reset ( void )
403- {
404- ThreadID = :: GetCurrentThreadId ();
403+ {
404+ ThreadID = std::this_thread::get_id ();
405405
406406 Root.Reset ();
407407 FrameCounter = 0 ;
@@ -742,7 +742,7 @@ WWMemoryAndTimeLog::WWMemoryAndTimeLog(const char* name)
742742 IntermediateAllocSizeStart=AllocSizeStart;
743743 StringClass tmp (0 ,true );
744744 for (unsigned i=0 ;i<TabCount;++i) tmp+=" \t " ;
745- WWRELEASE_SAY ((" %s%s {\n " ,tmp,name));
745+ WWRELEASE_SAY ((" %s%s {\n " ,tmp. Peek_Buffer () ,name));
746746 TabCount++;
747747}
748748
@@ -751,13 +751,13 @@ WWMemoryAndTimeLog::~WWMemoryAndTimeLog()
751751 if (TabCount>0 ) TabCount--;
752752 StringClass tmp (0 ,true );
753753 for (unsigned i=0 ;i<TabCount;++i) tmp+=" \t " ;
754- WWRELEASE_SAY ((" %s} " ,tmp));
754+ WWRELEASE_SAY ((" %s} " ,tmp. Peek_Buffer () ));
755755
756756 unsigned current_time=WWProfile_Get_System_Time ();
757757 int current_alloc_count=FastAllocatorGeneral::Get_Allocator ()->Get_Total_Allocation_Count ();
758758 int current_alloc_size=FastAllocatorGeneral::Get_Allocator ()->Get_Total_Allocated_Size ();
759759 WWRELEASE_SAY ((" IN TOTAL %s took %d.%3.3d s, did %d memory allocations of %d bytes\n " ,
760- Name,
760+ Name. Peek_Buffer () ,
761761 (current_time - TimeStart)/1000 , (current_time - TimeStart)%1000 ,
762762 current_alloc_count - AllocCountStart,
763763 current_alloc_size - AllocSizeStart));
@@ -774,7 +774,7 @@ void WWMemoryAndTimeLog::Log_Intermediate(const char* text)
774774 StringClass tmp (0 ,true );
775775 for (unsigned i=0 ;i<TabCount;++i) tmp+=" \t " ;
776776 WWRELEASE_SAY ((" %s%s took %d.%3.3d s, did %d memory allocations of %d bytes\n " ,
777- tmp,
777+ tmp. Peek_Buffer () ,
778778 text,
779779 (current_time - IntermediateTimeStart)/1000 , (current_time - IntermediateTimeStart)%1000 ,
780780 current_alloc_count - IntermediateAllocCountStart,
0 commit comments