From 1918c0ffe6735e64f360ddc9ca4e89859b81c147 Mon Sep 17 00:00:00 2001 From: Stone Tickle Date: Wed, 17 Mar 2021 08:51:24 +0900 Subject: [PATCH 1/2] fix TRACY_NO_FILESELECTOR macro --- profiler/build/unix/build.mk | 18 +++++++++++------- profiler/src/main.cpp | 8 +++++++- server/TracySourceView.cpp | 2 ++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/profiler/build/unix/build.mk b/profiler/build/unix/build.mk index 7d14795d..f403b879 100644 --- a/profiler/build/unix/build.mk +++ b/profiler/build/unix/build.mk @@ -19,14 +19,18 @@ IMAGE := $(PROJECT)-$(BUILD) FILTER := ../../../nfd/nfd_win.cpp include ../../../common/src-from-vcxproj.mk -UNAME := $(shell uname -s) -ifeq ($(UNAME),Darwin) - SRC3 += ../../../nfd/nfd_cocoa.m - LIBS += -framework CoreFoundation -framework AppKit +ifdef TRACY_NO_FILESELECTOR + CXXFLAGS += -DTRACY_NO_FILESELECTOR else - SRC2 += ../../../nfd/nfd_gtk.c - INCLUDES += $(shell pkg-config --cflags gtk+-3.0) - LIBS += $(shell pkg-config --libs gtk+-3.0) + UNAME := $(shell uname -s) + ifeq ($(UNAME),Darwin) + SRC3 += ../../../nfd/nfd_cocoa.m + LIBS += -framework CoreFoundation -framework AppKit + else + SRC2 += ../../../nfd/nfd_gtk.c + INCLUDES += $(shell pkg-config --cflags gtk+-3.0) + LIBS += $(shell pkg-config --libs gtk+-3.0) + endif endif include ../../../common/unix.mk diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index 469df364..dd7afa2d 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -15,10 +15,13 @@ #include #include #include -#include "../nfd/nfd.h" #include #include +#ifndef TRACY_NO_FILESELECTOR +# include "../nfd/nfd.h" +#endif + #ifdef _WIN32 # include # include @@ -747,6 +750,8 @@ static void DrawContents() } } ImGui::SameLine( 0, ImGui::GetFontSize() * 2 ); + +#ifndef TRACY_NO_FILESELECTOR if( ImGui::Button( ICON_FA_FOLDER_OPEN " Open saved trace" ) && !loadThread.joinable() ) { nfdchar_t* fn; @@ -792,6 +797,7 @@ static void DrawContents() if( loadThread.joinable() ) { loadThread.join(); } tracy::BadVersion( badVer ); } +#endif if( !clients.empty() ) { diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 14e36db3..fa7c497b 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -3785,6 +3785,7 @@ void SourceView::CheckWrite( size_t line, RegsX86 reg, size_t limit ) } } +#ifndef TRACY_NO_FILESELECTOR void SourceView::Save( const Worker& worker, size_t start, size_t stop ) { assert( start < m_asm.size() ); @@ -3867,5 +3868,6 @@ void SourceView::Save( const Worker& worker, size_t start, size_t stop ) } } } +#endif } From 9816c99f5d37b05105aeeb0040e32578fde626cf Mon Sep 17 00:00:00 2001 From: Stone Tickle Date: Wed, 17 Mar 2021 09:02:33 +0900 Subject: [PATCH 2/2] add note about TRACY_NO_FILESELECTOR in docs --- manual/techdoc.tex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manual/techdoc.tex b/manual/techdoc.tex index 7d01c0ba..d3da411e 100644 --- a/manual/techdoc.tex +++ b/manual/techdoc.tex @@ -143,6 +143,8 @@ In the header of the \texttt{build.mk} file you can find definitions of the resu By default, the profiler uses X11 on Linux. If you would like to support Wayland instead, set the environment variable \texttt{TRACY\_USE\_WAYLAND} before running make. +Additionally, the variable \texttt{TRACY\_NO\_FILESELECTOR} may be set to remove Tracy's GTK 3 dependency at the expense of a file selection dialog. Note that this means you will not be able to use certain features, e.g. opening a saved trace. + \section{Client part} The client portion of Tracy is basically a queue. Application threads are producing queue items through the instrumentation macros and a dedicated profiler thread consumes the items to send them over the network, to the server.