RealToString() is always called with separator set to true.

This commit is contained in:
Bartosz Taudul 2020-01-31 01:43:24 +01:00
parent 3050f19e0b
commit f017b27ae2
4 changed files with 173 additions and 176 deletions

View File

@ -148,7 +148,7 @@ int main( int argc, char** argv )
} }
printf( "\nFrames: %" PRIu64 "\nTime span: %s\nZones: %s\nElapsed time: %s\nSaving trace...", printf( "\nFrames: %" PRIu64 "\nTime span: %s\nZones: %s\nElapsed time: %s\nSaving trace...",
worker.GetFrameCount( *worker.GetFramesBase() ), tracy::TimeToString( worker.GetLastTime() ), tracy::RealToString( worker.GetZoneCount(), true ), worker.GetFrameCount( *worker.GetFramesBase() ), tracy::TimeToString( worker.GetLastTime() ), tracy::RealToString( worker.GetZoneCount() ),
tracy::TimeToString( std::chrono::duration_cast<std::chrono::nanoseconds>( t1 - t0 ).count() ) ); tracy::TimeToString( std::chrono::duration_cast<std::chrono::nanoseconds>( t1 - t0 ).count() ) );
fflush( stdout ); fflush( stdout );
auto f = std::unique_ptr<tracy::FileWrite>( tracy::FileWrite::Open( output ) ); auto f = std::unique_ptr<tracy::FileWrite>( tracy::FileWrite::Open( output ) );

View File

@ -214,7 +214,7 @@ const char* TimeToString( int64_t _ns )
return bufstart; return bufstart;
} }
const char* RealToString( double val, bool separator ) const char* RealToString( double val )
{ {
enum { Pool = 8 }; enum { Pool = 8 };
static char bufpool[Pool][64]; static char bufpool[Pool][64];
@ -228,20 +228,17 @@ const char* RealToString( double val, bool separator )
const auto vbegin = ptr; const auto vbegin = ptr;
if( separator ) while( *ptr != '\0' && *ptr != ',' && *ptr != '.' ) ptr++;
{ auto end = ptr;
while( *ptr != '\0' && *ptr != ',' && *ptr != '.' ) ptr++; while( *end != '\0' ) end++;
auto end = ptr; auto sz = end - ptr;
while( *end != '\0' ) end++;
auto sz = end - ptr;
while( ptr - vbegin > 3 ) while( ptr - vbegin > 3 )
{ {
ptr -= 3; ptr -= 3;
memmove( ptr+1, ptr, sz ); memmove( ptr+1, ptr, sz );
*ptr = ','; *ptr = ',';
sz += 4; sz += 4;
}
} }
while( *ptr != '\0' && *ptr != ',' && *ptr != '.' ) ptr++; while( *ptr != '\0' && *ptr != ',' && *ptr != '.' ) ptr++;

View File

@ -21,7 +21,7 @@ static inline char* PrintFloat( char* begin, char* end, T value, int precision )
} }
const char* TimeToString( int64_t ns ); const char* TimeToString( int64_t ns );
const char* RealToString( double val, bool separator ); const char* RealToString( double val );
const char* MemSizeToString( int64_t val ); const char* MemSizeToString( int64_t val );
} }

File diff suppressed because it is too large Load Diff