mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +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 "TracyCallstack.hpp"
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
#ifdef TRACY_HAS_CALLSTACK
|
||||||
|
|
||||||
|
@ -775,10 +775,10 @@ void Profiler::CalibrateDelay()
|
|||||||
auto mindiff = std::numeric_limits<int64_t>::max();
|
auto mindiff = std::numeric_limits<int64_t>::max();
|
||||||
for( int i=0; i<Iterations * 10; i++ )
|
for( int i=0; i<Iterations * 10; i++ )
|
||||||
{
|
{
|
||||||
const auto t0_inner = GetTime();
|
const auto t0i = GetTime();
|
||||||
const auto t1_inner = GetTime();
|
const auto t1i = GetTime();
|
||||||
const auto dt_inner = t1_inner - t0_inner;
|
const auto dti = t1i - t0i;
|
||||||
if( dt_inner > 0 && dt_inner < mindiff ) mindiff = dt_inner;
|
if( dti > 0 && dti < mindiff ) mindiff = dti;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_resolution = mindiff;
|
m_resolution = mindiff;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#ifndef __TRACYALLOC_HPP__
|
#ifndef __TRACYALLOC_HPP__
|
||||||
#define __TRACYALLOC_HPP__
|
#define __TRACYALLOC_HPP__
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#ifdef TRACY_ENABLE
|
#ifdef TRACY_ENABLE
|
||||||
|
@ -69,6 +69,7 @@ void SetThreadName( std::thread::native_handle_type handle, const char* name )
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#elif defined _GNU_SOURCE && !defined __EMSCRIPTEN__
|
#elif defined _GNU_SOURCE && !defined __EMSCRIPTEN__
|
||||||
|
{
|
||||||
const auto sz = strlen( name );
|
const auto sz = strlen( name );
|
||||||
if( sz <= 15 )
|
if( sz <= 15 )
|
||||||
{
|
{
|
||||||
@ -81,14 +82,15 @@ void SetThreadName( std::thread::native_handle_type handle, const char* name )
|
|||||||
buf[15] = '\0';
|
buf[15] = '\0';
|
||||||
pthread_setname_np( handle, buf );
|
pthread_setname_np( handle, buf );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef TRACY_COLLECT_THREAD_NAMES
|
#ifdef TRACY_COLLECT_THREAD_NAMES
|
||||||
{
|
{
|
||||||
rpmalloc_thread_initialize();
|
rpmalloc_thread_initialize();
|
||||||
const auto sz_inner = strlen( name );
|
const auto sz = strlen( name );
|
||||||
char* buf = (char*)tracy_malloc( sz_inner+1 );
|
char* buf = (char*)tracy_malloc( sz+1 );
|
||||||
memcpy( buf, name, sz_inner );
|
memcpy( buf, name, sz );
|
||||||
buf[sz_inner+1] = '\0';
|
buf[sz+1] = '\0';
|
||||||
auto data = (ThreadNameData*)tracy_malloc( sizeof( ThreadNameData ) );
|
auto data = (ThreadNameData*)tracy_malloc( sizeof( ThreadNameData ) );
|
||||||
# ifdef _WIN32
|
# ifdef _WIN32
|
||||||
data->id = GetThreadId( static_cast<HANDLE>( handle ) );
|
data->id = GetThreadId( static_cast<HANDLE>( handle ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user