mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Add LocationToString() helper.
This commit is contained in:
parent
c69cf5bd3f
commit
91f1845d92
@ -411,6 +411,20 @@ const char* MemSizeToString( int64_t val )
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* LocationToString( const char* fn, uint32_t line )
|
||||||
|
{
|
||||||
|
if( line == 0 ) return fn;
|
||||||
|
|
||||||
|
enum { Pool = 8 };
|
||||||
|
static char bufpool[Pool][4096];
|
||||||
|
static int bufsel = 0;
|
||||||
|
char* buf = bufpool[bufsel];
|
||||||
|
bufsel = ( bufsel + 1 ) % Pool;
|
||||||
|
|
||||||
|
sprintf( buf, "%s:%i", fn, line );
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -126,6 +126,7 @@ static inline const char* RealToString( double val )
|
|||||||
const char* TimeToString( int64_t ns );
|
const char* TimeToString( int64_t ns );
|
||||||
const char* TimeToStringExact( int64_t ns );
|
const char* TimeToStringExact( int64_t ns );
|
||||||
const char* MemSizeToString( int64_t val );
|
const char* MemSizeToString( int64_t val );
|
||||||
|
const char* LocationToString( const char* fn, uint32_t line );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user