before_code
stringlengths
14
465k
reviewer_comment
stringlengths
16
64.5k
after_code
stringlengths
9
467k
diff_context
stringlengths
0
97k
file_path
stringlengths
5
226
comment_line
int32
0
26
language
stringclasses
37 values
quality_score
float32
0.07
1
comment_type
stringclasses
9 values
comment_length
int32
16
64.5k
before_lines
int32
1
17.2k
after_lines
int32
1
12.1k
is_negative
bool
2 classes
pr_title
stringlengths
1
308
pr_number
int32
1
299k
repo_name
stringclasses
533 values
repo_stars
int64
321
419k
repo_language
stringclasses
27 values
reviewer_username
stringlengths
0
39
author_username
stringlengths
2
39
TracyCLZoneSetEvent(writeBufferAEvent); } { ZoneScopedN("Write Buffer B"); TracyCLZone(tracyCLCtx, "Write BufferB"); CL_ASSERT(clEnqueueWriteBuffer(commandQueue, bufferB, CL_FALSE, 0, N * sizeof(float), hostB.data(), 0, nullptr, &writeBufferBEvent)); ...
Since you're changing the events here to be asynchronous I will suggest you to add code to wait for all the events at once and keep the code that perform the query of how much time each launch took. Maybe display some basic stats like average, min, max since you're changing it to 100 kernel launches. I think it is a go...
CL_ASSERT(clEnqueueWriteBuffer(commandQueue, bufferB, CL_FALSE, 0, N * sizeof(float), hostB.data(), 0, nullptr, &writeBufferBEvent)); TracyCLZoneSetEvent(writeBufferBEvent); } } cl_int clN = static_cast<cl_int>(N); const int numFrames = 10; const int launchsPerFrame = ...
@@ -149,15 +155,8 @@ int main() cl_event vectorAddKernelEvent; CL_ASSERT(clEnqueueNDRangeKernel(commandQueue, vectorAddKernel, 1, nullptr, &N, nullptr, 0, nullptr, &vectorAddKernelEvent)); - - CL_ASSERT(clWaitForEvents(1, &vectorAddKernelEvent)); - TracyCLZoneSetEvent(vectorAddKernel...
examples/OpenCLVectorAdd/OpenCLVectorAdd.cpp
26
C++
0.429
suggestion
424
51
51
false
Update OpenCL
313
wolfpld/tracy
14,429
C++
mcleary
cloudhan
void Collect() { ZoneScopedC(Color::Red4); if (m_tail == m_head) return; #ifdef TRACY_ON_DEMAND if (!GetProfiler().IsConnected()) { m_head = m_tail = 0; } #endif for (; m_tail != m_head; m_tail = (m_tail + 1) % Q...
Its it really worth it to emit two error messages? I'd say that a single message should be emitted for event in case something went wrong. Also I think that if you want to emit a TraceMessage you don't need the assert in the line below
void Collect() { ZoneScopedC(Color::Red4); if (m_tail == m_head) return; #ifdef TRACY_ON_DEMAND if (!GetProfiler().IsConnected()) { m_head = m_tail = 0; } #endif for (; m_tail != m_head; m_tail = (m_tail + 1) % Q...
@@ -139,23 +148,33 @@ namespace tracy { } #endif - while (m_tail != m_head) + for (; m_tail != m_head; m_tail = (m_tail + 1) % QueryCount) { - EventInfo eventInfo = m_query[m_tail]; - cl_event event = eventInfo.event; + Even...
TracyOpenCL.hpp
26
C++
0.643
bug
239
51
51
false
Update OpenCL
313
wolfpld/tracy
14,429
C++
mcleary
cloudhan
MemWrite( &item->hdr.type, QueueType::GpuContextName ); MemWrite( &item->gpuContextNameFat.context, (uint8_t)m_contextId ); MemWrite( &item->gpuContextNameFat.ptr, (uint64_t)ptr ); MemWrite( &item->gpuContextNameFat.size, len ); #ifdef TRACY_ON_DEMAND GetProfi...
I'm not sure it is worth going through the `GetQuery` function here. We are inside the `OpenCLCtx` and this loop is supposed to be very efficient in its good path. The range defined by `m_head` and `m_tail` is guaranteed to be valid when this is being executed.
MemWrite( &item->hdr.type, QueueType::GpuContextName ); MemWrite( &item->gpuContextNameFat.context, (uint8_t)m_contextId ); MemWrite( &item->gpuContextNameFat.ptr, (uint64_t)ptr ); MemWrite( &item->gpuContextNameFat.size, len ); #ifdef TRACY_ON_DEMAND GetProfi...
@@ -139,23 +148,33 @@ namespace tracy { } #endif - while (m_tail != m_head) + for (; m_tail != m_head; m_tail = (m_tail + 1) % QueryCount) { - EventInfo eventInfo = m_query[m_tail]; - cl_event event = eventInfo.event; + Even...
TracyOpenCL.hpp
26
C++
0.571
performance
261
51
51
false
Update OpenCL
313
wolfpld/tracy
14,429
C++
mcleary
cloudhan
} using TracyCLCtx = void*; #else #include <CL/cl.h> #include <atomic> #include <cassert> #include <sstream> #include "Tracy.hpp" #include "client/TracyCallstack.hpp" #include "client/TracyProfiler.hpp" #include "common/TracyAlloc.hpp" #define TRACY_CL_TO_STRING_INDIRECT(T) #T #define TRACY_CL_TO_STRING(T) TRACY_...
I thought that the whole goal of using streams would be to avoid creating strings in a convoluted way like this. Why not simply ```c++ oss << "TRACY_CL_CHECK_ERROR failed on " << __FILE__ << ":" << __LINE__ << ": error code" << err ``` you shouldn't need to use a stringify macro when using streams.
} using TracyCLCtx = void*; #else #include <CL/cl.h> #include <atomic> #include <cassert> #include <sstream> #include "Tracy.hpp" #include "client/TracyCallstack.hpp" #include "client/TracyProfiler.hpp" #include "common/TracyAlloc.hpp" #define TRACY_CL_TO_STRING_INDIRECT(T) #T #define TRACY_CL_TO_STRING(T) TRACY_...
@@ -35,12 +35,28 @@ using TracyCLCtx = void*; #include <atomic> #include <cassert> +#include <sstream> #include "Tracy.hpp" #include "client/TracyCallstack.hpp" #include "client/TracyProfiler.hpp" #include "common/TracyAlloc.hpp" +#define TRACY_CL_TO_STRING_INDIRECT(T) #T +#define TRACY_CL_TO_STRING(T) TRAC...
TracyOpenCL.hpp
26
C++
1
bug
306
51
51
false
Update OpenCL
313
wolfpld/tracy
14,429
C++
mcleary
cloudhan
#define TracyCLZoneSetEvent(e) #define TracyCLCollect(c) namespace tracy { class OpenCLCtxScope {}; } using TracyCLCtx = void*; #else #include <CL/cl.h> #include <atomic> #include <cassert> #include <sstream> #include "Tracy.hpp" #include "client/TracyCallstack.hpp" #include "client/TracyProfiler.hpp" #inclu...
why do you need this indirection?
#define TracyCLZoneSetEvent(e) #define TracyCLCollect(c) namespace tracy { class OpenCLCtxScope {}; } using TracyCLCtx = void*; #else #include <CL/cl.h> #include <atomic> #include <cassert> #include <sstream> #include "Tracy.hpp" #include "client/TracyCallstack.hpp" #include "client/TracyProfiler.hpp" #inclu...
@@ -35,12 +35,28 @@ using TracyCLCtx = void*; #include <atomic> #include <cassert> +#include <sstream> #include "Tracy.hpp" #include "client/TracyCallstack.hpp" #include "client/TracyProfiler.hpp" #include "common/TracyAlloc.hpp" +#define TRACY_CL_TO_STRING_INDIRECT(T) #T +#define TRACY_CL_TO_STRING(T) TRAC...
TracyOpenCL.hpp
26
C++
0.071
question
33
51
51
false
Update OpenCL
313
wolfpld/tracy
14,429
C++
mcleary
cloudhan
CL_ASSERT(err); bufferB = clCreateBuffer(context, CL_MEM_READ_WRITE, N * sizeof(float), nullptr, &err); CL_ASSERT(err); bufferC = clCreateBuffer(context, CL_MEM_READ_WRITE, N * sizeof(float), nullptr, &err); CL_ASSERT(err); cl_event writeBufferAEvent, writeBufferBEvent; ...
Can I suggest that you keep the variables names consistent with the rest of the example, i.e. camelCase?
CL_ASSERT(err); bufferB = clCreateBuffer(context, CL_MEM_READ_WRITE, N * sizeof(float), nullptr, &err); CL_ASSERT(err); bufferC = clCreateBuffer(context, CL_MEM_READ_WRITE, N * sizeof(float), nullptr, &err); CL_ASSERT(err); cl_event writeBufferAEvent, writeBufferBEvent; ...
@@ -123,21 +124,24 @@ int main() ZoneScopedN("Write Buffer A"); TracyCLZoneS(tracyCLCtx, "Write BufferA", 5); - CL_ASSERT(clEnqueueWriteBuffer(commandQueue, bufferA, CL_TRUE, 0, N * sizeof(float), hostA.data(), 0, nullptr, &writeBufferAEvent)); + CL_ASSERT(clEnqueueWrit...
examples/OpenCLVectorAdd/OpenCLVectorAdd.cpp
26
C++
0.357
question
104
51
51
false
Update OpenCL
313
wolfpld/tracy
14,429
C++
mcleary
cloudhan
#ifndef __TRACYOPENCL_HPP__ #define __TRACYOPENCL_HPP__ #if !defined TRACY_ENABLE #define TracyCLContext(c, x) nullptr #define TracyCLDestroy(c) #define TracyCLContextName(c, x, y) #define TracyCLNamedZone(c, x, y, z) #define TracyCLNamedZoneC(c, x, y, z, w) #define TracyCLZone(c, x) #define TracyCLZoneC(c, x, y) #...
Unfortunately I don't think this should be provided as an option. It should be the user's responsibility to ensure that all events are finished before a call to `TracyCLCollect`. I understand your reasoning but the profiler should not block. If the user launches an async operation it shouldn't be the profiler respon...
#ifndef __TRACYOPENCL_HPP__ #define __TRACYOPENCL_HPP__ #if !defined TRACY_ENABLE #define TracyCLContext(c, x) nullptr #define TracyCLDestroy(c) #define TracyCLContextName(c, x, y) #define TracyCLNamedZone(c, x, y, z) #define TracyCLNamedZoneC(c, x, y, z, w) #define TracyCLZone(c, x) #define TracyCLZoneC(c, x, y) #...
@@ -21,6 +21,7 @@ #define TracyCLZoneSetEvent(e) #define TracyCLCollect(c) +#define TracyCLBlockingCollect(c)
TracyOpenCL.hpp
24
C++
0.643
suggestion
344
49
49
false
Update OpenCL
313
wolfpld/tracy
14,429
C++
mcleary
cloudhan
{ ptr += 2; ret = strtol( ptr, &end, 16 ); } else { ret = strtol( ptr, &end, 10 ); } ptr = end; return ret; } #endif static const char* GetHostInfo() { static char buf[1024]; auto ptr = buf; #if defined _WIN32 # ifdef TRACY_UWP auto GetVersion = &::GetVe...
Is this (and following) indent change needed?
{ ptr += 2; ret = strtol( ptr, &end, 16 ); } else { ret = strtol( ptr, &end, 10 ); } ptr = end; return ret; } #endif static const char* GetHostInfo() { static char buf[1024]; auto ptr = buf; #if defined _WIN32 # ifdef TRACY_UWP auto GetVersion = &::GetVe...
@@ -440,25 +443,29 @@ static const char* GetHostInfo() static char buf[1024]; auto ptr = buf; #if defined _WIN32 - t_RtlGetVersion RtlGetVersion = (t_RtlGetVersion)GetProcAddress( GetModuleHandleA( "ntdll.dll" ), "RtlGetVersion" ); - if( !RtlGetVersion ) +# ifdef TRACY_UWP + auto GetVersion = &::Ge...
client/TracyProfiler.cpp
26
C++
0.143
question
45
51
51
false
Make Tracy usable in UWP applications
324
wolfpld/tracy
14,429
C++
wolfpld
Kova93
memset( &sigint, 0, sizeof( sigint ) ); sigint.sa_handler = SigInt; sigaction( SIGINT, &sigint, &oldsigint ); #endif auto& lock = worker.GetMbpsDataLock(); const auto t0 = std::chrono::high_resolution_clock::now(); while( worker.IsConnected() ) { if( disconnect ) { ...
Please add a newline before `{`.
seconds = atoi (optarg); break; default: Usage(); break; } } if( !address || !output ) Usage(); struct stat st; if( stat( output, &st ) == 0 && !overwrite ) { printf( "Output file %s already exists! Use -f to force overwrite.\...
@@ -150,21 +153,25 @@ int main( int argc, char** argv ) const auto netTotal = worker.GetDataTransferred(); lock.unlock(); - if( mbps < 0.1f ) - { - printf( "\33[2K\r\033[36;1m%7.2f Kbps", mbps * 1000.f ); - } - else - { - printf( "\33[2K\r\033...
capture/src/capture.cpp
26
C++
0.214
style
32
51
51
false
make progress info and ANSI escapes conditional on being a TTY
362
wolfpld/tracy
14,429
C++
wolfpld
bjacob
tracy::MemSizeToString( netTotal ), tracy::MemSizeToString( tracy::memUsage ), tracy::TimeToString( worker.GetLastTime() ) ); fflush( stdout ); } std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) ); if( seconds != -1 ) ...
Please move this code earlier (e.g. next to the `isTTY` initialization). Then please use these variables in the `if (isTTY) {` block, to improve readability. Maybe an alternate way of encoding colors would be better here? Something like: ```c++ #define AnsiRed "\033[31m" ... const char *ansiRed = isTTY ? AnsiRed ...
if( handshake == tracy::HandshakeNotAvailable ) { printf( "\nThe client you are trying to connect to is no longer able to sent profiling data,\nbecause another server was already connected to it.\nYou can do the following:\n\n 1. Restart the client application.\n 2. Rebuild the client appl...
@@ -178,18 +185,27 @@ int main( int argc, char** argv ) } const auto t1 = std::chrono::high_resolution_clock::now(); + const char *ansiReset = isTTY ? "\033[0m" : ""; + const char *ansiBold = isTTY ? "\033[1m" : ""; + const char *ansiBlack = isTTY ? "\033[30m" : ""; + const char *ansiRed = isTTY...
capture/src/capture.cpp
26
C++
1
refactor
538
51
51
false
make progress info and ANSI escapes conditional on being a TTY
362
wolfpld/tracy
14,429
C++
wolfpld
bjacob
#define ANSI_MAGENTA "\033[35m" #define ANSI_CYAN "\033[36m" #define ANSI_ERASE_LINE "\033[2K" // Like printf, but if stdout is a terminal, prepends the output with // the given `ansiEscape` and appends ANSI_RESET. void AnsiPrintf( const char* ansiEscape, const char* format, ... ) { if( IsStdoutATerminal() ) { ...
Please also use 4 spaces for indentation.
#define ANSI_MAGENTA "\033[35m" #define ANSI_CYAN "\033[36m" #define ANSI_ERASE_LINE "\033[2K" // Like printf, but if stdout is a terminal, prepends the output with // the given `ansiEscape` and appends ANSI_RESET. void AnsiPrintf( const char* ansiEscape, const char* format, ... ) { if( IsStdoutATerminal() ) {...
@@ -41,6 +43,51 @@ void SigInt( int ) s_disconnect.store(true, std::memory_order_relaxed); } +static bool s_isStdoutATerminal = false; + +void InitIsStdoutATerminal() { +#ifdef _WIN32 + s_isStdoutATerminal = _isatty( fileno( stdout ) ); +#else + s_isStdoutATerminal = isatty( fileno( stdout ) ); +#endif +}...
capture/src/capture.cpp
26
C++
0.143
style
41
51
51
false
make progress info and ANSI escapes conditional on being a TTY
362
wolfpld/tracy
14,429
C++
wolfpld
bjacob
#else // To add support for a platform, retrieve and return the kernel thread identifier here. // // Note that pthread_t (as for example returned by pthread_self()) is *not* a kernel // thread identifier. It is a pointer to a library-allocated data structure instead. // Such pointers will be reused ...
Do not change the coding style.
#else // To add support for a platform, retrieve and return the kernel thread identifier here. // // Note that pthread_t (as for example returned by pthread_self()) is *not* a kernel // thread identifier. It is a pointer to a library-allocated data structure instead. // Such pointers will be reused ...
@@ -106,7 +106,7 @@ std::atomic<ThreadNameData*>& GetThreadNameData(); #endif #ifdef _MSC_VER -# pragma pack( push, 8 )
public/common/TracySystem.cpp
26
C++
0.143
style
31
51
51
false
Using push/pop in all pragma pack pair to avoid potential padding bugs
440
wolfpld/tracy
14,429
C++
wolfpld
Danielmelody
# if defined _WIN32 # ifdef TRACY_UWP static auto _GetThreadDescription = &::GetThreadDescription; # else static auto _GetThreadDescription = (t_GetThreadDescription)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetThreadDescription" ); # endif if( _GetThreadDescription ) { auto...
I wonder if this was ever working before.
#if defined _WIN32 # ifdef TRACY_UWP static auto _GetThreadDescription = &::GetThreadDescription; # else static auto _GetThreadDescription = (t_GetThreadDescription)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetThreadDescription" ); # endif if( _GetThreadDescription ) { auto hnd = OpenThread(...
@@ -205,61 +205,57 @@ TRACY_API const char* GetThreadName( uint32_t id ) } ptr = ptr->next; } -#else -# if defined _WIN32 -# ifdef TRACY_UWP - static auto _GetThreadDescription = &::GetThreadDescription; -# else - static auto _GetThreadDescription = (t_GetThreadDescription)GetProcAdd...
public/common/TracySystem.cpp
26
C++
0.071
suggestion
41
51
51
false
Always fallback to using native thread name...
499
wolfpld/tracy
14,429
C++
wolfpld
ReplayCoding
2 + // branch retired + miss 2 + // context switches + wakeups 1 // vsync ); s_ring = (RingBuffer*)tracy_malloc( sizeof( RingBuffer ) * maxNumBuffers ); s_numBuffers = 0; // software sampling perf_event_attr pe = {}; pe.type = PERF_TYPE_SOFTWARE; pe.siz...
No space between `if` and `(`.
2 + // branch retired + miss 2 + // context switches + wakeups 1 // vsync ); s_ring = (RingBuffer*)tracy_malloc( sizeof( RingBuffer ) * maxNumBuffers ); s_numBuffers = 0; // software sampling perf_event_attr pe = {}; pe.type = PERF_TYPE_SOFTWARE; pe.siz...
@@ -839,28 +846,31 @@ bool SysTraceStart( int64_t& samplingPeriod ) pe.clockid = CLOCK_MONOTONIC_RAW; #endif - TracyDebug( "Setup software sampling\n" ); - ProbePreciseIp( pe, currentPid ); - for( int i=0; i<s_numCpus; i++ ) + if ( !noSoftwareSampling )
public/client/TracySysTrace.cpp
26
C++
0.214
suggestion
30
51
51
false
linux: respect `TRACY_NO_SAMPLING` for sys-tracing
545
wolfpld/tracy
14,429
C++
wolfpld
topolarity
#include <fstream> #include <iostream> #include <sstream> #include <string> #include <math.h> #include <stdio.h> #include <stdint.h> #include "../../server/TracyFileRead.hpp" #include "../../server/TracyWorker.hpp" #include "../../getopt/getopt.h" void print_usage_exit(int e) { fprintf(stderr, "Extract statistic...
This does not correspond with what the program expects.
#include <fstream> #include <iostream> #include <sstream> #include <string> #include <math.h> #include <stdio.h> #include <stdint.h> #include "../../server/TracyFileRead.hpp" #include "../../server/TracyWorker.hpp" #include "../../getopt/getopt.h" void print_usage_exit(int e) { fprintf(stderr, "Extract statistic...
@@ -23,12 +23,13 @@ void print_usage_exit(int e) fprintf(stderr, "Usage:\n"); fprintf(stderr, " extract [OPTION...] <trace file>\n"); fprintf(stderr, "\n"); - fprintf(stderr, " -h, --help Print usage\n"); - fprintf(stderr, " -f, --filter arg Filter zone names (default: "")\n"); - fpri...
csvexport/src/csvexport.cpp
26
C++
0.214
suggestion
55
51
51
false
Added an option to print out "messages" while exporting a .trace file to CSV using "csvexport" utility
555
wolfpld/tracy
14,429
C++
wolfpld
nehasharan
if (msgs.size() > 0) { std::vector<const char*> columnsForMessages; columnsForMessages = { "MessageName", "total_ns" }; std::string headerForMessages = join(columnsForMessages, args.separator); printf("%s\n", headerForMe...
Align return with indentation.
if (msgs.size() > 0) { std::vector<const char*> columnsForMessages; columnsForMessages = { "MessageName", "total_ns" }; std::string headerForMessages = join(columnsForMessages, args.separator); printf("%s\n", headerForMe...
@@ -198,6 +204,38 @@ int main(int argc, char** argv) auto worker = tracy::Worker(*f); + if (args.unwrapMessages) + { + const auto& msgs = worker.GetMessages(); + + if (msgs.size() > 0) + { + std::vector<const char*> columnsForMessages; + columnsForMessages ...
csvexport/src/csvexport.cpp
26
C++
0.071
style
30
51
51
false
Added an option to print out "messages" while exporting a .trace file to CSV using "csvexport" utility
555
wolfpld/tracy
14,429
C++
wolfpld
nehasharan
ImGui::Separator(); SmallCheckbox( "Show zone time in frames", &m_findZone.showZoneInFrames ); ImGui::Separator(); ImGui::AlignTextToFramePadding(); TextDisabledUnformatted( "Filter user text:" ); ImGui::SameLine(); bool filterChanged = m_userTextFilter.Draw( ICO...
I'm not sure if this is the correct way to "dirty" the grouped zone list to cause it to redraw when the filter has changed, but this seems to work at least.
} } ImGui::TreePop(); } ImGui::Separator(); SmallCheckbox( "Show zone time in frames", &m_findZone.showZoneInFrames ); ImGui::Separator(); ImGui::AlignTextToFramePadding(); TextDisabledUnformatted( "Filter user text:" ); ...
@@ -1362,6 +1362,23 @@ void View::DrawFindZone() SmallCheckbox( "Show zone time in frames", &m_findZone.showZoneInFrames ); ImGui::Separator(); + ImGui::AlignTextToFramePadding(); + TextDisabledUnformatted( "Filter user text:" ); + ImGui::SameLine(); + bool filterChanged ...
server/TracyView_FindZone.cpp
26
C++
0.429
suggestion
157
51
51
false
allow filtering zones in Zone finder based on the user text
557
wolfpld/tracy
14,429
C++
KristofferC
KristofferC
{ zonePos = round( ( zoneTime - tmin ) / float( tmax - tmin ) * numBins ); } const auto c = uint32_t( ( sin( s_time * 10 ) * 0.25 + 0.75 ) * 255 ); const auto color = 0xFF00000...
This button ID clashes with one that is already present. Can be fixed by appending e.g. `##userText` after the button text.
{ const auto ltmin = log10( tmin ); const auto ltmax = log10( tmax ); zonePos = round( ( log10( zoneTime ) - ltmin ) / float( ltmax - ltmin ) * numBins ); } ...
@@ -1362,6 +1362,23 @@ void View::DrawFindZone() SmallCheckbox( "Show zone time in frames", &m_findZone.showZoneInFrames ); ImGui::Separator(); + ImGui::AlignTextToFramePadding(); + TextDisabledUnformatted( "Filter user text:" ); + ImGui::SameLine(); + bool filterChanged ...
server/TracyView_FindZone.cpp
26
C++
0.571
suggestion
123
51
51
false
allow filtering zones in Zone finder based on the user text
557
wolfpld/tracy
14,429
C++
wolfpld
KristofferC
static tracy_force_inline int64_t GetTime() { #ifdef TRACY_HW_TIMER # if defined TARGET_OS_IOS && TARGET_OS_IOS == 1 if( HardwareSupportsInvariantTSC() ) return mach_absolute_time(); # elif defined _WIN32 # ifdef TRACY_TIMER_QPC return GetTimeQpc(); # else if( HardwareSupportsIn...
Currently you need to opt-out. The condition should be reversed.
static tracy_force_inline int64_t GetTime() { #ifdef TRACY_HW_TIMER # if defined TARGET_OS_IOS && TARGET_OS_IOS == 1 if( HardwareSupportsInvariantTSC() ) return mach_absolute_time(); # elif defined _WIN32 # ifdef TRACY_TIMER_QPC return GetTimeQpc(); # else if( HardwareSupportsIn...
@@ -209,7 +209,22 @@ class Profiler if( HardwareSupportsInvariantTSC() ) { uint64_t rax, rdx; +#ifdef TRACY_NO_EXTRA_NOPSLEDS asm volatile ( "rdtsc" : "=a" (rax), "=d" (rdx) ); +#else
public/client/TracyProfiler.hpp
26
C++
0.286
suggestion
64
51
51
false
Use patchable rdtsc sequence to avoid slowdowns under rr
597
wolfpld/tracy
14,429
C++
wolfpld
Keno
{ ___tracy_RtlWalkFrameChain = (___tracy_t_RtlWalkFrameChain)GetProcAddress( GetModuleHandleA( "ntdll.dll" ), "RtlWalkFrameChain" ); } void InitCallstack() { _SymAddrIncludeInlineTrace = (t_SymAddrIncludeInlineTrace)GetProcAddress( GetModuleHandleA( "dbghelp.dll" ), "SymAddrIncludeInlineTrace" ); _SymQuery...
Use coding style used in the rest of code.
{ ___tracy_RtlWalkFrameChain = (___tracy_t_RtlWalkFrameChain)GetProcAddress( GetModuleHandleA( "ntdll.dll" ), "RtlWalkFrameChain" ); } void InitCallstack() { _SymAddrIncludeInlineTrace = (t_SymAddrIncludeInlineTrace)GetProcAddress( GetModuleHandleA( "dbghelp.dll" ), "SymAddrIncludeInlineTrace" ); _SymQuery...
@@ -157,9 +157,20 @@ void InitCallstack() SymInitialize( GetCurrentProcess(), nullptr, true ); SymSetOptions( SYMOPT_LOAD_LINES ); + // use TRACY_NO_DBHELP_INIT_LOAD=1 to disable preloading of driver + // and process module symbol loading at startup time - they will be loaded on demand later + // ...
public/client/TracyCallstack.cpp
26
C++
0.143
style
42
51
51
false
Add support for using using libunwind
657
wolfpld/tracy
14,429
C++
wolfpld
tiago-rodrigues
_SymQueryInlineTrace = (t_SymQueryInlineTrace)GetProcAddress( GetModuleHandleA( "dbghelp.dll" ), "SymQueryInlineTrace" ); _SymFromInlineContext = (t_SymFromInlineContext)GetProcAddress( GetModuleHandleA( "dbghelp.dll" ), "SymFromInlineContext" ); _SymGetLineFromInlineContext = (t_SymGetLineFromInlineContext...
No need for the parenthesis here.
_SymQueryInlineTrace = (t_SymQueryInlineTrace)GetProcAddress( GetModuleHandleA( "dbghelp.dll" ), "SymQueryInlineTrace" ); _SymFromInlineContext = (t_SymFromInlineContext)GetProcAddress( GetModuleHandleA( "dbghelp.dll" ), "SymFromInlineContext" ); _SymGetLineFromInlineContext = (t_SymGetLineFromInlineContext...
@@ -157,9 +157,20 @@ void InitCallstack() SymInitialize( GetCurrentProcess(), nullptr, true ); SymSetOptions( SYMOPT_LOAD_LINES ); + // use TRACY_NO_DBHELP_INIT_LOAD=1 to disable preloading of driver + // and process module symbol loading at startup time - they will be loaded on demand later + // ...
public/client/TracyCallstack.cpp
26
C++
0.071
suggestion
33
51
51
false
Add support for using using libunwind
657
wolfpld/tracy
14,429
C++
wolfpld
tiago-rodrigues
m_noExit = true; } #endif const char* userPort = GetEnvVar( "TRACY_PORT" ); if( userPort ) { m_userPort = atoi( userPort ); } #if !defined(TRACY_DELAYED_INIT) || !defined(TRACY_MANUAL_LIFETIME) SpawnWorkerThreads(); #endif } void Profiler::SpawnWorkerThreads() { #ifdef TRACY_H...
Replace printfs with `TracyDebug`.
m_noExit = true; } #endif const char* userPort = GetEnvVar( "TRACY_PORT" ); if( userPort ) { m_userPort = atoi( userPort ); } #if !defined(TRACY_DELAYED_INIT) || !defined(TRACY_MANUAL_LIFETIME) SpawnWorkerThreads(); #endif } void Profiler::SpawnWorkerThreads() { #ifdef TRACY_H...
@@ -1439,7 +1439,16 @@ Profiler::Profiler() void Profiler::SpawnWorkerThreads() { #ifdef TRACY_HAS_SYSTEM_TRACING - if( SysTraceStart( m_samplingPeriod ) ) + // use TRACY_NO_SYS_TRACE=1 to force disabling sys tracing + // (even if available in the underlying system) + // as it can have significant impac...
public/client/TracyProfiler.cpp
26
C++
0.429
bug
34
51
51
false
Add support for using using libunwind
657
wolfpld/tracy
14,429
C++
wolfpld
tiago-rodrigues
dl_iterate_phdr( Callback, this ); std::sort( m_images->begin(), m_images->end(), []( const ImageEntry& lhs, const ImageEntry& rhs ) { return lhs.m_startAddress > rhs.m_startAddress; } ); if( m_onRefreshCallback ) m_onRefreshCallback(); m_numberOfRefreshes++; ...
Is there a reason for keeping the above code outside the `tracy` namespace?
void Refresh() { Clear(); dl_iterate_phdr( Callback, this ); std::sort( m_images->begin(), m_images->end(), []( const ImageEntry& lhs, const ImageEntry& rhs ) { return lhs.m_startAddress > rhs.m_startAddress; } ); } const ImageEntry* GetImageForAddressImpl...
@@ -90,6 +90,124 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) #endif #endif +#if defined( TRACY_ENABLE_IMAGE_CACHE) && (TRACY_HAS_CALLSTACK == 3) +# define TRACY_USE_IMAGE_CACHE +# include <link.h> +#endif + +#ifdef TRACY_USE_IMAGE_CACHE +// when we have access to dl_iterate_phdr(), we can...
public/client/TracyCallstack.cpp
26
C++
0.357
question
75
51
51
false
Add image cache to avoid calling dladdr() and add libbacktrace elf image list refresh
674
wolfpld/tracy
14,429
C++
wolfpld
tiago-rodrigues
{ public: struct ImageEntry { ImageEntry( void* startAddress, void* endAddress, const char* name ) : m_startAddress( startAddress ), m_endAddress( endAddress ), m_name( name ) {} void* m_startAddress; void* m_endAddress; const char* m_name; }; ImageCache() {...
Remove debug code or convert to `TracyDebug()`.
// so we can quickly determine which image an address falls into. // We refresh this cache only when we hit an address that doesn't fall into any known range. class ImageCache { public: struct ImageEntry { void* m_startAddress = nullptr; void* m_endAddress = nullptr; char* m_name = nullp...
@@ -90,6 +90,124 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) #endif #endif +#if defined( TRACY_ENABLE_IMAGE_CACHE) && (TRACY_HAS_CALLSTACK == 3) +# define TRACY_USE_IMAGE_CACHE +# include <link.h> +#endif + +#ifdef TRACY_USE_IMAGE_CACHE +// when we have access to dl_iterate_phdr(), we can...
public/client/TracyCallstack.cpp
26
C++
0.429
bug
47
51
51
false
Add image cache to avoid calling dladdr() and add libbacktrace elf image list refresh
674
wolfpld/tracy
14,429
C++
wolfpld
tiago-rodrigues
/* elf.c -- Get debug data from an ELF file for backtraces. Copyright (C) 2012-2021 Free Software Foundation, Inc. Written by Ian Lance Taylor, Google. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: (1) R...
This whole file is marked as changed.
/* elf.c -- Get debug data from an ELF file for backtraces. Copyright (C) 2012-2021 Free Software Foundation, Inc. Written by Ian Lance Taylor, Google. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: (1) Redistrib...
public/libbacktrace/elf.cpp
1
C++
0.143
suggestion
37
26
26
false
Add image cache to avoid calling dladdr() and add libbacktrace elf image list refresh
674
wolfpld/tracy
14,429
C++
wolfpld
tiago-rodrigues
image->m_name = info->dlpi_name; } else { if( !cache->m_imageName ) { Dl_info dlInfo; if( dladdr( (void *)info->dlpi_addr, &dlInfo ) ) { cache->m_imageName = dlInfo.dli_fname; ...
Is `image->m_name` valid after this function returns? My guess would be that the `info` argument is only valid inside this function, and the `dlInfo` provided filename will be invalidated after the next call to `dladdr`.
const char* imageName = nullptr; // the base executable name isn't provided when iterating with dl_iterate_phdr, get it with dladdr() if( info->dlpi_name && info->dlpi_name[0] != '\0' ) { imageName = info->dlpi_name; } else { Dl_info dlInf...
@@ -90,9 +90,111 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) #endif #endif +#if TRACY_HAS_CALLSTACK == 3 +# define TRACY_USE_IMAGE_CACHE +# include <link.h> +#endif + namespace tracy { +#ifdef TRACY_USE_IMAGE_CACHE +// when we have access to dl_iterate_phdr(), we can build a cache of ...
public/client/TracyCallstack.cpp
26
C++
0.571
suggestion
220
51
51
false
Add image cache to avoid calling dladdr() and add libbacktrace elf image list refresh
674
wolfpld/tracy
14,429
C++
wolfpld
tiago-rodrigues
{ if( !cache->m_imageName ) { Dl_info dlInfo; if( dladdr( (void *)info->dlpi_addr, &dlInfo ) ) { cache->m_imageName = dlInfo.dli_fname; } } image->m_name = cache->m_imageName; ...
Rename to `GetImageForAddressImpl`.
if( info->dlpi_name && info->dlpi_name[0] != '\0' ) { imageName = info->dlpi_name; } else { Dl_info dlInfo; if( dladdr( (void *)info->dlpi_addr, &dlInfo ) ) { imageName = dlInfo.dli_fname; } } ...
@@ -90,9 +90,111 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) #endif #endif +#if TRACY_HAS_CALLSTACK == 3 +# define TRACY_USE_IMAGE_CACHE +# include <link.h> +#endif + namespace tracy { +#ifdef TRACY_USE_IMAGE_CACHE +// when we have access to dl_iterate_phdr(), we can build a cache of ...
public/client/TracyCallstack.cpp
26
C++
0.286
suggestion
35
51
51
false
Add image cache to avoid calling dladdr() and add libbacktrace elf image list refresh
674
wolfpld/tracy
14,429
C++
wolfpld
tiago-rodrigues
: m_startAddress( startAddress ), m_endAddress( endAddress ), m_name( name ) {} void* m_startAddress; void* m_endAddress; const char* m_name; }; ImageCache() { m_images = (tracy::FastVector<ImageEntry>*)tracy::tracy_malloc( sizeof( tracy::FastVector<ImageEntry> ) );...
Is there a mechanism that will prevent constant reloads when a large set of unmapped addresses is queried?
void* m_endAddress = nullptr; char* m_name = nullptr; }; ImageCache() { m_images = (FastVector<ImageEntry>*)tracy_malloc( sizeof( FastVector<ImageEntry> ) ); new(m_images) FastVector<ImageEntry>( 512 ); Refresh(); } ~ImageCache() { Clear(); ...
@@ -90,9 +90,111 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) #endif #endif +#if TRACY_HAS_CALLSTACK == 3 +# define TRACY_USE_IMAGE_CACHE +# include <link.h> +#endif + namespace tracy { +#ifdef TRACY_USE_IMAGE_CACHE +// when we have access to dl_iterate_phdr(), we can build a cache of ...
public/client/TracyCallstack.cpp
26
C++
0.357
question
106
51
51
false
Add image cache to avoid calling dladdr() and add libbacktrace elf image list refresh
674
wolfpld/tracy
14,429
C++
wolfpld
tiago-rodrigues
} else { auto& sl = m_worker.GetSourceLocation( it->first ); auto name = m_worker.GetString( sl.name.active ? sl.name : sl.function ); if( m_statisticsFilter.PassFilter( name ) ) ...
Try adding some spacing or a vertical separator. This will help separate things more clearly.
size_t count = it->second.zones.size(); int64_t total = it->second.total; if( !filterActive ) { srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, 0, count, total } ); } ...
@@ -440,6 +445,8 @@ void View::DrawStatistics() ImGui::Spacing(); ImGui::SameLine(); TextFocused( "Visible zones:", RealToString( srcloc.size() ) ); + ImGui::SameLine(); + copySrclocsToClipboard = ClipboardButton();
server/TracyView_Statistics.cpp
26
C++
0.214
suggestion
93
51
51
false
Adding a copy to CSV button to the statistics view.
747
wolfpld/tracy
14,429
C++
wolfpld
benvanik
}; struct ___tracy_gpu_context_name_data { uint8_t context; const char* name; uint16_t len; }; struct ___tracy_gpu_calibration_data { int64_t gpuTime; int64_t cpuDelta; uint8_t context; }; // Some containers don't support storing const types. // This struct, as visible to user, is immutable, ...
There are no default arguments in C.
}; struct ___tracy_gpu_context_name_data { uint8_t context; const char* name; uint16_t len; }; struct ___tracy_gpu_calibration_data { int64_t gpuTime; int64_t cpuDelta; uint8_t context; }; // Some containers don't support storing const types. // This struct, as visible to user, is immutable, ...
@@ -182,8 +182,8 @@ TRACY_API void ___tracy_startup_profiler(void); TRACY_API void ___tracy_shutdown_profiler(void); #endif -TRACY_API uint64_t ___tracy_alloc_srcloc( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz ); -TRACY_API uint64_t ___tracy_alloc_srcloc_name( uint32...
public/tracy/TracyC.h
26
C/C++
0.071
suggestion
36
51
51
false
Add support to set color when creating a ScopedZone
755
wolfpld/tracy
14,429
C++
wolfpld
Chekov2k
#include <inttypes.h> #include "TracyColor.hpp" #include "TracyImGui.hpp" #include "TracyMouse.hpp" #include "TracyPrint.hpp" #include "TracyTimelineContext.hpp" #include "TracyUtility.hpp" #include "TracyView.hpp" namespace tracy { bool View::DrawPlot( const TimelineContext& ctx, PlotData& plot, const std::vector<u...
You should be able to use `m_vd` here.
#include <inttypes.h> #include "TracyColor.hpp" #include "TracyImGui.hpp" #include "TracyMouse.hpp" #include "TracyPrint.hpp" #include "TracyTimelineContext.hpp" #include "TracyUtility.hpp" #include "TracyView.hpp" namespace tracy { bool View::DrawPlot( const TimelineContext& ctx, PlotData& plot, const std::vector<u...
@@ -24,7 +21,7 @@ bool View::DrawPlot( const TimelineContext& ctx, PlotData& plot, const std::vect const auto hover = ctx.hover; const auto ty = ctx.ty; - const auto PlotHeight = PlotHeightPx * GetScale(); + const auto PlotHeight = GetViewData().plotHeight * GetScale();
profiler/src/profiler/TracyView_Plots.cpp
24
C++
0.286
suggestion
38
49
49
false
Support adjusting plot height.
786
wolfpld/tracy
14,429
C++
wolfpld
mcourteaux
auto t5 = std::thread( Lock1 ); auto t6 = std::thread( Lock2 ); auto t7 = std::thread( Lock3 ); auto t8 = std::thread( Plot ); auto t9 = std::thread( Plot ); auto t10 = std::thread( MessageTest ); auto t11 = std::thread( DepthTest ); auto t12 = std::thread( RecLock ); auto t13 = std:...
This seems like a misconfiguration on the CMake part. Can you make the image file be copied to the build / install dir instead?
auto t5 = std::thread( Lock1 ); auto t6 = std::thread( Lock2 ); auto t7 = std::thread( Lock3 ); auto t8 = std::thread( Plot ); auto t9 = std::thread( Plot ); auto t10 = std::thread( MessageTest ); auto t11 = std::thread( DepthTest ); auto t12 = std::thread( RecLock ); auto t13 = std:...
@@ -328,7 +328,10 @@ int main() int x, y; auto image = stbi_load( "image.jpg", &x, &y, nullptr, 4 ); - + if(image == nullptr) + { + std::cerr << "Could not find image (are you running this executable in the test/ folder ?), skipping" << std::endl;
test/test.cpp
26
C++
0.429
question
127
43
43
false
[IDE] migrate `test` folder to CMake configuration
824
wolfpld/tracy
14,429
C++
wolfpld
Arpafaucon
void Profiler::InstallCrashHandler() { #if defined __linux__ && !defined TRACY_NO_CRASH_HANDLER struct sigaction threadFreezer = {}; threadFreezer.sa_handler = ThreadFreezer; sigaction( TRACY_CRASH_SIGNAL, &threadFreezer, &m_prevSignal.pwr ); struct sigaction crashHandler = {}; crashHandler.sa_sig...
What is the reason for this change?
void Profiler::InstallCrashHandler() { #if defined __linux__ && !defined TRACY_NO_CRASH_HANDLER struct sigaction threadFreezer = {}; threadFreezer.sa_handler = ThreadFreezer; sigaction( TRACY_CRASH_SIGNAL, &threadFreezer, &m_prevSignal.pwr ); struct sigaction crashHandler = {}; crashHandler.sa_sig...
@@ -1484,22 +1502,30 @@ void Profiler::InstallCrashHandler() sigaction( SIGPIPE, &crashHandler, &m_prevSignal.pipe ); sigaction( SIGBUS, &crashHandler, &m_prevSignal.bus ); sigaction( SIGABRT, &crashHandler, &m_prevSignal.abrt ); -#endif -#if defined _WIN32 && !defined TRACY_UWP && !defined TRACY_NO_CR...
public/client/TracyProfiler.cpp
26
C++
0.143
question
35
51
51
false
Safe copy to fix issue #888
889
wolfpld/tracy
14,429
C++
wolfpld
jkriegshauser
#endif CalibrateTimer(); CalibrateDelay(); ReportTopology(); #ifdef __linux__ m_kcore = (KCore*)tracy_malloc( sizeof( KCore ) ); new(m_kcore) KCore(); #endif #ifndef TRACY_NO_EXIT const char* noExitEnv = GetEnvVar( "TRACY_NO_EXIT" ); if( noExitEnv && noExitEnv[0] == '1' ) { m_...
This can be a contexpr and not a variable.
s_threadHandle = ThreadHandleWrapper { m_mainThread }; # endif #endif CalibrateTimer(); CalibrateDelay(); ReportTopology(); #ifdef __linux__ m_kcore = (KCore*)tracy_malloc( sizeof( KCore ) ); new(m_kcore) KCore(); #endif #ifndef TRACY_NO_EXIT const char* noExitEnv = GetEnvVar( "TRACY_NO_...
@@ -1462,6 +1463,22 @@ Profiler::Profiler() m_userPort = atoi( userPort ); } + m_safeSendBufferSize = 65536;
public/client/TracyProfiler.cpp
26
C++
0.071
suggestion
42
51
51
false
Safe copy to fix issue #888
889
wolfpld/tracy
14,429
C++
wolfpld
jkriegshauser
if( m_threadCtx == threadId ) return ThreadCtxStatus::Same; QueueItem item; MemWrite( &item.hdr.type, QueueType::ThreadContext ); MemWrite( &item.threadCtx.thread, threadId ); if( !AppendData( &item, QueueDataSize[(int)QueueType::ThreadContext] ) ) return ThreadCtxStatus::ConnectionLost; m_threa...
What's the typical histogram of buffer sizes? How often is a larger temporary buffer allocated?
{ if( m_threadCtx == threadId ) return ThreadCtxStatus::Same; QueueItem item; MemWrite( &item.hdr.type, QueueType::ThreadContext ); MemWrite( &item.threadCtx.thread, threadId ); if( !AppendData( &item, QueueDataSize[(int)QueueType::ThreadContext] ) ) return ThreadCtxStatus::ConnectionLost; m_thr...
@@ -3063,6 +3097,62 @@ bool Profiler::CommitData() return ret; } +char* Profiler::SafeCopyProlog( const char* data, size_t size ) +{ + bool success = true; + char* buf = m_safeSendBuffer; +#ifndef NDEBUG + assert( !m_inUse.exchange(true) ); +#endif + + if( size > m_safeSendBufferSize ) buf = (char*)...
public/client/TracyProfiler.cpp
26
C++
0.214
question
95
51
51
false
Safe copy to fix issue #888
889
wolfpld/tracy
14,429
C++
wolfpld
jkriegshauser
SysTime m_sysTime; uint64_t m_sysTimeLast = 0; #else void ProcessSysTime() {} #endif #ifdef TRACY_HAS_SYSPOWER SysPower m_sysPower; #endif ParameterCallback m_paramCallback; void* m_paramCallbackData; SourceContentsCallback m_sourceCallback; void* m_sourceCallbackData; char* m_qu...
Move this entirely to the cpp file.
SysTime m_sysTime; uint64_t m_sysTimeLast = 0; #else void ProcessSysTime() {} #endif #ifdef TRACY_HAS_SYSPOWER SysPower m_sysPower; #endif ParameterCallback m_paramCallback; void* m_paramCallbackData; SourceContentsCallback m_sourceCallback; void* m_sourceCallbackData; char* m_qu...
@@ -990,9 +1005,20 @@ class Profiler char* m_queryData; char* m_queryDataPtr; +#ifndef NDEBUG + // m_safeSendBuffer and m_pipe should only be used by the Tracy Profiler thread; this ensures that in debug builds. + std::atomic_bool m_inUse{ false }; +#endif + char* m_safeSendBuffer; + constexpr s...
public/client/TracyProfiler.hpp
26
C++
0.143
refactor
35
50
49
false
Safe copy to fix issue #888
889
wolfpld/tracy
14,429
C++
wolfpld
jkriegshauser
vec.push_back_no_space_check( t ); total += t; } } else { for( i=m_findZone.sortedNum; i<zsz; i++ ) { au...
I don't think this variable is needed.
vec.push_back_no_space_check( t ); total += t; } } else { for( i=m_findZone.sortedNum; i<zsz; i++ ) { au...
@@ -549,10 +549,13 @@ void View::DrawFindZone() std::inplace_merge( vec.begin(), mid, vec.end() ); const auto vsz = vec.size(); + const auto vszQuarter = vsz / 4;
profiler/src/profiler/TracyView_FindZone.cpp
26
C++
0.071
suggestion
38
51
51
false
Percentiles p75, p90 for FindZone view
926
wolfpld/tracy
14,429
C++
wolfpld
WernherVonData
} } static inline void PrintSecondsFrac( char*& buf, uint64_t v ) { uint64_t in = v / 1000; uint64_t fr = v % 1000; if( fr >= 950 ) { PrintTinyInt0( buf, in+1 ); } else { PrintTinyInt0( buf, in ); if( fr > 50 ) { PrintFrac0( buf, fr ); ...
Shouldn't this be casted to uint64_t before adding 1? Example with int8_t so it's readable: ``` int8_t x == -128 => (x+1) == -127 => -(x+1) == 127 // ok, fits into int8_t => -(x+1) + 1 == ??? // still a signed int8_t, right? // as 128 doesn't fit into int8_t, it probably wraps around to -12...
} } static inline void PrintSecondsFrac( char*& buf, uint64_t v ) { uint64_t in = v / 1000; uint64_t fr = v % 1000; if( fr >= 950 ) { PrintTinyInt0( buf, in+1 ); } else { PrintTinyInt0( buf, in ); if( fr > 50 ) { PrintFrac0( buf, fr ); ...
@@ -155,6 +155,22 @@ static inline void PrintSecondsFrac( char*& buf, uint64_t v ) } } +uint64_t _int64_abs( int64_t x ) +{ + if( x == std::numeric_limits<int64_t>::min() ) + { + return -(x + 1) + 1;
server/TracyPrint.cpp
26
C++
1
suggestion
1,115
51
51
false
Time to string exact
1,040
wolfpld/tracy
14,429
C++
DanielGibson
blegat
# include <inttypes.h> # elif defined __APPLE__ # include <mach/mach_host.h> # include <mach/host_info.h> # elif defined BSD # include <sys/types.h> # include <sys/sysctl.h> # endif namespace tracy { # if defined _WIN32 static inline uint64_t ConvertTime( const FILETIME& t ) { return ( uint64_...
missing include of `TracyWinFamily.hpp`
# include <stdio.h> # include <inttypes.h> # elif defined __APPLE__ # include <mach/mach_host.h> # include <mach/host_info.h> # elif defined BSD # include <sys/types.h> # include <sys/sysctl.h> # endif namespace tracy { # if defined _WIN32 static inline uint64_t ConvertTime( const FILETIME& t )...
@@ -27,13 +27,24 @@ static inline uint64_t ConvertTime( const FILETIME& t ) void SysTime::ReadTimes() { - FILETIME idleTime; FILETIME kernelTime; FILETIME userTime; +# if defined TRACY_GDK
public/client/TracySysTime.cpp
26
C++
0.214
suggestion
39
51
51
false
Add GDK platform support
1,099
wolfpld/tracy
14,429
C++
Kova93
pkraif
{ inline bool IsKernelAddress( uint64_t addr ) { return ( addr >> 63 ) != 0; } void DestroyImageEntry( ImageEntry& entry ) { tracy_free_fast( entry.path ); entry.path = nullptr; tracy_free_fast( entry.name ); entry.name = nullptr; } class ImageCache ...
Is there a reason for doing this that way? A simple `memset` should suffice.
{ static bool IsKernelAddress(uint64_t addr) { return (addr >> 63) != 0; } void DestroyImageEntry( ImageEntry& entry ) { tracy_free( entry.m_path ); tracy_free( entry.m_name ); } class ImageCache { public: ImageCache( size_t imageCacheCapacity = 512 ) : m_images( imageCacheCapacity ) ...
@@ -110,103 +110,170 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) #endif #if defined(TRACY_USE_LIBBACKTRACE) && TRACY_HAS_CALLSTACK != 4 // dl_iterate_phdr is required for the current image cache. Need to move it to libbacktrace? -# define TRACY_USE_IMAGE_CACHE +# define TRACY_USE_DL_ITERA...
public/client/TracyCallstack.cpp
26
C++
0.429
suggestion
76
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
if( it != m_modCache.end() ) return it; } return nullptr; } void Sort() { if( !m_sorted ) { std::sort( m_modCache.begin(), m_modCache.end(), []( const ImageEntry& lhs, const ImageEntry& rhs ) { r...
"Module" is microsoftizm for "(executable) image". This class is named `*Image*Cache`.
{ if( m_sorted ) return; std::sort( m_images.begin(), m_images.end(), []( const ImageEntry& lhs, const ImageEntry& rhs ) { return lhs.m_startAddress > rhs.m_startAddress; } ); m_sorted = true; } void Clear() { for( ImageEntry& entry : m_images ) { ...
@@ -110,103 +110,170 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) #endif #if defined(TRACY_USE_LIBBACKTRACE) && TRACY_HAS_CALLSTACK != 4 // dl_iterate_phdr is required for the current image cache. Need to move it to libbacktrace? -# define TRACY_USE_IMAGE_CACHE +# define TRACY_USE_DL_ITERA...
public/client/TracyCallstack.cpp
26
C++
0.357
performance
86
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
ImageEntry* AddEntry( const ImageEntry& entry ) { m_sorted &= m_modCache.empty() || ( entry.start < m_modCache.back().start ); ImageEntry* newEntry = m_modCache.push_next(); *newEntry = entry; return newEntry; } const ImageEntry* FindEntr...
What is the expected use pattern of this class? Why are there two different code paths in this function? When am I supposed to call `Sort()`? Why do I need to do this manually?
if( m_sorted ) m_sorted = m_images.empty() || ( entry.m_startAddress < m_images.back().m_startAddress ); ImageEntry* newEntry = m_images.push_next(); *newEntry = entry; return newEntry; } const ImageEntry* GetImageForAddress( uint64_t address ) { Sort(); aut...
@@ -110,103 +110,170 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) #endif #if defined(TRACY_USE_LIBBACKTRACE) && TRACY_HAS_CALLSTACK != 4 // dl_iterate_phdr is required for the current image cache. Need to move it to libbacktrace? -# define TRACY_USE_IMAGE_CACHE +# define TRACY_USE_DL_ITERA...
public/client/TracyCallstack.cpp
26
C++
0.571
question
176
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
#endif #if defined(TRACY_USE_LIBBACKTRACE) && TRACY_HAS_CALLSTACK != 4 // dl_iterate_phdr is required for the current image cache. Need to move it to libbacktrace? # define TRACY_USE_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE_WITH_LIBBACKTRACE # include <link.h> #endif namespace tracy { inline bool IsKernelAddres...
"Module" is still used across this class.
#endif #if defined(TRACY_USE_LIBBACKTRACE) && TRACY_HAS_CALLSTACK != 4 // dl_iterate_phdr is required for the current image cache. Need to move it to libbacktrace? # define TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE # include <link.h> #endif namespace tracy { static bool IsKernelAddress(uint64_t addr) { ...
@@ -110,103 +110,155 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) #endif #if defined(TRACY_USE_LIBBACKTRACE) && TRACY_HAS_CALLSTACK != 4 // dl_iterate_phdr is required for the current image cache. Need to move it to libbacktrace? -# define TRACY_USE_IMAGE_CACHE +# define TRACY_USE_DL_ITERA...
public/client/TracyCallstack.cpp
26
C++
0.143
suggestion
41
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
~ImageCacheDlIteratePhdr() { m_haveMainImageName = false; } const ImageEntry* GetImageForAddress( uint64_t address ) { const ImageEntry* entry = FindEntryFromAddr( address ); if( !entry ) { Refresh(); return FindEntryFromAddr( address ); ...
Why was `Contains` renamed to `ContainsImage`?
~ImageCacheDlIteratePhdr() { } const ImageEntry* GetImageForAddress( uint64_t address ) { const ImageEntry* entry = ImageCache::GetImageForAddress( address ); if( !entry ) { Refresh(); return ImageCache::GetImageForAddress( address ); } ...
@@ -110,103 +110,155 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) #endif #if defined(TRACY_USE_LIBBACKTRACE) && TRACY_HAS_CALLSTACK != 4 // dl_iterate_phdr is required for the current image cache. Need to move it to libbacktrace? -# define TRACY_USE_IMAGE_CACHE +# define TRACY_USE_DL_ITERA...
public/client/TracyCallstack.cpp
26
C++
0.286
question
46
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
cache->m_updated = true; return 0; } void Refresh() { m_updated = false; dl_iterate_phdr( Callback, this ); if( m_updated ) { Sort(); // patch the main executable image name here, as calling dl_* functions inside the dl_iterate_phdr ...
Why is the variable name changed?
return 0; } void Refresh() { m_updated = false; dl_iterate_phdr( Callback, this ); if( m_updated ) { Sort(); // patch the main executable image name here, as calling dl_* functions inside the dl_iterate_phdr callback might cause deadlocks ...
@@ -219,18 +271,16 @@ class ImageCache return; } - for( ImageEntry& entry : m_images ) + for( ImageEntry& entry : m_modCache )
public/client/TracyCallstack.cpp
26
C++
0.143
question
33
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
if( dladdr( (void*)entry.start, &dlInfo ) ) { if( dlInfo.dli_fname ) { entry.name = CopyStringFast( dlInfo.dli_fname ); } } // we only expect one entry to be null for the ...
This is immediately after `#endif` for the same condition.
{ if( dlInfo.dli_fname ) { size_t sz = strlen( dlInfo.dli_fname ) + 1; entry.m_name = (char*)tracy_malloc( sz ); memcpy( entry.m_name, dlInfo.dli_fname, sz ); } ...
@@ -242,30 +292,73 @@ class ImageCache m_haveMainImageName = true; } - const ImageEntry* GetImageForAddressImpl( void* address ) const + void Clear() { - auto it = std::lower_bound( m_images.begin(), m_images.end(), address, - []( const ImageEntry& lhs, const void* rhs ) { r...
public/client/TracyCallstack.cpp
26
C++
0.357
suggestion
58
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
m_haveMainImageName = false; } }; #endif // defined(TRACY_USE_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE) #ifdef TRACY_USE_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE typedef ImageCacheDlIteratePhdr UserlandImageCache; #else typedef ImageCache UserlandImageCache; #endif //#ifdef TRACY_USE_DL_ITERATE_PHDR_TO_REFRES...
Sameline the first branch, no `else` for the second branch.
m_haveMainImageName = false; } }; using UserlandImageCache = ImageCacheDlIteratePhdr; #else using UserlandImageCache = ImageCache; #endif //#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE static UserlandImageCache* s_imageCache; static ImageCache* s_krnlCache; void CreateImageCaches() { assert...
@@ -242,30 +292,73 @@ class ImageCache m_haveMainImageName = true; } - const ImageEntry* GetImageForAddressImpl( void* address ) const + void Clear() { - auto it = std::lower_bound( m_images.begin(), m_images.end(), address, - []( const ImageEntry& lhs, const void* rhs ) { r...
public/client/TracyCallstack.cpp
26
C++
0.357
suggestion
59
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
{ if( s_krnlCache != nullptr ) { s_krnlCache->~ImageCache(); tracy_free( (void*)s_krnlCache ); s_krnlCache = nullptr; } if( s_imageCache != nullptr ) { s_imageCache->~UserlandImageCache(); tracy_free( s_imageCache ); s_imageCache = nullptr; } } ...
What are these accessors for? Why is the linux specific kernel cache omitted?
// simply resolve the offset and image name (which will be enough the resolving to be done offline) #ifdef TRACY_SYMBOL_OFFLINE_RESOLVE constexpr bool s_shouldResolveSymbolsOffline = true; #else static bool s_shouldResolveSymbolsOffline = false; bool ShouldResolveSymbolsOffline() { const char* symbolOfflineResolve ...
@@ -242,30 +292,73 @@ class ImageCache m_haveMainImageName = true; } - const ImageEntry* GetImageForAddressImpl( void* address ) const + void Clear() { - auto it = std::lower_bound( m_images.begin(), m_images.end(), address, - []( const ImageEntry& lhs, const void* rhs ) { r...
public/client/TracyCallstack.cpp
26
C++
0.214
performance
77
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
return entry; } private: bool m_updated = false; bool m_haveMainImageName = false; static int Callback( struct dl_phdr_info* info, size_t size, void* data ) { ImageCacheDlIteratePhdr* cache = reinterpret_cast<ImageCacheDlIteratePhdr*>( data ); const uint64_t startAddress =...
The original call was to `tracy_malloc` why is this changed to `tracy_malloc_fast`?
} private: bool m_updated = false; bool m_haveMainImageName = false; static int Callback( struct dl_phdr_info* info, size_t size, void* data ) { ImageCacheDlIteratePhdr* cache = reinterpret_cast<ImageCacheDlIteratePhdr*>( data ); const auto startAddress = static_cast<uint64_t>( in...
@@ -110,103 +110,155 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) #endif #if defined(TRACY_USE_LIBBACKTRACE) && TRACY_HAS_CALLSTACK != 4 // dl_iterate_phdr is required for the current image cache. Need to move it to libbacktrace? -# define TRACY_USE_IMAGE_CACHE +# define TRACY_USE_DL_ITERA...
public/client/TracyCallstack.cpp
26
C++
0.429
question
83
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
extern "C" const char* ___tracy_demangle( const char* mangled ) { if( !mangled || mangled[0] != '_' ) return nullptr; if( strlen( mangled ) > ___tracy_demangle_buffer_len ) return nullptr; int status; size_t len = ___tracy_demangle_buffer_len; return abi::__cxa_demangle( mangled, ___tracy_demangle_...
This changes previous semantics. Is setting nullptr necessary here?
extern "C" const char* ___tracy_demangle( const char* mangled ) { if( !mangled || mangled[0] != '_' ) return nullptr; if( strlen( mangled ) > ___tracy_demangle_buffer_len ) return nullptr; int status; size_t len = ___tracy_demangle_buffer_len; return abi::__cxa_demangle( mangled, ___tracy_demangle_...
@@ -117,6 +117,14 @@ extern "C" const char* ___tracy_demangle( const char* mangled ) namespace tracy { +void DestroyImageEntry( ImageEntry& entry ) +{ + tracy_free( entry.m_path ); + entry.m_path = nullptr; + tracy_free( entry.m_name ); + entry.m_name = nullptr;
public/client/TracyCallstack.cpp
26
C++
0.429
bug
67
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
void DestroyImageEntry( ImageEntry& entry ) { tracy_free( entry.m_path ); entry.m_path = nullptr; tracy_free( entry.m_name ); entry.m_name = nullptr; } class ImageCache { public: ImageCache( size_t imageCacheCapacity = 512 ) : m_images( imageCacheCapacity ) { } ~ImageCach...
This can be changed to `if(sorted) sorted=...`
static bool IsKernelAddress(uint64_t addr) { return (addr >> 63) != 0; } void DestroyImageEntry( ImageEntry& entry ) { tracy_free( entry.m_path ); tracy_free( entry.m_name ); } class ImageCache { public: ImageCache( size_t imageCacheCapacity = 512 ) : m_images( imageCacheCapacity ) {...
@@ -139,8 +139,18 @@ class ImageCache Clear(); } - const ImageEntry* GetImageForAddress( uint64_t address ) const + ImageEntry* AddEntry( const ImageEntry& entry ) { + m_sorted &= m_images.empty() || ( entry.m_startAddress < m_images.back().m_startAddress );
public/client/TracyCallstack.cpp
26
C++
0.286
style
46
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
void Clear() { ImageCache::Clear(); m_haveMainImageName = false; } }; using UserlandImageCache = ImageCacheDlIteratePhdr; #else using UserlandImageCache = ImageCache; #endif //#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE static UserlandImageCache* s_imageCache; static ImageCache*...
Is there a case when this won't be true?
m_haveMainImageName = true; } void Clear() { ImageCache::Clear(); m_haveMainImageName = false; } }; using UserlandImageCache = ImageCacheDlIteratePhdr; #else using UserlandImageCache = ImageCache; #endif //#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE static UserlandIm...
@@ -296,8 +296,40 @@ class ImageCacheDlIteratePhdr : public ImageCache m_haveMainImageName = false; } }; +using UserlandImageCache = ImageCacheDlIteratePhdr; +#else +using UserlandImageCache = ImageCache; #endif //#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE +static UserlandImageCache* s_im...
public/client/TracyCallstack.cpp
26
C++
0.071
question
40
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
DBGHELP_LOCK; #endif SymInitialize( GetCurrentProcess(), nullptr, true ); SymSetOptions( SYMOPT_LOAD_LINES ); #ifdef TRACY_DBGHELP_LOCK DBGHELP_UNLOCK; #endif } DWORD64 DbgHelpLoadSymbolsForModule( const char* imageName, uint64_t baseOfDll, uint32_t bllSize ) { if( s_shouldResolveSymbolsOffline )...
This looks like CopyString(Fast) could be used here?
#ifdef TRACY_DBGHELP_LOCK DBGHELP_INIT; DBGHELP_LOCK; #endif SymInitialize( GetCurrentProcess(), nullptr, true ); SymSetOptions( SYMOPT_LOAD_LINES ); #ifdef TRACY_DBGHELP_LOCK DBGHELP_UNLOCK; #endif } DWORD64 DbgHelpLoadSymbolsForModule( const char* imageName, uint64_t baseOfDll, uint32_t bllSize...
@@ -392,35 +404,47 @@ DWORD64 DbgHelpLoadSymbolsForModule( const char* imageName, uint64_t baseOfDll, return SymLoadModuleEx( GetCurrentProcess(), nullptr, imageName, nullptr, baseOfDll, bllSize, nullptr, 0 ); } -ModuleCache* LoadSymbolsForModuleAndCache( const char* imageName, uint32_t imageNameLength, uint64_...
public/client/TracyCallstack.cpp
26
C++
0.286
question
52
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
char* FormatImageName( const char* imageName, uint32_t imageNameLength ) { // when doing offline symbol resolution, we must store the full path of the dll for the resolving to work if( s_shouldResolveSymbolsOffline ) { char* alloc = (char*)tracy_malloc_fast( imageNameLength + 1 ); memcp...
The number of kernel modules is known here. I wonder if this can be preserved with the new interface?
return SymLoadModuleEx( GetCurrentProcess(), nullptr, imageName, nullptr, baseOfDll, bllSize, nullptr, 0 ); } char* FormatImageName( const char* imageName, uint32_t imageNameLength ) { // when doing offline symbol resolution, we must store the full path of the dll for the resolving to work if( s_shouldReso...
@@ -459,8 +485,6 @@ void InitCallstack() const auto windirlen = strlen( windir ); const auto sz = needed / sizeof( LPVOID ); - s_krnlCache = (KernelDriver*)tracy_malloc( sizeof(KernelDriver) * sz );
public/client/TracyCallstack.cpp
26
C++
0.357
question
101
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
ret[si->NameLen] = '\0'; } #ifdef TRACY_DBGHELP_LOCK DBGHELP_UNLOCK; #endif return ret; } const char* GetKernelModulePath( uint64_t addr ) { assert( addr >> 63 != 0 ); if( !s_krnlCache ) return nullptr; const ImageEntry* imageEntry = s_krnlCache->GetImageForAddress( addr ); if( imag...
Will `return imageEntry && imageEntry->m_path` work?
#ifdef TRACY_DBGHELP_LOCK DBGHELP_LOCK; #endif if( SymFromAddr( proc, ptr, nullptr, si ) == 0 ) { *ret = '\0'; } else { memcpy( ret, si->Name, si->NameLen ); ret[si->NameLen] = '\0'; } #ifdef TRACY_DBGHELP_LOCK DBGHELP_UNLOCK; #endif return ret; } const char...
@@ -570,9 +592,9 @@ const char* GetKernelModulePath( uint64_t addr ) { assert( addr >> 63 != 0 ); if( !s_krnlCache ) return nullptr; - auto it = std::lower_bound( s_krnlCache, s_krnlCache + s_krnlCacheCnt, addr, []( const KernelDriver& lhs, const uint64_t& rhs ) { return lhs.addr > rhs; } ); - if( it =...
public/client/TracyCallstack.cpp
26
C++
0.357
question
52
51
51
false
Unify module caches
1,120
wolfpld/tracy
14,429
C++
wolfpld
Lectem
if ( SUCCEEDED( _GetThreadDescription( hnd, &tmp ) ) ) { char buf[256]; auto ret = wcstombs( buf, tmp, 256 ); LocalFree(tmp); if( ret != 0 ) { threadName = CopyString( buf, ret ); ...
Is this function pointer still needed?
if ( SUCCEEDED( _GetThreadDescription( hnd, &tmp ) ) ) { char buf[256]; auto ret = wcstombs( buf, tmp, 256 ); LocalFree(tmp); if( ret != 0 ) { threadName = CopyString( buf, ret ); ...
@@ -527,25 +527,23 @@ void SysTraceGetExternalName( uint64_t thread, const char*& threadName, const ch const auto phnd = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid ); if( phnd != INVALID_HANDLE_VALUE ) { - HMODULE modules[10...
public/client/TracySysTrace.cpp
26
C++
0.071
question
38
51
51
false
Speeding up ExternalName queries (on Windows)
1,125
wolfpld/tracy
14,429
C++
wolfpld
slomp
{ tracy::StartupProfiler(); } TRACY_API void ___tracy_shutdown_profiler( void ) { tracy::ShutdownProfiler(); } TRACY_API int32_t ___tracy_profiler_started( void ) { return static_cast<int32_t>( tracy::s_isProfilerStarted.load( std::memory_order_seq_cst ) ); } # endif extern "C" TRACY_API int ___tracy_be...
This is end of the `extern "C"` scope.
{ tracy::StartupProfiler(); } TRACY_API void ___tracy_shutdown_profiler( void ) { tracy::ShutdownProfiler(); } TRACY_API int32_t ___tracy_profiler_started( void ) { return static_cast<int32_t>( tracy::s_isProfilerStarted.load( std::memory_order_seq_cst ) ); } # endif TRACY_API int ___tracy_begin_samplin...
@@ -5005,6 +5024,14 @@ TRACY_API int32_t ___tracy_profiler_started( void ) } # endif +extern "C" TRACY_API int ___tracy_begin_sampling_profiling( void ) { + return tracy::BeginSamplingProfiling() ? 1 : 0; +} + +extern "C" TRACY_API void ___tracy_end_sampling_profiling( void ) { + tracy::EndSamplingProfiling(...
public/client/TracyProfiler.cpp
26
C++
0.214
suggestion
38
29
29
false
Option to manually control sampling profiling
1,126
wolfpld/tracy
14,429
C++
wolfpld
slomp
s_config.shortenName = (int)m_vd.shortenName; s_config.drawSamples = m_vd.drawSamples; s_config.drawContextSwitches = m_vd.drawContextSwitches; SaveConfig(); } if( ImGui::IsItemHovered() ) { default_markers_active = true; ImGui::BeginTooltip(); const a...
I don't think this will work as intended.
s_config.ghostZones = m_vd.ghostZones; s_config.shortenName = (int)m_vd.shortenName; s_config.drawSamples = m_vd.drawSamples; s_config.drawContextSwitches = m_vd.drawContextSwitches; SaveConfig(); } if( ImGui::IsItemHovered() ) { highlight = true; ImG...
@@ -824,6 +848,53 @@ void View::DrawOptions() ImGui::TreePop(); } } + + ImGui::Separator(); + + ImGui::TextUnformatted( "" ); + DefaultMarker( default_markers_active, false ); + ImGui::SameLine( 0.0f, 1.0f ); + ImGui::TextUnformatted( ": The default value for this option is con...
profiler/src/profiler/TracyView_Options.cpp
26
C++
0.071
suggestion
41
33
33
false
Configuration of defaults.
1,140
wolfpld/tracy
14,429
C++
wolfpld
mcourteaux
#define ZoneNamedNC( varname, name, color, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { name, TracyFunction, TracyFile, (uint32_t)TracyLine, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), TRACY_CALLSTACK, active ) #define Zo...
Since we have https://github.com/wolfpld/tracy/pull/1157, we'd better not end the macro with a semicolon
#define ZoneNamedNC( varname, name, color, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { name, TracyFunction, TracyFile, (uint32_t)TracyLine, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), TRACY_CALLSTACK, active ) #define Zo...
@@ -149,10 +149,34 @@ #define ZoneTransientN( varname, name, active ) tracy::ScopedZone varname( TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), name, strlen( name ), TRACY_CALLSTACK, active ) #define ZoneTransientNC( varname, name, color, active ) tracy::ScopedZone varname( TracyLi...
public/tracy/Tracy.hpp
26
C++
0.429
style
104
51
51
false
Suppress variable shadowing warnings
1,160
wolfpld/tracy
14,429
C++
Lectem
Voultapher
if( status != ERROR_SUCCESS ) return status; } ULONG status = SetCPUProfilingInterval(microseconds); if( status != ERROR_SUCCESS ) return status; status = EnableStackWalk( session, PerfInfoGuid, SampledProfile::Opcode ); return status; } static ULONG EnableContextSwitc...
It kind of bothers me that we mix updating session flags with EnableProvider. If the "else" is unused too, why keep it? Would it make sense to check `session.properties.EnableFlags` instead?
if( status != ERROR_SUCCESS ) return status; } ULONG status = SetCPUProfilingInterval( microseconds ); if( status != ERROR_SUCCESS ) return status; status = EnableStackWalk( session, PerfInfoGuid, SampledProfile::Opcode ); return status; } static ULONG EnableContextSwi...
@@ -453,15 +494,28 @@ static ULONG EnableCPUProfiling( Session& session, int microseconds = 125 /* 8KH static ULONG EnableContextSwitchMonitoring( Session& session ) { - ULONGLONG MatchAnyKeyword = 0; - MatchAnyKeyword |= SYSTEM_SCHEDULER_KW_CONTEXT_SWITCH; // CSwitch events - MatchAnyKeyword |= SYSTEM_SC...
public/client/windows/TracyETW.cpp
26
C++
0.571
question
193
51
51
false
Toggling EnableFlags after the "NT Kernel Logger" session has started
1,230
wolfpld/tracy
14,429
C++
Lectem
slomp
for( auto&& sw : session.stackwalk ) { if ( !IsEqualGUID( sw.EventGuid, {} ) ) continue; sw.EventGuid = EventGuid; sw.Type = Opcode; size_t count = ( &sw - session.stackwalk ) + 1; ULONG status = TraceSetInformation( session.handle, TraceStackTracingInfo, sess...
I'd rather keep this explicit or remove it.
for( auto&& sw : session.stackwalk ) { if( !IsEqualGUID( sw.EventGuid, {} ) ) continue; sw.EventGuid = EventGuid; sw.Type = Opcode; size_t count = ( &sw - session.stackwalk ) + 1; ULONG status = TraceSetInformation( session.handle, TraceStackTracingInfo, sessi...
@@ -326,7 +326,7 @@ static ULONG SetCPUProfilingInterval(int microseconds) return ETWError( status ); } -static Session StartSingletonKernelLoggerSession( ULONGLONG EnableFlags ) +static Session StartSingletonKernelLoggerSession( ULONGLONG EnableFlags = 0 )
public/client/windows/TracyETW.cpp
26
C++
0.143
suggestion
43
51
51
false
Toggling EnableFlags after the "NT Kernel Logger" session has started
1,230
wolfpld/tracy
14,429
C++
Lectem
slomp
} bool IsSingletonKernelLoggerSession( Session& session ) { bool check = true; check &= ( session.handle == 0xFFFF ); check &= ( strncmp( session.name, KERNEL_LOGGER_NAMEA, sizeof( session.name ) ) == 0 ); return check; } static ULONG UpdateSessionEnableFlags( Session& session, ULONGLONG EnableFlags )...
formatting ( `if( something )` )
} bool IsSingletonKernelLoggerSession( Session& session ) { bool check = true; check &= ( session.handle == 0xFFFF ); check &= ( strncmp( session.name, KERNEL_LOGGER_NAMEA, sizeof( session.name ) ) == 0 ); return check; } static ULONG UpdateSessionEnableFlags( Session& session, ULONGLONG EnableFlags )...
@@ -421,29 +421,70 @@ static Session StartUserSession( const CHAR* name ) return session; } +bool IsSingletonKernelLoggerSession( Session& session ) +{ + bool check = true; + check &= ( session.handle == 0xFFFF ); + check &= ( strncmp( session.name, KERNEL_LOGGER_NAMEA, sizeof( session.name ) ) == 0 );...
public/client/windows/TracyETW.cpp
26
C++
0.214
style
32
51
51
false
Toggling EnableFlags after the "NT Kernel Logger" session has started
1,230
wolfpld/tracy
14,429
C++
Lectem
slomp
ULONG status = ControlTraceA( temp.handle, temp.name, &temp.properties, EVENT_TRACE_CONTROL_UPDATE ); if (status != ERROR_SUCCESS) return ETWError(status); session.properties.EnableFlags = EnableFlags; return status; } static ULONG EnableProcessAndThreadMonitoring( Session& session ) { if (...
formatting ( `if( something )` )
ULONG status = ControlTraceA( temp.handle, temp.name, &temp.properties, EVENT_TRACE_CONTROL_UPDATE ); if( status != ERROR_SUCCESS ) return ETWError( status ); session.properties.EnableFlags = EnableFlags; return status; } static ULONG EnableProcessAndThreadMonitoring( Session& session ) { i...
@@ -421,29 +421,70 @@ static Session StartUserSession( const CHAR* name ) return session; } +bool IsSingletonKernelLoggerSession( Session& session ) +{ + bool check = true; + check &= ( session.handle == 0xFFFF ); + check &= ( strncmp( session.name, KERNEL_LOGGER_NAMEA, sizeof( session.name ) ) == 0 );...
public/client/windows/TracyETW.cpp
26
C++
0.214
style
32
51
51
false
Toggling EnableFlags after the "NT Kernel Logger" session has started
1,230
wolfpld/tracy
14,429
C++
Lectem
slomp
{ if ( IsSingletonKernelLoggerSession(session) ) { ULONGLONG EnableFlags = session.properties.EnableFlags; EnableFlags |= EVENT_TRACE_FLAG_THREAD; ULONG status = UpdateSessionEnableFlags( session, EnableFlags ); return status; } ULONGLONG MatchAnyKeyword = SYSTEM_PROCESS...
formatting ( `if( something )` )
{ if( IsSingletonKernelLoggerSession( session ) ) { ULONGLONG EnableFlags = session.properties.EnableFlags; EnableFlags |= EVENT_TRACE_FLAG_THREAD; ULONG status = UpdateSessionEnableFlags( session, EnableFlags ); return status; } ULONGLONG MatchAnyKeyword = SYSTEM_PROCES...
@@ -421,29 +421,70 @@ static Session StartUserSession( const CHAR* name ) return session; } +bool IsSingletonKernelLoggerSession( Session& session ) +{ + bool check = true; + check &= ( session.handle == 0xFFFF ); + check &= ( strncmp( session.name, KERNEL_LOGGER_NAMEA, sizeof( session.name ) ) == 0 );...
public/client/windows/TracyETW.cpp
26
C++
0.214
style
32
51
51
false
Toggling EnableFlags after the "NT Kernel Logger" session has started
1,230
wolfpld/tracy
14,429
C++
Lectem
slomp
static int GetSamplingInterval() { return GetSamplingPeriod() / 100; } static etw::Session session_kernel = {}; static etw::Session session_vsync = {}; static PROCESSTRACE_HANDLE consumer_kernel = INVALID_PROCESSTRACE_HANDLE; static PROCESSTRACE_HANDLE consumer_vsync = INVALID_PROCESSTRACE_HANDLE; static Thread* s...
formatting ( `if( something )` )
static int GetSamplingInterval() { return GetSamplingPeriod() / 100; } static etw::Session session_kernel = {}; static etw::Session session_vsync = {}; static PROCESSTRACE_HANDLE consumer_kernel = INVALID_PROCESSTRACE_HANDLE; static PROCESSTRACE_HANDLE consumer_vsync = INVALID_PROCESSTRACE_HANDLE; static Thread* s...
@@ -191,33 +191,21 @@ bool SysTraceStart( int64_t& samplingPeriod ) if ( !etw::CheckAdminPrivilege() ) return false; - ULONGLONG EnableFlags = 0; -#ifndef TRACY_NO_CONTEXT_SWITCH - EnableFlags |= EVENT_TRACE_FLAG_CSWITCH; - EnableFlags |= EVENT_TRACE_FLAG_DISPATCHER; - EnableFlags |= EVENT_T...
public/client/TracySysTrace.cpp
26
C++
0.214
style
32
51
51
false
Toggling EnableFlags after the "NT Kernel Logger" session has started
1,230
wolfpld/tracy
14,429
C++
Lectem
slomp
{ ULONGLONG EnableFlags = session.properties.EnableFlags; EnableFlags |= EVENT_TRACE_FLAG_PROFILE; ULONG status = UpdateSessionEnableFlags( session, EnableFlags ); if ( status != ERROR_SUCCESS ) return status; } else { CheckProviderSessions( SystemProf...
formatting ( `if( something )` )
{ ULONGLONG EnableFlags = session.properties.EnableFlags; EnableFlags |= EVENT_TRACE_FLAG_PROFILE; ULONG status = UpdateSessionEnableFlags( session, EnableFlags ); if( status != ERROR_SUCCESS ) return status; } else { CheckProviderSessions( SystemProfi...
@@ -453,15 +494,28 @@ static ULONG EnableCPUProfiling( Session& session, int microseconds = 125 /* 8KH static ULONG EnableContextSwitchMonitoring( Session& session ) { - ULONGLONG MatchAnyKeyword = 0; - MatchAnyKeyword |= SYSTEM_SCHEDULER_KW_CONTEXT_SWITCH; // CSwitch events - MatchAnyKeyword |= SYSTEM_SC...
public/client/windows/TracyETW.cpp
26
C++
0.214
style
32
51
51
false
Toggling EnableFlags after the "NT Kernel Logger" session has started
1,230
wolfpld/tracy
14,429
C++
Lectem
slomp
return status; } else { CheckProviderSessions( SystemProfileProviderGuid, 0 ); ULONG status = EnableProvider( session, SystemProfileProviderGuid ); if( status != ERROR_SUCCESS ) return status; } ULONG status = SetCPUProfilingInterval(microseconds); ...
So if I understand correctly, using `ControlTrace(... EVENT_TRACE_CONTROL_UPDATE)` is enough to enable the provider, but creating the session with the flags isn't?
return status; } else { CheckProviderSessions( SystemProfileProviderGuid, 0 ); ULONG status = EnableProvider( session, SystemProfileProviderGuid ); if( status != ERROR_SUCCESS ) return status; } ULONG status = SetCPUProfilingInterval( microseconds ); ...
@@ -453,15 +494,28 @@ static ULONG EnableCPUProfiling( Session& session, int microseconds = 125 /* 8KH static ULONG EnableContextSwitchMonitoring( Session& session ) { - ULONGLONG MatchAnyKeyword = 0; - MatchAnyKeyword |= SYSTEM_SCHEDULER_KW_CONTEXT_SWITCH; // CSwitch events - MatchAnyKeyword |= SYSTEM_SC...
public/client/windows/TracyETW.cpp
26
C++
0.5
question
163
51
51
false
Toggling EnableFlags after the "NT Kernel Logger" session has started
1,230
wolfpld/tracy
14,429
C++
Lectem
slomp
#include <stdint.h> #include <string.h> #include <time.h> #include "tracy_concurrentqueue.h" #include "tracy_SPSCQueue.h" #include "TracyCallstack.hpp" #include "TracyKCore.hpp" #include "TracySysPower.hpp" #include "TracySysTime.hpp" #include "TracyFastVector.hpp" #include "../common/TracyQueue.hpp" #include "../comm...
I think we need to somehow split this line to make it clear what it does.
#include <stdint.h> #include <string.h> #include <time.h> #include "tracy_concurrentqueue.h" #include "tracy_SPSCQueue.h" #include "TracyCallstack.hpp" #include "TracyKCore.hpp" #include "TracySysPower.hpp" #include "TracySysTime.hpp" #include "TracyFastVector.hpp" #include "../common/TracyQueue.hpp" #include "../comm...
@@ -28,7 +28,7 @@ # include <mach/mach_time.h> #endif -#if ( (defined _WIN32 && !(defined _M_ARM64 || defined _M_ARM)) || ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 ) || ( defined TARGET_OS_IOS && TARGET_OS_IOS == 1 ) || ( defined __APPLE__ && defined __MACH__ && TARGET_CPU_ARM64 ...
public/client/TracyProfiler.hpp
26
C++
0.214
refactor
73
51
51
false
Better support for WSL2/VMs
1,273
wolfpld/tracy
14,429
C++
wolfpld
Lectem
); fprintf( stderr, "%s\n", message ); OutputDebugStringA( message ); } void DbgHelpInit() { if( s_shouldResolveSymbolsOffline ) return; _SymAddrIncludeInlineTrace = (t_SymAddrIncludeInlineTrace)GetProcAddress(GetModuleHandleA("dbghelp.dll"), "SymAddrIncludeInlineTrace"); _SymQueryInlineTrace ...
Ok, there's a silly typo here: white-space ` ` after the `\` character `'\\ '`
); fprintf( stderr, "%s\n", message ); OutputDebugStringA( message ); } void DbgHelpInit() { if( s_shouldResolveSymbolsOffline ) return; _SymAddrIncludeInlineTrace = (t_SymAddrIncludeInlineTrace)GetProcAddress(GetModuleHandleA("dbghelp.dll"), "SymAddrIncludeInlineTrace"); _SymQueryInlineTrace ...
@@ -392,8 +408,23 @@ void DbgHelpInit() DBGHELP_LOCK; #endif - SymInitialize( GetCurrentProcess(), nullptr, true ); - SymSetOptions( SYMOPT_LOAD_LINES ); + // append executable path to the _NT_SYMBOL_PATH environment variable + char buffer [32767]; // max env var length on Windows (including null-t...
public/client/TracyCallstack.cpp
26
C++
0.357
nitpick
78
51
51
false
Ensure executable path is inspected when looking for PDB files
1,284
wolfpld/tracy
14,429
C++
slomp
slomp
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPSTR)&message[written], sizeof(message) - written, NULL ); fprintf( stderr, "%s\n", message ); OutputDebugStringA( message ); } void DbgHelpInit() { if( s_shouldResolveSymbolsOffline ) return; _SymAddrIncludeInlineTrac...
Even though a 32K env var is unlikely to happen in practice, I should do some proper length check to avoid potential attacks...
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPSTR)&message[written], sizeof(message) - written, NULL ); fprintf( stderr, "%s\n", message ); OutputDebugStringA( message ); } void DbgHelpInit() { if( s_shouldResolveSymbolsOffline ) return; _SymAddrIncludeInlineTrac...
@@ -392,8 +408,23 @@ void DbgHelpInit() DBGHELP_LOCK; #endif - SymInitialize( GetCurrentProcess(), nullptr, true ); - SymSetOptions( SYMOPT_LOAD_LINES ); + // append executable path to the _NT_SYMBOL_PATH environment variable + char buffer [32767]; // max env var length on Windows (including null-t...
public/client/TracyCallstack.cpp
26
C++
0.429
suggestion
127
51
51
false
Ensure executable path is inspected when looking for PDB files
1,284
wolfpld/tracy
14,429
C++
slomp
slomp
{ uint32_t id; int active; }; // Some containers don't support storing const types. // This struct, as visible to user, is immutable, so treat it as if const was declared here. typedef /*const*/ struct ___tracy_c_zone_context TracyCZoneCtx; TRACY_API void ___tracy_init_thread(void); TRACY_API uint64_t ___trac...
No issues found.
{ uint32_t id; int active; }; // Some containers don't support storing const types. // This struct, as visible to user, is immutable, so treat it as if const was declared here. typedef /*const*/ struct ___tracy_c_zone_context TracyCZoneCtx; TRACY_API void ___tracy_init_thread(void); TRACY_API uint64_t ___trac...
@@ -81,6 +81,7 @@ struct ___tracy_c_zone_context // This struct, as visible to user, is immutable, so treat it as if const was declared here. typedef /*const*/ struct ___tracy_c_zone_context TracyCZoneCtx; +TRACY_API void ___tracy_init_thread(void); TRACY_API uint64_t ___tracy_alloc_srcloc( uint32_t line, const ch...
TracyC.h
0
C/C++
1
none
16
51
51
true
Add ___tracy_init_thread function
52
wolfpld/tracy
14,429
C++
nagisa
tracy_free( m_sock ); } } #endif } // End of connections loop // Client is exiting. Send items remaining in queues. for(;;) { const auto status = Dequeue( token ); const auto serialStatus = DequeueSerial(); if( status == DequeueStatus::Con...
No issues found.
tracy_free( m_sock ); } } #endif } // End of connections loop // Client is exiting. Send items remaining in queues. for(;;) { const auto status = Dequeue( token ); const auto serialStatus = DequeueSerial(); if( status == DequeueStatus::Con...
@@ -3065,8 +3065,14 @@ TRACY_API void ___tracy_emit_messageL( const char* txt, int callstack ) { tracy: TRACY_API void ___tracy_emit_messageC( const char* txt, size_t size, uint32_t color, int callstack ) { tracy::Profiler::MessageColor( txt, size, color, callstack ); } TRACY_API void ___tracy_emit_messageLC( const c...
client/TracyProfiler.cpp
0
C++
1
none
16
51
51
true
`___tracy_alloc_*` take pointer-size pairs
55
wolfpld/tracy
14,429
C++
nagisa
// Some containers don't support storing const types. // This struct, as visible to user, is immutable, so treat it as if const was declared here. typedef /*const*/ struct ___tracy_c_zone_context TracyCZoneCtx; TRACY_API void ___tracy_init_thread(void); TRACY_API uint64_t ___tracy_alloc_srcloc( uint32_t line, const c...
No issues found.
// Some containers don't support storing const types. // This struct, as visible to user, is immutable, so treat it as if const was declared here. typedef /*const*/ struct ___tracy_c_zone_context TracyCZoneCtx; TRACY_API void ___tracy_init_thread(void); TRACY_API uint64_t ___tracy_alloc_srcloc( uint32_t line, const c...
@@ -168,6 +168,10 @@ TRACY_API void ___tracy_emit_message_appinfo( const char* txt, size_t size ); #define TracyCPlot( name, val ) ___tracy_emit_plot( name, val ); #define TracyCAppInfo( txt, color ) ___tracy_emit_message_appinfo( txt, color ); +TRACY_API void ___tracy_set_thread_name( const char* name ); + +#defin...
TracyC.h
0
C/C++
1
none
16
51
51
true
Add set thread name to C API
83
wolfpld/tracy
14,429
C++
zanshi
cs_insn* insn; size_t cnt = cs_disasm( handle, (const uint8_t*)code, sz, ptr, 0, &insn ); if( cnt > 0 ) { m_pendingCodeInformation += cnt; for( size_t i=0; i<cnt; i++ ) { Query( ServerQueryCodeLocation, insn[i].address ); } cs_free( insn, cnt ); } ...
No issues found.
cs_insn* insn; size_t cnt = cs_disasm( handle, (const uint8_t*)code, sz, ptr, 0, &insn ); if( cnt > 0 ) { m_pendingCodeInformation += cnt; for( size_t i=0; i<cnt; i++ ) { Query( ServerQueryCodeLocation, insn[i].address ); } cs_free( insn, cnt ); } ...
@@ -4116,6 +4116,9 @@ bool Worker::Process( const QueueItem& ev ) case QueueType::ZoneName: ProcessZoneName(); break; + case QueueType::ZoneColor: + ProcessZoneColor( ev.zoneColor ); + break; case QueueType::ZoneValue: ProcessZoneValue( ev.zoneValue ); brea...
server/TracyWorker.cpp
0
C++
1
none
16
51
51
true
Adding ZoneColor to set a dynamic color override to an existing zone.
137
wolfpld/tracy
14,429
C++
benvanik
struct THREADNAME_INFO { DWORD dwType; LPCSTR szName; DWORD dwThreadID; DWORD dwFlags; }; # pragma pack(pop) DWORD ThreadId = GetCurrentThreadId(); THREADNAME_INFO info; info.dwType = 0x1000; info.szName = name; ...
No issues found.
struct THREADNAME_INFO { DWORD dwType; LPCSTR szName; DWORD dwThreadID; DWORD dwFlags; }; # pragma pack(pop) DWORD ThreadId = GetCurrentThreadId(); THREADNAME_INFO info; info.dwType = 0x1000; info.szName = name; ...
@@ -11,6 +11,7 @@ #endif #if defined _WIN32 || defined __CYGWIN__ # include <windows.h> +# include <malloc.h> #else # include <pthread.h> # include <string.h> @@ -236,6 +237,38 @@ TRACY_API const char* GetThreadName( uint64_t id ) return buf; } +TRACY_API const char* GetEnvVar( const char* name ) +{ +...
common/TracySystem.cpp
0
C++
1
none
16
51
51
true
Windows getenv fix
195
wolfpld/tracy
14,429
C++
jkriegshauser
}; enum { MemEventSize = sizeof( MemEvent ) }; static_assert( std::is_standard_layout<MemEvent>::value, "MemEvent is not standard layout" ); struct CallstackFrameBasic { StringIdx name; StringIdx file; uint32_t line; }; struct CallstackFrame : public CallstackFrameBasic { uint64_t symAddr; }; struc...
No issues found.
}; enum { MemEventSize = sizeof( MemEvent ) }; static_assert( std::is_standard_layout<MemEvent>::value, "MemEvent is not standard layout" ); struct CallstackFrameBasic { StringIdx name; StringIdx file; uint32_t line; }; struct CallstackFrame : public CallstackFrameBasic { uint64_t symAddr; }; struc...
@@ -587,12 +587,57 @@ enum { GhostZoneSize = sizeof( GhostZone ) }; #pragma pack() +using SrcLocCountMap = unordered_flat_map<int16_t, size_t>; + +static tracy_force_inline void IncSrcLocCount( SrcLocCountMap& countMap, int16_t srcloc ) +{ + const auto it = countMap.find( srcloc ); + if( it == countMap.end()...
server/TracyEvent.hpp
0
C++
1
none
16
51
51
true
Introduce "non-reentrant time" statistics view
230
wolfpld/tracy
14,429
C++
rokopt
uint8_t context; const char* name; uint16_t len; }; // Some containers don't support storing const types. // This struct, as visible to user, is immutable, so treat it as if const was declared here. typedef /*const*/ struct ___tracy_c_zone_context TracyCZoneCtx; #ifdef TRACY_MANUAL_LIFETIME TRACY_API voi...
No issues found.
uint8_t context; const char* name; uint16_t len; }; // Some containers don't support storing const types. // This struct, as visible to user, is immutable, so treat it as if const was declared here. typedef /*const*/ struct ___tracy_c_zone_context TracyCZoneCtx; #ifdef TRACY_MANUAL_LIFETIME TRACY_API voi...
@@ -97,6 +97,38 @@ struct ___tracy_c_zone_context int active; }; +struct ___tracy_gpu_time_data +{ + int64_t gpuTime; + uint16_t queryId; + uint8_t context; +}; + +struct ___tracy_gpu_zone_begin_data { + uint64_t srcloc; + uint16_t queryId; + uint8_t context; +}; + +struct ___tracy_gpu_zone_en...
TracyC.h
0
C/C++
1
none
16
51
51
true
Implement a bare-bones C API for graphics profiling
283
wolfpld/tracy
14,429
C++
expenses
case QueueType::ZoneBeginAllocSrcLocCallstack: ptr = MemRead<uint64_t>( &item.zoneBegin.srcloc ); tracy_free( (void*)ptr ); break; case QueueType::GpuZoneBeginAllocSrcLoc: case QueueType::GpuZoneBeginAllocSrcLocCallstack: case QueueType::GpuZoneBeginAllocSrcLocSerial: case Qu...
No issues found.
case QueueType::ZoneBeginAllocSrcLocCallstack: ptr = MemRead<uint64_t>( &item.zoneBegin.srcloc ); tracy_free( (void*)ptr ); break; case QueueType::GpuZoneBeginAllocSrcLoc: case QueueType::GpuZoneBeginAllocSrcLocCallstack: case QueueType::GpuZoneBeginAllocSrcLocSerial: case Qu...
@@ -4157,6 +4157,11 @@ TRACY_API void ___tracy_emit_gpu_context_name_serial( const struct ___tracy_gpu_ tracy::Profiler::QueueSerialFinish(); } +#ifdef TRACY_FIBERS +TRACY_API void ___tracy_fiber_enter( const char* fiber ){ tracy::Profiler::EnterFiber( fiber ); } +TRACY_API void ___tracy_fiber_leave( void ){ tr...
client/TracyProfiler.cpp
0
C++
1
none
16
51
51
true
Add fibers to TracyC.h
288
wolfpld/tracy
14,429
C++
slembcke
#ifndef __TRACYUWP_HPP__ #define __TRACYUWP_HPP__ #ifdef _WIN32 # include <winapifamily.h> # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) # define TRACY_UWP # endif #endif #endif
No issues found.
#ifndef __TRACYUWP_HPP__ #define __TRACYUWP_HPP__ #ifdef _WIN32 # include <winapifamily.h> # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) # define TRACY_UWP # endif #endif #endif
@@ -0,0 +1,11 @@ +#ifndef __TRACYUWP_HPP__ +#define __TRACYUWP_HPP__ + +#ifdef _WIN32 +# include <winapifamily.h> +# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +# define TRACY_UWP +# endif +#endif + +#endif
common/TracyUwp.hpp
0
C++
1
none
16
12
12
true
Make Tracy usable in UWP applications
324
wolfpld/tracy
14,429
C++
Kova93
ServerQueryPlotName, ServerQueryFrameName, ServerQueryParameter, ServerQueryFiberName, // Items above are high priority. Split order must be preserved. See IsQueryPrio(). ServerQueryDisconnect, ServerQueryCallstackFrame, ServerQueryExternalName, ServerQuerySymbol, ServerQuerySymb...
No issues found.
ServerQueryPlotName, ServerQueryFrameName, ServerQueryParameter, ServerQueryFiberName, // Items above are high priority. Split order must be preserved. See IsQueryPrio(). ServerQueryDisconnect, ServerQueryCallstackFrame, ServerQueryExternalName, ServerQuerySymbol, ServerQuerySymb...
@@ -34,7 +34,7 @@ enum HandshakeStatus : uint8_t enum { WelcomeMessageProgramNameSize = 64 }; enum { WelcomeMessageHostInfoSize = 1024 }; -#pragma pack( 1 ) +#pragma pack( push, 1 ) // Must increase left query space after handling! enum ServerQuery : uint8_t @@ -133,7 +133,7 @@ struct BroadcastMessage enum {...
public/common/TracyProtocol.hpp
0
C++
1
none
16
51
51
true
Using push/pop in all pragma pack pair to avoid potential padding bugs
440
wolfpld/tracy
14,429
C++
Danielmelody
static const char* DecodeContextSwitchReason( uint8_t reason ); static const char* DecodeContextSwitchReasonCode( uint8_t reason ); Worker m_worker; std::string m_filename, m_filenameStaging; bool m_staticView; ViewMode m_viewMode; bool m_viewModeHeuristicTry = false; DecayValue<bool> m...
No issues found.
static const char* DecodeContextSwitchReason( uint8_t reason ); static const char* DecodeContextSwitchReasonCode( uint8_t reason ); Worker m_worker; std::string m_filename, m_filenameStaging; bool m_staticView; ViewMode m_viewMode; bool m_viewModeHeuristicTry = false; DecayValue<bool> m...
@@ -457,6 +457,8 @@ class View ImGuiTextFilter m_statisticsFilter; ImGuiTextFilter m_statisticsImageFilter; + ImGuiTextFilter m_userTextFilter; + unordered_flat_set<Worker::ZoneThreadData*> m_filteredZones; Region m_highlight; Region m_highlightZoom;
server/TracyView.hpp
0
C++
1
none
16
51
51
true
allow filtering zones in Zone finder based on the user text
557
wolfpld/tracy
14,429
C++
KristofferC
static auto _SetThreadDescription = (t_SetThreadDescription)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "SetThreadDescription" ); # endif if( _SetThreadDescription ) { wchar_t buf[256]; mbstowcs( buf, name, 256 ); _SetThreadDescription( GetCurrentThread(), buf ); } e...
No issues found.
static auto _SetThreadDescription = (t_SetThreadDescription)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "SetThreadDescription" ); # endif if( _SetThreadDescription ) { wchar_t buf[256]; mbstowcs( buf, name, 256 ); _SetThreadDescription( GetCurrentThread(), buf ); } e...
@@ -28,6 +28,9 @@ # include <sys/thr.h> #elif defined __NetBSD__ || defined __DragonFly__ # include <sys/lwp.h> +#elif defined __QNX__ +# include <process.h> +# include <sys/neutrino.h> #endif #ifdef __MINGW32__ @@ -78,6 +81,8 @@ TRACY_API uint32_t GetThreadHandleImpl() return lwp_gettid(); #elif defin...
public/common/TracySystem.cpp
0
C++
1
none
16
51
51
true
Add basic QNX support
649
wolfpld/tracy
14,429
C++
michaeldleslie
uint32_t line; uint32_t symLen; uint64_t symAddr; }; struct CallstackEntryData { const CallstackEntry* data; uint8_t size; const char* imageName; }; CallstackSymbolData DecodeSymbolAddress( uint64_t ptr ); const char* DecodeCallstackPtrFast( uint64_t ptr ); CallstackEntryData DecodeCallstackPt...
No issues found.
uint32_t line; uint32_t symLen; uint64_t symAddr; }; struct CallstackEntryData { const CallstackEntry* data; uint8_t size; const char* imageName; }; CallstackSymbolData DecodeSymbolAddress( uint64_t ptr ); const char* DecodeCallstackPtrFast( uint64_t ptr ); CallstackEntryData DecodeCallstackPt...
@@ -8,10 +8,15 @@ #if TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 5 # include <unwind.h> #elif TRACY_HAS_CALLSTACK >= 3 -# include <execinfo.h> +# ifdef TRACE_CLIENT_LIBUNWIND_BACKTRACE + // libunwind is, in general, significantly faster than execinfo based backtraces +# define UNW_LOCAL_ONLY +# ...
public/client/TracyCallstack.hpp
0
C++
1
none
16
51
51
true
Add support for using using libunwind
657
wolfpld/tracy
14,429
C++
tiago-rodrigues
if (!add_range (state, rdata, low + base_address, high + base_address, error_callback, data, vec)) return 0; } break; case DW_RLE_start_length: { uintptr_t low; uintptr_t length; low = (uintptr_t) read_address (&rnglists_buf, u->addrsize); length = (uintptr_t) r...
No issues found.
if (!add_range (state, rdata, low + base_address, high + base_address, error_callback, data, vec)) return 0; } break; case DW_RLE_start_length: { uintptr_t low; uintptr_t length; low = (uintptr_t) read_address (&rnglists_buf, u->addrsize); length = (uintptr_t) r...
@@ -4251,6 +4251,19 @@ dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata, } } +bool dwarf_fileline_dwarf_lookup_pc_in_all_entries(struct backtrace_state *state, uintptr_t pc, + backtrace_full_callback callback, backtrace_error_callback error_callback, void *data, + int& found, int...
public/libbacktrace/dwarf.cpp
0
C++
1
none
16
51
51
true
Add image cache to avoid calling dladdr() and add libbacktrace elf image list refresh
674
wolfpld/tracy
14,429
C++
tiago-rodrigues
#endif TracyLfqCommit; } static tracy_force_inline void MemAlloc( const void* ptr, size_t size, bool secure ) { if( secure && !ProfilerAvailable() ) return; #ifdef TRACY_ON_DEMAND if( !GetProfiler().IsConnected() ) return; #endif const auto thread = GetThreadHandle(); ...
No issues found.
#endif TracyLfqCommit; } static tracy_force_inline void MemAlloc( const void* ptr, size_t size, bool secure ) { if( secure && !ProfilerAvailable() ) return; #ifdef TRACY_ON_DEMAND if( !GetProfiler().IsConnected() ) return; #endif const auto thread = GetThreadHandle(); ...
@@ -741,29 +741,29 @@ class Profiler // 1b null terminator // nsz zone name (optional) - static tracy_force_inline uint64_t AllocSourceLocation( uint32_t line, const char* source, const char* function ) + static tracy_force_inline uint64_t AllocSourceLocation( uint32_t line, const char* source, con...
public/client/TracyProfiler.hpp
0
C++
1
none
16
51
51
true
Add support to set color when creating a ScopedZone
755
wolfpld/tracy
14,429
C++
Chekov2k
const auto indentVal = sin( time * 60.f ) * 10.f * time; ImGui::SameLine( 0, ImGui::GetStyle().ItemSpacing.x + indentVal ); } else { ImGui::SameLine(); ...
No issues found.
const auto indentVal = sin( time * 60.f ) * 10.f * time; ImGui::SameLine( 0, ImGui::GetStyle().ItemSpacing.x + indentVal ); } else { ImGui::SameLine(); ...
@@ -541,6 +541,12 @@ void View::DrawOptions() val = m_vd.drawPlots; ImGui::Checkbox( ICON_FA_SIGNATURE " Draw plots", &val ); m_vd.drawPlots = val; + + ImGui::SameLine(); + int pH = m_vd.plotHeight; + ImGui::SliderInt("Plot heights", &pH, 30, 200); + m_vd.plotHeigh...
profiler/src/profiler/TracyView_Options.cpp
0
C++
1
none
16
51
51
true
Support adjusting plot height.
786
wolfpld/tracy
14,429
C++
mcourteaux
static const char* DecodeContextSwitchState( uint8_t state ); static const char* DecodeContextSwitchStateCode( uint8_t state ); static const char* DecodeContextSwitchReason( uint8_t reason ); static const char* DecodeContextSwitchReasonCode( uint8_t reason ); Worker m_worker; std::string m_file...
No issues found.
static const char* DecodeContextSwitchState( uint8_t state ); static const char* DecodeContextSwitchStateCode( uint8_t state ); static const char* DecodeContextSwitchReason( uint8_t reason ); static const char* DecodeContextSwitchReasonCode( uint8_t reason ); Worker m_worker; std::string m_file...
@@ -667,6 +667,7 @@ class View size_t sortedNum = 0, selSortNum, selSortActive; float average, selAverage; float median, selMedian; + float p75, p90; int64_t total, selTotal; int64_t selTime; bool drawAvgMed = true; @@ -710,6 +711,8 @@ class View ...
profiler/src/profiler/TracyView.hpp
0
C++
1
none
16
51
51
true
Percentiles p75, p90 for FindZone view
926
wolfpld/tracy
14,429
C++
WernherVonData
break; case QueueType::Message: case QueueType::MessageCallstack: ptr = MemRead<uint64_t>( &item->messageFat.text ); size = MemRead<uint16_t>( &item->messageFat.size ); SendSingleStrin...
No issues found.
break; case QueueType::Message: case QueueType::MessageCallstack: ptr = MemRead<uint64_t>( &item->messageFat.text ); size = MemRead<uint16_t>( &item->messageFat.size ); SendSingleStrin...
@@ -9,7 +9,7 @@ # include <tlhelp32.h> # include <inttypes.h> # include <intrin.h> -# include "../common/TracyUwp.hpp" +# include "../common/TracyWinFamily.hpp" # ifndef _MSC_VER # include <excpt.h> # endif @@ -327,7 +327,13 @@ static inline void CpuId( uint32_t* regs, uint32_t leaf ) static void Ini...
public/client/TracyProfiler.cpp
0
C++
1
none
16
51
51
true
Add GDK platform support
1,099
wolfpld/tracy
14,429
C++
pkraif
const char* file; uint32_t line; bool needFree; uint64_t symAddr; }; struct CallstackEntry { const char* name; const char* file; uint32_t line; uint32_t symLen; uint64_t symAddr; }; struct CallstackEntryData { const CallstackEntry* data; uint8_t size; const char* imageN...
No issues found.
const char* file; uint32_t line; bool needFree; uint64_t symAddr; }; struct CallstackEntry { const char* name; const char* file; uint32_t line; uint32_t symLen; uint64_t symAddr; }; struct CallstackEntryData { const CallstackEntry* data; uint8_t size; const char* imageN...
@@ -1,10 +1,25 @@ #ifndef __TRACYCALLSTACK_HPP__ #define __TRACYCALLSTACK_HPP__ +#include <stdint.h> + #include "../common/TracyApi.h" #include "../common/TracyForceInline.hpp" #include "TracyCallstack.h" +namespace tracy +{ + +struct ImageEntry +{ + uint64_t m_startAddress = 0; + uint64_t m_endAddress =...
public/client/TracyCallstack.hpp
0
C++
1
none
16
51
51
true
Unify module caches
1,120
wolfpld/tracy
14,429
C++
Lectem
struct ___tracy_gpu_new_context_data { int64_t gpuTime; float period; uint8_t context; uint8_t flags; uint8_t type; }; struct ___tracy_gpu_context_name_data { uint8_t context; const char* name; uint16_t len; }; struct ___tracy_gpu_calibration_data { int64_t gpuTime; int64_t cp...
No issues found.
struct ___tracy_gpu_new_context_data { int64_t gpuTime; float period; uint8_t context; uint8_t flags; uint8_t type; }; struct ___tracy_gpu_context_name_data { uint8_t context; const char* name; uint16_t len; }; struct ___tracy_gpu_calibration_data { int64_t gpuTime; int64_t cp...
@@ -114,6 +114,9 @@ typedef const void* TracyCLockCtx; #define TracyCIsConnected 0 #define TracyCIsStarted 0 +#define TracyCBeginSamplingProfiling() 0 +#define TracyCEndSamplingProfiling() + #ifdef TRACY_FIBERS # define TracyCFiberEnter(fiber) # define TracyCFiberLeave @@ -367,6 +370,12 @@ TRACY_API void ___tr...
public/tracy/TracyC.h
0
C/C++
1
none
16
51
51
true
Option to manually control sampling profiling
1,126
wolfpld/tracy
14,429
C++
slomp
if( ini_sget( ini, "timeline", "dynamicColors", "%d", &v ) ) s_config.dynamicColors = v; if( ini_sget( ini, "timeline", "forceColors", "%d", &v ) ) s_config.forceColors = v; if( ini_sget( ini, "timeline", "ghostZones", "%d", &v ) ) s_config.ghostZones = v; if( ini_sget( ini, "timeline", "shortenName", "...
No issues found.
if( ini_sget( ini, "timeline", "dynamicColors", "%d", &v ) ) s_config.dynamicColors = v; if( ini_sget( ini, "timeline", "forceColors", "%d", &v ) ) s_config.forceColors = v; if( ini_sget( ini, "timeline", "ghostZones", "%d", &v ) ) s_config.ghostZones = v; if( ini_sget( ini, "timeline", "shortenName", "...
@@ -23,9 +23,14 @@ void LoadConfig() if( ini_sget( ini, "core", "threadedRendering", "%d", &v ) ) s_config.threadedRendering = v; if( ini_sget( ini, "core", "focusLostLimit", "%d", &v ) ) s_config.focusLostLimit = v; if( ini_sget( ini, "timeline", "targetFps", "%d", &v ) && v >= 1 && v < 10000 ) s_config...
profiler/src/profiler/TracyConfig.cpp
0
C++
1
none
16
51
51
true
Configuration of defaults.
1,140
wolfpld/tracy
14,429
C++
mcourteaux
// CPU cycles + instructions retired pe = {}; pe.type = PERF_TYPE_HARDWARE; pe.size = sizeof( perf_event_attr ); pe.sample_freq = 5000; pe.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TIME; pe.disabled = 1; pe.exclude_kernel = 1; pe.exclude_guest = 1; pe.exclude_hv = 1; pe.fre...
No issues found.
// CPU cycles + instructions retired pe = {}; pe.type = PERF_TYPE_HARDWARE; pe.size = sizeof( perf_event_attr ); pe.sample_freq = 5000; pe.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TIME; pe.disabled = 1; pe.exclude_kernel = 1; pe.exclude_guest = 1; pe.exclude_hv = 1; pe.fre...
@@ -596,6 +596,15 @@ bool SysTraceStart( int64_t& samplingPeriod ) TracyDebug( "sched_waking id: %i", wakingId ); TracyDebug( "drm_vblank_event id: %i", vsyncId ); + bool useMonotonicClockRaw = !HardwareSupportsInvariantTSC(); +#if !defined TRACY_HW_TIMER || !defined TRACY_HAS_RDTSC + useMonotonicCloc...
public/client/TracySysTrace.cpp
0
C++
1
none
16
51
51
true
Better support for WSL2/VMs
1,273
wolfpld/tracy
14,429
C++
Lectem
package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color import kotlin.math.* /** * Created by mike on 31/07/2017. */ object BlurHashDecoder { private val digitCharacters = arrayOf( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '...
Its Kotlin, so `kotlin.math` should be used
package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color import kotlin.math.* /** * Created by mike on 31/07/2017. */ object BlurHashDecoder { val MAX_SIZE = 20 private val digitCharacters = arrayOf( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B'...
@@ -2,7 +2,7 @@ package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color -import java.lang.Math.* +import kotlin.math.*
Kotlin/lib/src/main/java/com/wolt/blurhashkt/BlurHashDecoder.kt
5
Kotlin
0.286
suggestion
43
30
30
false
fix warnings in BlurHashDecoder.kt
2
woltapp/blurhash
6,602
C
connyduck
connyduck
private val digitCharacters = arrayOf( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l...
fail early - move the computations that are not needed to detect this case down
val MAX_SIZE = 20 private val digitCharacters = arrayOf( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g',...
@@ -32,14 +30,14 @@ object BlurHashDecoder { val numY = (sizeFlag / 9) + 1 val numX = (sizeFlag % 9) + 1 - val quantisedMaximumValue = blurHash[1].toString().decode83() - val maximumValue = (quantisedMaximumValue + 1) / 166f - if (blurHash.length != 4 + 2 * numX * numY) { ...
Kotlin/lib/src/main/java/com/wolt/blurhashkt/BlurHashDecoder.kt
26
Kotlin
0.286
bug
79
51
51
false
fix warnings in BlurHashDecoder.kt
2
woltapp/blurhash
6,602
C
connyduck
connyduck
private fun decodeDc(value: Int): Array<Float> { val intR = value shr 16 val intG = (value shr 8) and 255 val intB = value and 255 return arrayOf(sRgbToLinear(intR), sRgbToLinear(intG), sRgbToLinear(intB)) } private fun sRgbToLinear(value: Int): Float { val v = value...
`abs()` is not needed. Yes, the sign may be different after the `pow`, but `withSign` (Kotlin for `copySign`) changes it again anyway.
} private fun decodeDc(value: Int): Array<Float> { val intR = value shr 16 val intG = (value shr 8) and 255 val intB = value and 255 return arrayOf(sRgbToLinear(intR), sRgbToLinear(intG), sRgbToLinear(intB)) } private fun sRgbToLinear(value: Int): Float { val v ...
@@ -94,30 +91,30 @@ object BlurHashDecoder { return arrayOf(sRgbToLinear(intR), sRgbToLinear(intG), sRgbToLinear(intB)) } - fun sRgbToLinear(value: Int): Float { + private fun sRgbToLinear(value: Int): Float { val v = value / 255f - return if (v <= 0.04045) (v / 12.92f) else (pow((...
Kotlin/lib/src/main/java/com/wolt/blurhashkt/BlurHashDecoder.kt
26
Kotlin
0.571
suggestion
134
36
38
false
fix warnings in BlurHashDecoder.kt
2
woltapp/blurhash
6,602
C
connyduck
connyduck
for (y in 0 until height) { for (x in 0 until width) { var r = 0f var g = 0f var b = 0f for (j in 0 until numY) { for (i in 0 until numX) { val basis = (cos(PI * x * i / width) * cos(PI * y *...
What is it suppressing? I can remove this line without getting more warnings.
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888) for (y in 0 until height) { for (x in 0 until width) { var r = 0f var g = 0f var b = 0f for (j in 0 until numY) { for (i in 0 until n...
@@ -75,10 +73,9 @@ object BlurHashDecoder { return bitmap } - @Suppress("LoopToCallChain")
Kotlin/lib/src/main/java/com/wolt/blurhashkt/BlurHashDecoder.kt
26
Kotlin
0.286
refactor
77
51
51
false
fix warnings in BlurHashDecoder.kt
2
woltapp/blurhash
6,602
C
connyduck
connyduck
package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color import java.util.* import kotlin.math.cos import kotlin.math.pow import kotlin.math.withSign // this is to optimize the number of calculations for "Math.cos()", // is is slow and for many images with same size it can be cached, i...
Why would you decode to an image that big? From the README: > We usually decode placeholders that are 32 or even 20 pixels wide, and then let the UI layer scale them up I would love to see a more elaborate benchmark that shows its faster, because that caching mechanism adds overhead as well and may led to cache mis...
package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color import kotlin.math.cos import kotlin.math.pow import kotlin.math.withSign object BlurHashDecoder { // cache Math.cos() calculations to improve performance. // The number of calculations can be huge for many bitmaps: widt...
@@ -2,13 +2,21 @@ package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color -import kotlin.math.PI +import java.util.* import kotlin.math.cos import kotlin.math.pow import kotlin.math.withSign +// this is to optimize the number of calculations for "Math.cos()", +// is is slow and...
Kotlin/lib/src/main/java/com/wolt/blurhashkt/BlurHashDecoder.kt
12
Kotlin
0.5
performance
369
37
37
false
Kotlin optimize
66
woltapp/blurhash
6,602
C
connyduck
ignaciotcrespo
package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color import java.util.* import kotlin.math.cos import kotlin.math.pow import kotlin.math.withSign // this is to optimize the number of calculations for "Math.cos()", // is is slow and for many images with same size it can be cached, i...
It doesn't really matter in this case since its Android anyway (and only a constant), but in general its better to use Kotlin math in Kotlin code, by removing the import you are using Java.
package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color import kotlin.math.cos import kotlin.math.pow import kotlin.math.withSign object BlurHashDecoder { // cache Math.cos() calculations to improve performance. // The number of calculations can be huge for many bitmaps: widt...
@@ -2,13 +2,21 @@ package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color -import kotlin.math.PI
Kotlin/lib/src/main/java/com/wolt/blurhashkt/BlurHashDecoder.kt
5
Kotlin
0.429
suggestion
189
30
30
false
Kotlin optimize
66
woltapp/blurhash
6,602
C
connyduck
ignaciotcrespo
package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color import java.util.* import kotlin.math.cos import kotlin.math.pow import kotlin.math.withSign // this is to optimize the number of calculations for "Math.cos()", // is is slow and for many images with same size it can be cached, i...
you don't need that import, Kotlin has typaliases for `HashMap`
package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color import kotlin.math.cos import kotlin.math.pow import kotlin.math.withSign object BlurHashDecoder { // cache Math.cos() calculations to improve performance. // The number of calculations can be huge for many bitmaps: widt...
@@ -2,13 +2,21 @@ package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color -import kotlin.math.PI +import java.util.*
Kotlin/lib/src/main/java/com/wolt/blurhashkt/BlurHashDecoder.kt
5
Kotlin
0.357
suggestion
63
30
30
false
Kotlin optimize
66
woltapp/blurhash
6,602
C
connyduck
ignaciotcrespo
package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color import java.util.* import kotlin.math.cos import kotlin.math.pow import kotlin.math.withSign // this is to optimize the number of calculations for "Math.cos()", // is is slow and for many images with same size it can be cached, i...
I don't think this flag is needed.
package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color import kotlin.math.cos import kotlin.math.pow import kotlin.math.withSign object BlurHashDecoder { // cache Math.cos() calculations to improve performance. // The number of calculations can be huge for many bitmaps: widt...
@@ -2,13 +2,21 @@ package com.wolt.blurhashkt import android.graphics.Bitmap import android.graphics.Color -import kotlin.math.PI +import java.util.* import kotlin.math.cos import kotlin.math.pow import kotlin.math.withSign +// this is to optimize the number of calculations for "Math.cos()", +// is is slow and...
Kotlin/lib/src/main/java/com/wolt/blurhashkt/BlurHashDecoder.kt
13
Kotlin
0.071
suggestion
35
38
38
false
Kotlin optimize
66
woltapp/blurhash
6,602
C
connyduck
ignaciotcrespo