Improve fixes for warnings as per request

This commit is contained in:
Tobias Widlund 2018-06-30 15:36:06 +02:00
parent 1c467a5847
commit b6cce4ddb6
4 changed files with 22 additions and 19 deletions

View File

@ -1,5 +1,5 @@
#include "stdio.h"
#include "TracyCallstack.hpp"
#include <cstdio>
#ifdef TRACY_HAS_CALLSTACK

View File

@ -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;

View File

@ -1,5 +1,6 @@
#ifndef __TRACYALLOC_HPP__
#define __TRACYALLOC_HPP__
#include <cstdlib>
#ifdef TRACY_ENABLE

View File

@ -69,6 +69,7 @@ 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 )
{
@ -81,14 +82,15 @@ void SetThreadName( std::thread::native_handle_type handle, const char* name )
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 ) );