mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +00:00
Use pool of buffers in TimeToString().
This commit is contained in:
parent
1fef4f9202
commit
7bc730ab73
@ -337,7 +337,12 @@ uint64_t View::GetLastTime() const
|
|||||||
|
|
||||||
const char* View::TimeToString( uint64_t ns ) const
|
const char* View::TimeToString( uint64_t ns ) const
|
||||||
{
|
{
|
||||||
static char buf[64];
|
enum { Pool = 4 };
|
||||||
|
static char bufpool[Pool][64];
|
||||||
|
static int bufsel = 0;
|
||||||
|
char* buf = bufpool[bufsel];
|
||||||
|
bufsel = ( bufsel + 1 ) % Pool;
|
||||||
|
|
||||||
if( ns < 1000 )
|
if( ns < 1000 )
|
||||||
{
|
{
|
||||||
sprintf( buf, "%i ns", ns );
|
sprintf( buf, "%i ns", ns );
|
||||||
|
Loading…
Reference in New Issue
Block a user