Skip to content

Commit

Permalink
deps: Upgrade LibTracyClient to 0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
topolarity committed Apr 6, 2023
1 parent 9ca700e commit 1526534
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 34 deletions.
12 changes: 6 additions & 6 deletions deps/libtracyclient.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LIBTRACYCLIENT_CMAKE :=
LIBTRACYCLIENT_CMAKE += -DBUILD_SHARED_LIBS=ON
LIBTRACYCLIENT_CMAKE += -DTRACY_FIBERS=ON
LIBTRACYCLIENT_CMAKE += -DTRACY_NO_BROADCAST=ON
LIBTRACYCLIENT_CMAKE += -DTRACY_NO_SYSTEM_TRACING=ON
LIBTRACYCLIENT_CMAKE += -DTRACY_NO_SAMPLING=ON
LIBTRACYCLIENT_CMAKE += -DTRACY_ONLY_LOCALHOST=ON
LIBTRACYCLIENT_CMAKE += -DTRACY_NO_CODE_TRANSFER=ON
LIBTRACYCLIENT_CMAKE += -DTRACY_NO_FRAME_IMAGE=ON
Expand All @@ -31,17 +31,17 @@ $(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-freebsd-elfw.patch-applied: $(LIBTRACY
patch -p1 -f < $(SRCDIR)/patches/libTracyClient-freebsd-elfw.patch
echo 1 > $@

$(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-no-crash-handler.patch-applied: $(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-freebsd-elfw.patch-applied
$(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-no-sampling.patch-applied: $(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-freebsd-elfw.patch-applied
cd $(LIBTRACYCLIENT_BUILDDIR) && \
patch -p1 -f < $(SRCDIR)/patches/libTracyClient-no-crash-handler.patch
patch -p1 -f < $(SRCDIR)/patches/libTracyClient-no-sampling.patch
echo 1 > $@

$(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-config-plots.patch-applied: $(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-no-crash-handler.patch-applied
$(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-plot-config.patch-applied: $(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-no-sampling.patch-applied
cd $(LIBTRACYCLIENT_BUILDDIR) && \
patch -p1 -f < $(SRCDIR)/patches/libTracyClient-config-plots.patch
patch -p1 -f < $(SRCDIR)/patches/libTracyClient-plot-config.patch
echo 1 > $@

$(LIBTRACYCLIENT_BUILDDIR)/build-configured: $(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-config-plots.patch-applied
$(LIBTRACYCLIENT_BUILDDIR)/build-configured: $(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-plot-config.patch-applied
mkdir -p $(dir $@)
cd $(dir $@) && \
$(CMAKE) . $(CMAKE_GENERATOR_COMMAND) $(CMAKE_COMMON) $(LIBTRACYCLIENT_CMAKE) \
Expand Down
8 changes: 4 additions & 4 deletions deps/libtracyclient.version
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## jll artifact
LIBTRACYCLIENT_JLL_NAME := LibTracyClient
LIBTRACYCLIENT_JLL_VER := 0.9.0+1
LIBTRACYCLIENT_JLL_VER := 0.9.1+0

## source build
LIBTRACYCLIENT_VER := 0.9.0
LIBTRACYCLIENT_BRANCH=v0.9
LIBTRACYCLIENT_SHA1=5a1f5371b792c12aea324213e1dc738b2923ae21
LIBTRACYCLIENT_VER := 0.9.1
LIBTRACYCLIENT_BRANCH=v0.9.1
LIBTRACYCLIENT_SHA1=897aec5b062664d2485f4f9a213715d2e527e0ca
21 changes: 0 additions & 21 deletions deps/patches/libTracyClient-no-crash-handler.patch

This file was deleted.

79 changes: 79 additions & 0 deletions deps/patches/libTracyClient-no-sampling.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
commit 6249999153a9497b32bc84e9dc95a1537a0af714
Author: Cody Tapscott <[email protected]>
Date: Tue Apr 4 15:20:46 2023 -0400

linux: respect `TRACY_NO_SAMPLING` for sys-tracing

This compile-time flag was being ignored on Linux. This change adds
gating for software-sampled stack trace sampling following the same
pattern as other `TRACY_NO_SAMPLE_*` options.

If `TRACY_NO_SAMPLING=1` is provided as an environment variable,
software stack sampling is also disabled.

diff --git a/public/client/TracySysTrace.cpp b/public/client/TracySysTrace.cpp
index 4a562eaa..af0641fe 100644
--- a/public/client/TracySysTrace.cpp
+++ b/public/client/TracySysTrace.cpp
@@ -770,6 +770,13 @@ bool SysTraceStart( int64_t& samplingPeriod )
TracyDebug( "sched_wakeup id: %i\n", wakeupId );
TracyDebug( "drm_vblank_event id: %i\n", vsyncId );

+#ifdef TRACY_NO_SAMPLING
+ const bool noSoftwareSampling = true;
+#else
+ const char* noSoftwareSamplingEnv = GetEnvVar( "TRACY_NO_SAMPLING" );
+ const bool noSoftwareSampling = noSoftwareSamplingEnv && noSoftwareSamplingEnv[0] == '1';
+#endif
+
#ifdef TRACY_NO_SAMPLE_RETIREMENT
const bool noRetirement = true;
#else
@@ -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 )
{
- int fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
- if( fd == -1 )
+ TracyDebug( "Setup software sampling\n" );
+ ProbePreciseIp( pe, currentPid );
+ for( int i=0; i<s_numCpus; i++ )
{
- pe.exclude_kernel = 1;
- ProbePreciseIp( pe, currentPid );
- fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
+ int fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
if( fd == -1 )
{
- TracyDebug( " Failed to setup!\n");
- break;
+ pe.exclude_kernel = 1;
+ ProbePreciseIp( pe, currentPid );
+ fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
+ if( fd == -1 )
+ {
+ TracyDebug( " Failed to setup!\n");
+ break;
+ }
+ TracyDebug( " No access to kernel samples\n" );
+ }
+ new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCallstack );
+ if( s_ring[s_numBuffers].IsValid() )
+ {
+ s_numBuffers++;
+ TracyDebug( " Core %i ok\n", i );
}
- TracyDebug( " No access to kernel samples\n" );
- }
- new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCallstack );
- if( s_ring[s_numBuffers].IsValid() )
- {
- s_numBuffers++;
- TracyDebug( " Core %i ok\n", i );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ diff --git a/public/client/TracyProfiler.cpp b/public/client/TracyProfiler.cpp
index 6104a7ed..38b5ea13 100644
--- a/public/client/TracyProfiler.cpp
+++ b/public/client/TracyProfiler.cpp
@@ -4149,4 +4149,5 @@ TRACY_API void ___tracy_emit_frame_image( const void* image, uint16_t w, uint16_
@@ -4149,6 +4149,7 @@ TRACY_API void ___tracy_emit_frame_image( const void* image, uint16_t w, uint16_
TRACY_API void ___tracy_emit_plot( const char* name, double val ) { tracy::Profiler::PlotData( name, val ); }
TRACY_API void ___tracy_emit_plot_float( const char* name, float val ) { tracy::Profiler::PlotData( name, val ); }
TRACY_API void ___tracy_emit_plot_int( const char* name, int64_t val ) { tracy::Profiler::PlotData( name, val ); }
+TRACY_API void ___tracy_emit_plot_config( const char* name, int type, int step, int fill, uint32_t color ) { tracy::Profiler::ConfigurePlot( name, tracy::PlotFormatType(type), step, fill, color ); }
TRACY_API void ___tracy_emit_message( const char* txt, size_t size, int callstack ) { tracy::Profiler::Message( txt, size, callstack ); }
TRACY_API void ___tracy_emit_messageL( const char* txt, int callstack ) { tracy::Profiler::Message( txt, callstack ); }
Expand All @@ -32,17 +34,24 @@ index bedf5e16..736b51ed 100644
TRACY_API void ___tracy_set_thread_name( const char* name );

#define TracyCSetThreadName( name ) ___tracy_set_thread_name( name );
@@ -49,4 +56,5 @@ typedef const void* TracyCZoneCtx;
@@ -60,6 +67,8 @@ typedef const void* TracyCZoneCtx;
#define TracyCPlot(x,y)
#define TracyCPlotF(x,y)
#define TracyCPlotI(x,y)
+#define TracyCPlotConfig(x,y,z,w,a)
+
#define TracyCMessage(x,y)
#define TracyCMessageL(x)
#define TracyCMessageC(x,y,z)
@@ -276,7 +284,9 @@ TRACY_API void ___tracy_emit_frame_image( const void* image, uint16_t w, uint16_
@@ -289,11 +298,13 @@ TRACY_API void ___tracy_emit_frame_image( const void* image, uint16_t w, uint16_
TRACY_API void ___tracy_emit_plot( const char* name, double val );
TRACY_API void ___tracy_emit_plot_float( const char* name, float val );
TRACY_API void ___tracy_emit_plot_int( const char* name, int64_t val );
+TRACY_API void ___tracy_emit_plot_config( const char* name, int type, int step, int fill, uint32_t color );
TRACY_API void ___tracy_emit_message_appinfo( const char* txt, size_t size );

#define TracyCPlot( name, val ) ___tracy_emit_plot( name, val );
#define TracyCPlotF( name, val ) ___tracy_emit_plot_float( name, val );
#define TracyCPlotI( name, val ) ___tracy_emit_plot_int( name, val );
+#define TracyCPlotConfig( name, type, step, fill, color ) ___tracy_emit_plot_config( name, type, step, fill, color );
#define TracyCAppInfo( txt, size ) ___tracy_emit_message_appinfo( txt, size );

0 comments on commit 1526534

Please sign in to comment.