mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +00:00
Conversion of nanoseconds to string.
This commit is contained in:
parent
05c8c1fa40
commit
9a38302d4a
@ -325,6 +325,28 @@ uint64_t View::GetLastTime() const
|
|||||||
return last;
|
return last;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* View::TimeToString( uint64_t ns ) const
|
||||||
|
{
|
||||||
|
static char buf[64];
|
||||||
|
if( ns < 1000 )
|
||||||
|
{
|
||||||
|
sprintf( buf, "%i ns", ns );
|
||||||
|
}
|
||||||
|
else if( ns < 1000 * 1000 )
|
||||||
|
{
|
||||||
|
sprintf( buf, "%.2f us", ns / 1024.f );
|
||||||
|
}
|
||||||
|
else if( ns < 1000 * 1000 * 1000 )
|
||||||
|
{
|
||||||
|
sprintf( buf, "%.2f ms", ns / ( 1024.f * 1024 ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf( buf, "%.2f s", ns / ( 1024.f * 1024 * 1024 ) );
|
||||||
|
}
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
void View::Draw()
|
void View::Draw()
|
||||||
{
|
{
|
||||||
s_instance->DrawImpl();
|
s_instance->DrawImpl();
|
||||||
|
@ -50,6 +50,7 @@ private:
|
|||||||
|
|
||||||
uint64_t GetFrameTime( size_t idx ) const;
|
uint64_t GetFrameTime( size_t idx ) const;
|
||||||
uint64_t GetLastTime() const;
|
uint64_t GetLastTime() const;
|
||||||
|
const char* TimeToString( uint64_t ns ) const;
|
||||||
|
|
||||||
void DrawImpl();
|
void DrawImpl();
|
||||||
void DrawFrames();
|
void DrawFrames();
|
||||||
|
Loading…
Reference in New Issue
Block a user