mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Merged in therocode/tracy (pull request #5)
Fix warning re shadowing, implicit conversion and added include <cstdio>
This commit is contained in:
commit
51a68f3709
@ -1,3 +1,4 @@
|
|||||||
|
#include <stdio.h>
|
||||||
#include "TracyCallstack.hpp"
|
#include "TracyCallstack.hpp"
|
||||||
|
|
||||||
#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 = GetTime();
|
const auto t0i = GetTime();
|
||||||
const auto t1 = GetTime();
|
const auto t1i = GetTime();
|
||||||
const auto dt = t1 - t0;
|
const auto dti = t1i - t0i;
|
||||||
if( dt > 0 && dt < mindiff ) mindiff = dt;
|
if( dti > 0 && dti < mindiff ) mindiff = dti;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_resolution = mindiff;
|
m_resolution = mindiff;
|
||||||
|
@ -1713,8 +1713,8 @@ private:
|
|||||||
///////////////////////////
|
///////////////////////////
|
||||||
struct ExplicitProducer : public ProducerBase
|
struct ExplicitProducer : public ProducerBase
|
||||||
{
|
{
|
||||||
explicit ExplicitProducer(ConcurrentQueue* parent) :
|
explicit ExplicitProducer(ConcurrentQueue* _parent) :
|
||||||
ProducerBase(parent, true),
|
ProducerBase(_parent, true),
|
||||||
blockIndex(nullptr),
|
blockIndex(nullptr),
|
||||||
pr_blockIndexSlotsUsed(0),
|
pr_blockIndexSlotsUsed(0),
|
||||||
pr_blockIndexSize(EXPLICIT_INITIAL_INDEX_SIZE >> 1),
|
pr_blockIndexSize(EXPLICIT_INITIAL_INDEX_SIZE >> 1),
|
||||||
@ -1722,7 +1722,7 @@ private:
|
|||||||
pr_blockIndexEntries(nullptr),
|
pr_blockIndexEntries(nullptr),
|
||||||
pr_blockIndexRaw(nullptr)
|
pr_blockIndexRaw(nullptr)
|
||||||
{
|
{
|
||||||
size_t poolBasedIndexSize = details::ceil_to_pow_2(parent->initialBlockPoolSize) >> 1;
|
size_t poolBasedIndexSize = details::ceil_to_pow_2(_parent->initialBlockPoolSize) >> 1;
|
||||||
if (poolBasedIndexSize > pr_blockIndexSize) {
|
if (poolBasedIndexSize > pr_blockIndexSize) {
|
||||||
pr_blockIndexSize = poolBasedIndexSize;
|
pr_blockIndexSize = poolBasedIndexSize;
|
||||||
}
|
}
|
||||||
@ -2397,8 +2397,8 @@ private:
|
|||||||
|
|
||||||
struct ImplicitProducer : public ProducerBase
|
struct ImplicitProducer : public ProducerBase
|
||||||
{
|
{
|
||||||
ImplicitProducer(ConcurrentQueue* parent) :
|
ImplicitProducer(ConcurrentQueue* _parent) :
|
||||||
ProducerBase(parent, false),
|
ProducerBase(_parent, false),
|
||||||
nextBlockIndexCapacity(IMPLICIT_INITIAL_INDEX_SIZE),
|
nextBlockIndexCapacity(IMPLICIT_INITIAL_INDEX_SIZE),
|
||||||
blockIndex(nullptr)
|
blockIndex(nullptr)
|
||||||
{
|
{
|
||||||
|
@ -719,7 +719,8 @@ _memory_unmap_deferred(heap_t* heap, size_t wanted_count) {
|
|||||||
do {
|
do {
|
||||||
//Verify that we own the master span, otherwise re-defer to owner
|
//Verify that we own the master span, otherwise re-defer to owner
|
||||||
void* next = span->next_span;
|
void* next = span->next_span;
|
||||||
if (!found_span && SPAN_COUNT(span->flags) == wanted_count) {
|
size_t span_count = SPAN_COUNT(span->flags);
|
||||||
|
if (!found_span && span_count == wanted_count) {
|
||||||
assert(!SPAN_HAS_FLAG(span->flags, SPAN_FLAG_MASTER) || !SPAN_HAS_FLAG(span->flags, SPAN_FLAG_SUBSPAN));
|
assert(!SPAN_HAS_FLAG(span->flags, SPAN_FLAG_MASTER) || !SPAN_HAS_FLAG(span->flags, SPAN_FLAG_SUBSPAN));
|
||||||
found_span = span;
|
found_span = span;
|
||||||
}
|
}
|
||||||
@ -1522,9 +1523,7 @@ rpmalloc_initialize_config(const rpmalloc_config_t* config) {
|
|||||||
if (config)
|
if (config)
|
||||||
memcpy(&_memory_config, config, sizeof(rpmalloc_config_t));
|
memcpy(&_memory_config, config, sizeof(rpmalloc_config_t));
|
||||||
|
|
||||||
int default_mapper = 0;
|
|
||||||
if (!_memory_config.memory_map || !_memory_config.memory_unmap) {
|
if (!_memory_config.memory_map || !_memory_config.memory_unmap) {
|
||||||
default_mapper = 1;
|
|
||||||
_memory_config.memory_map = _memory_map_os;
|
_memory_config.memory_map = _memory_map_os;
|
||||||
_memory_config.memory_unmap = _memory_unmap_os;
|
_memory_config.memory_unmap = _memory_unmap_os;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef __TRACYALLOC_HPP__
|
#ifndef __TRACYALLOC_HPP__
|
||||||
#define __TRACYALLOC_HPP__
|
#define __TRACYALLOC_HPP__
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
#ifdef TRACY_ENABLE
|
#ifdef TRACY_ENABLE
|
||||||
# include "../client/tracy_rpmalloc.hpp"
|
# include "../client/tracy_rpmalloc.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
@ -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,6 +82,7 @@ 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
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user