Skip to content

Commit 1526534

Browse files
committed
deps: Upgrade LibTracyClient to 0.9.1
1 parent 9ca700e commit 1526534

File tree

5 files changed

+101
-34
lines changed

5 files changed

+101
-34
lines changed

deps/libtracyclient.mk

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LIBTRACYCLIENT_CMAKE :=
1111
LIBTRACYCLIENT_CMAKE += -DBUILD_SHARED_LIBS=ON
1212
LIBTRACYCLIENT_CMAKE += -DTRACY_FIBERS=ON
1313
LIBTRACYCLIENT_CMAKE += -DTRACY_NO_BROADCAST=ON
14-
LIBTRACYCLIENT_CMAKE += -DTRACY_NO_SYSTEM_TRACING=ON
14+
LIBTRACYCLIENT_CMAKE += -DTRACY_NO_SAMPLING=ON
1515
LIBTRACYCLIENT_CMAKE += -DTRACY_ONLY_LOCALHOST=ON
1616
LIBTRACYCLIENT_CMAKE += -DTRACY_NO_CODE_TRANSFER=ON
1717
LIBTRACYCLIENT_CMAKE += -DTRACY_NO_FRAME_IMAGE=ON
@@ -31,17 +31,17 @@ $(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-freebsd-elfw.patch-applied: $(LIBTRACY
3131
patch -p1 -f < $(SRCDIR)/patches/libTracyClient-freebsd-elfw.patch
3232
echo 1 > $@
3333

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

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

44-
$(LIBTRACYCLIENT_BUILDDIR)/build-configured: $(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-config-plots.patch-applied
44+
$(LIBTRACYCLIENT_BUILDDIR)/build-configured: $(LIBTRACYCLIENT_BUILDDIR)/libTracyClient-plot-config.patch-applied
4545
mkdir -p $(dir $@)
4646
cd $(dir $@) && \
4747
$(CMAKE) . $(CMAKE_GENERATOR_COMMAND) $(CMAKE_COMMON) $(LIBTRACYCLIENT_CMAKE) \

deps/libtracyclient.version

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## jll artifact
22
LIBTRACYCLIENT_JLL_NAME := LibTracyClient
3-
LIBTRACYCLIENT_JLL_VER := 0.9.0+1
3+
LIBTRACYCLIENT_JLL_VER := 0.9.1+0
44

55
## source build
6-
LIBTRACYCLIENT_VER := 0.9.0
7-
LIBTRACYCLIENT_BRANCH=v0.9
8-
LIBTRACYCLIENT_SHA1=5a1f5371b792c12aea324213e1dc738b2923ae21
6+
LIBTRACYCLIENT_VER := 0.9.1
7+
LIBTRACYCLIENT_BRANCH=v0.9.1
8+
LIBTRACYCLIENT_SHA1=897aec5b062664d2485f4f9a213715d2e527e0ca

deps/patches/libTracyClient-no-crash-handler.patch

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
commit 6249999153a9497b32bc84e9dc95a1537a0af714
2+
Author: Cody Tapscott <topolarity@tapscott.me>
3+
Date: Tue Apr 4 15:20:46 2023 -0400
4+
5+
linux: respect `TRACY_NO_SAMPLING` for sys-tracing
6+
7+
This compile-time flag was being ignored on Linux. This change adds
8+
gating for software-sampled stack trace sampling following the same
9+
pattern as other `TRACY_NO_SAMPLE_*` options.
10+
11+
If `TRACY_NO_SAMPLING=1` is provided as an environment variable,
12+
software stack sampling is also disabled.
13+
14+
diff --git a/public/client/TracySysTrace.cpp b/public/client/TracySysTrace.cpp
15+
index 4a562eaa..af0641fe 100644
16+
--- a/public/client/TracySysTrace.cpp
17+
+++ b/public/client/TracySysTrace.cpp
18+
@@ -770,6 +770,13 @@ bool SysTraceStart( int64_t& samplingPeriod )
19+
TracyDebug( "sched_wakeup id: %i\n", wakeupId );
20+
TracyDebug( "drm_vblank_event id: %i\n", vsyncId );
21+
22+
+#ifdef TRACY_NO_SAMPLING
23+
+ const bool noSoftwareSampling = true;
24+
+#else
25+
+ const char* noSoftwareSamplingEnv = GetEnvVar( "TRACY_NO_SAMPLING" );
26+
+ const bool noSoftwareSampling = noSoftwareSamplingEnv && noSoftwareSamplingEnv[0] == '1';
27+
+#endif
28+
+
29+
#ifdef TRACY_NO_SAMPLE_RETIREMENT
30+
const bool noRetirement = true;
31+
#else
32+
@@ -839,28 +846,31 @@ bool SysTraceStart( int64_t& samplingPeriod )
33+
pe.clockid = CLOCK_MONOTONIC_RAW;
34+
#endif
35+
36+
- TracyDebug( "Setup software sampling\n" );
37+
- ProbePreciseIp( pe, currentPid );
38+
- for( int i=0; i<s_numCpus; i++ )
39+
+ if( !noSoftwareSampling )
40+
{
41+
- int fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
42+
- if( fd == -1 )
43+
+ TracyDebug( "Setup software sampling\n" );
44+
+ ProbePreciseIp( pe, currentPid );
45+
+ for( int i=0; i<s_numCpus; i++ )
46+
{
47+
- pe.exclude_kernel = 1;
48+
- ProbePreciseIp( pe, currentPid );
49+
- fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
50+
+ int fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
51+
if( fd == -1 )
52+
{
53+
- TracyDebug( " Failed to setup!\n");
54+
- break;
55+
+ pe.exclude_kernel = 1;
56+
+ ProbePreciseIp( pe, currentPid );
57+
+ fd = perf_event_open( &pe, currentPid, i, -1, PERF_FLAG_FD_CLOEXEC );
58+
+ if( fd == -1 )
59+
+ {
60+
+ TracyDebug( " Failed to setup!\n");
61+
+ break;
62+
+ }
63+
+ TracyDebug( " No access to kernel samples\n" );
64+
+ }
65+
+ new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCallstack );
66+
+ if( s_ring[s_numBuffers].IsValid() )
67+
+ {
68+
+ s_numBuffers++;
69+
+ TracyDebug( " Core %i ok\n", i );
70+
}
71+
- TracyDebug( " No access to kernel samples\n" );
72+
- }
73+
- new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCallstack );
74+
- if( s_ring[s_numBuffers].IsValid() )
75+
- {
76+
- s_numBuffers++;
77+
- TracyDebug( " Core %i ok\n", i );
78+
}
79+
}

deps/patches/libTracyClient-config-plots.patch renamed to deps/patches/libTracyClient-plot-config.patch

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ diff --git a/public/client/TracyProfiler.cpp b/public/client/TracyProfiler.cpp
88
index 6104a7ed..38b5ea13 100644
99
--- a/public/client/TracyProfiler.cpp
1010
+++ b/public/client/TracyProfiler.cpp
11-
@@ -4149,4 +4149,5 @@ TRACY_API void ___tracy_emit_frame_image( const void* image, uint16_t w, uint16_
11+
@@ -4149,6 +4149,7 @@ TRACY_API void ___tracy_emit_frame_image( const void* image, uint16_t w, uint16_
1212
TRACY_API void ___tracy_emit_plot( const char* name, double val ) { tracy::Profiler::PlotData( name, val ); }
13+
TRACY_API void ___tracy_emit_plot_float( const char* name, float val ) { tracy::Profiler::PlotData( name, val ); }
14+
TRACY_API void ___tracy_emit_plot_int( const char* name, int64_t val ) { tracy::Profiler::PlotData( name, val ); }
1315
+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 ); }
1416
TRACY_API void ___tracy_emit_message( const char* txt, size_t size, int callstack ) { tracy::Profiler::Message( txt, size, callstack ); }
1517
TRACY_API void ___tracy_emit_messageL( const char* txt, int callstack ) { tracy::Profiler::Message( txt, callstack ); }
@@ -32,17 +34,24 @@ index bedf5e16..736b51ed 100644
3234
TRACY_API void ___tracy_set_thread_name( const char* name );
3335

3436
#define TracyCSetThreadName( name ) ___tracy_set_thread_name( name );
35-
@@ -49,4 +56,5 @@ typedef const void* TracyCZoneCtx;
37+
@@ -60,6 +67,8 @@ typedef const void* TracyCZoneCtx;
3638
#define TracyCPlot(x,y)
39+
#define TracyCPlotF(x,y)
40+
#define TracyCPlotI(x,y)
3741
+#define TracyCPlotConfig(x,y,z,w,a)
42+
+
3843
#define TracyCMessage(x,y)
3944
#define TracyCMessageL(x)
4045
#define TracyCMessageC(x,y,z)
41-
@@ -276,7 +284,9 @@ TRACY_API void ___tracy_emit_frame_image( const void* image, uint16_t w, uint16_
46+
@@ -289,11 +298,13 @@ TRACY_API void ___tracy_emit_frame_image( const void* image, uint16_t w, uint16_
4247
TRACY_API void ___tracy_emit_plot( const char* name, double val );
48+
TRACY_API void ___tracy_emit_plot_float( const char* name, float val );
49+
TRACY_API void ___tracy_emit_plot_int( const char* name, int64_t val );
4350
+TRACY_API void ___tracy_emit_plot_config( const char* name, int type, int step, int fill, uint32_t color );
4451
TRACY_API void ___tracy_emit_message_appinfo( const char* txt, size_t size );
4552

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

0 commit comments

Comments
 (0)