mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Improve fixes for warnings as per request
This commit is contained in:
parent
1c467a5847
commit
b6cce4ddb6
@ -1,5 +1,5 @@
|
||||
#include "stdio.h"
|
||||
#include "TracyCallstack.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
|
||||
|
@ -775,10 +775,10 @@ void Profiler::CalibrateDelay()
|
||||
auto mindiff = std::numeric_limits<int64_t>::max();
|
||||
for( int i=0; i<Iterations * 10; i++ )
|
||||
{
|
||||
const auto t0_inner = GetTime();
|
||||
const auto t1_inner = GetTime();
|
||||
const auto dt_inner = t1_inner - t0_inner;
|
||||
if( dt_inner > 0 && dt_inner < mindiff ) mindiff = dt_inner;
|
||||
const auto t0i = GetTime();
|
||||
const auto t1i = GetTime();
|
||||
const auto dti = t1i - t0i;
|
||||
if( dti > 0 && dti < mindiff ) mindiff = dti;
|
||||
}
|
||||
|
||||
m_resolution = mindiff;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef __TRACYALLOC_HPP__
|
||||
#define __TRACYALLOC_HPP__
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#ifdef TRACY_ENABLE
|
||||
|
@ -69,26 +69,28 @@ void SetThreadName( std::thread::native_handle_type handle, const char* name )
|
||||
}
|
||||
# endif
|
||||
#elif defined _GNU_SOURCE && !defined __EMSCRIPTEN__
|
||||
const auto sz = strlen( name );
|
||||
if( sz <= 15 )
|
||||
{
|
||||
pthread_setname_np( handle, name );
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[16];
|
||||
memcpy( buf, name, 15 );
|
||||
buf[15] = '\0';
|
||||
pthread_setname_np( handle, buf );
|
||||
const auto sz = strlen( name );
|
||||
if( sz <= 15 )
|
||||
{
|
||||
pthread_setname_np( handle, name );
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[16];
|
||||
memcpy( buf, name, 15 );
|
||||
buf[15] = '\0';
|
||||
pthread_setname_np( handle, buf );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef TRACY_COLLECT_THREAD_NAMES
|
||||
{
|
||||
rpmalloc_thread_initialize();
|
||||
const auto sz_inner = strlen( name );
|
||||
char* buf = (char*)tracy_malloc( sz_inner+1 );
|
||||
memcpy( buf, name, sz_inner );
|
||||
buf[sz_inner+1] = '\0';
|
||||
const auto sz = strlen( name );
|
||||
char* buf = (char*)tracy_malloc( sz+1 );
|
||||
memcpy( buf, name, sz );
|
||||
buf[sz+1] = '\0';
|
||||
auto data = (ThreadNameData*)tracy_malloc( sizeof( ThreadNameData ) );
|
||||
# ifdef _WIN32
|
||||
data->id = GetThreadId( static_cast<HANDLE>( handle ) );
|
||||
|
Loading…
Reference in New Issue
Block a user