mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-17 22:35:36 +00:00
Update manual.
This commit is contained in:
189
manual/tracy.tex
189
manual/tracy.tex
@@ -20,6 +20,7 @@
|
||||
\usepackage[euler]{textgreek}
|
||||
\usepackage{nameref}
|
||||
\usepackage{diagbox}
|
||||
\usepackage{csquotes}
|
||||
|
||||
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
|
||||
\geometry{a4paper,textwidth=6.5in,hmarginratio=1:1,
|
||||
@@ -2867,7 +2868,7 @@ You can disconnect from the client and save the captured trace by pressing \keys
|
||||
|
||||
If you want to look at the profile data in real-time (or load a saved trace file), you can use the data analysis utility contained in the \texttt{profiler} directory. After starting the application, you will be greeted with a welcome dialog (figure~\ref{welcomedialog}), presenting a bunch of useful links (\faBook{}~\emph{User manual}, \faGlobeAmericas{}~\emph{Web}, \faComment~\emph{Join chat} and \faHeart{}~\emph{Sponsor}). The \faGlobeAmericas{}~\emph{Web} button opens a drop-down list with links to the profiler's \emph{\faHome{}~Home page} and a bunch of \emph{\faVideo{}~Feature videos}.
|
||||
|
||||
The \emph{\faWrench{}~Wrench} button opens the about dialog, which also contains a number of global settings you may want to tweak.
|
||||
The \emph{\faWrench{}~Wrench} button opens the about dialog, which also contains a number of global settings you may want to tweak (section~\ref{aboutwindow}).
|
||||
|
||||
The client \emph{address entry} field and the \faWifi{}~\emph{Connect} button are used to connect to a running client\footnote{Note that a custom port may be provided here, for example by entering '127.0.0.1:1234'.}. You can use the connection history button~\faCaretDown{} to display a list of commonly used targets, from which you can quickly select an address. You can remove entries from this list by hovering the \faMousePointer{}~mouse cursor over an entry and pressing the \keys{\del} button on the keyboard.
|
||||
|
||||
@@ -2904,6 +2905,28 @@ Both connecting to a client and opening a saved trace will present you with the
|
||||
|
||||
Once connected to a client \keys{\ctrl + \shift + \Alt + R} can be used to quickly discard any captured data and reconnect to a client at the same address.
|
||||
|
||||
\subsubsection{About window}
|
||||
\label{aboutwindow}
|
||||
|
||||
The About window displays the profiler version and the Git SHA identifier of the build, as well as some additional information.
|
||||
|
||||
You can also adjust some settings that affect global profiler behavior in this window. These settings are accessible by expanding the \emph{\faToolbox{}~Global settings} node. The following options are available:
|
||||
|
||||
\begin{itemize}
|
||||
\item \emph{Threaded rendering} -- This controls whether the profiler UI uses multithreaded rendering. Since the profiler needs to quickly navigate large amounts of data, it spends a lot of time waiting for memory accesses to be resolved. Multithreading enables multiple simultaneous memory reads, which significantly reduces the impact of memory access latency. However, this may result in higher CPU usage, which could interfere with the application you are profiling.
|
||||
\item \emph{Reduce render rate when focus is lost} -- This throttles the profiler window refresh rate to 20 FPS when the window does not have focus.
|
||||
\item \emph{Target FPS} -- Sets the default \emph{target FPS} value for the \emph{Frame time graph}. See sections~\ref{frametimegraph} and~\ref{options} for more information. Not related to the profiler window refresh rate.
|
||||
\item \emph{Zone colors} -- Sets the default zone coloring preset used in new traces. See section~\ref{options} for more information.
|
||||
\item \emph{Zone name shortening} -- Sets the default zone name shortening behavior used in new traces. See section~\ref{options} for more information.
|
||||
\item \emph{Scroll multipliers} -- Allows you to fine-tune the sensitivity of the horizontal and vertical scroll in the timeline. The default values ($1.0$) are an attempt at the best possible settings, but differences in hardware manufacturers, platform implementations, and user expectations may require adjustments.
|
||||
\item \emph{Memory limit} -- When enabled, profiler will stop recording data when memory usage exceeds the specified percentage of the total system memory. This mechanism does not measure the current system memory usage or limits. The upper value is not capped, as you may use swap. See section~\ref{memoryusage} for more information.
|
||||
\item \emph{Enable achievements} -- Enables achievements system, accessed through the~\faStar{}~icon in the bottom right corner of the profiler window. It is essentially a gamified tutorial system designed to teach new users how to use the profiler.
|
||||
\item \emph{Save UI scale} -- Determines whether the UI scale set by the user should be saved between sessions. This setting is not related to DPI scaling.
|
||||
\item \emph{Enable Tracy Assist} -- Controls whether the automated assistant features (based on large language models) are available through the Profiler UI. See section~\ref{tracyassist} for more details.
|
||||
\end{itemize}
|
||||
|
||||
|
||||
|
||||
\subsubsection{Connection information pop-up}
|
||||
\label{connectionpopup}
|
||||
|
||||
@@ -2945,6 +2968,7 @@ Tracy network bandwidth requirements depend on the amount of data collection the
|
||||
The maximum attainable connection speed is determined by the ability of the client to provide data and the ability of the server to process the received data. In an extreme conditions test performed on an i7~8700K, the maximum transfer rate peaked at 950~Mbps. In each second, the profiler could process 27~million zones and consume 1~GB of RAM.
|
||||
|
||||
\subsection{Memory usage}
|
||||
\label{memoryusage}
|
||||
|
||||
The captured data is stored in RAM and only written to the disk when the capture finishes. This can result in memory exhaustion when you capture massive amounts of profile data or even in typical usage situations when the capture is performed over a long time. Therefore, the recommended usage pattern is to perform moderate instrumentation of the client code and limit capture time to the strict necessity.
|
||||
|
||||
@@ -3180,19 +3204,20 @@ The main profiler window is split into three sections, as seen in figure~\ref{ma
|
||||
|
||||
\begin{figure}[h]
|
||||
\centering\begin{tikzpicture}
|
||||
\draw (0, 0) rectangle (16.1, -5.5);
|
||||
\draw[pattern=crosshatch dots] (0, 0) rectangle+(16.1, 0.3);
|
||||
\draw (0, 0) rectangle (16.2, -5.5);
|
||||
\draw[pattern=crosshatch dots] (0, 0) rectangle+(16.2, 0.3);
|
||||
\draw[rounded corners=5pt] (0.1, -0.1) rectangle+(0.5, -0.5) node [midway] {\faPowerOff};
|
||||
\draw[rounded corners=5pt] (0.7, -0.1) rectangle+(0.5, -0.5) node [midway] {\faCog{}};
|
||||
\draw[rounded corners=5pt] (1.3, -0.1) rectangle+(2.2, -0.5) node [midway] {\faTags{} Messages};
|
||||
\draw[rounded corners=5pt] (3.6, -0.1) rectangle+(1.5, -0.5) node [midway] {\faSearch{} Find};
|
||||
\draw[rounded corners=5pt] (5.2, -0.1) rectangle+(2, -0.5) node [midway] {\faSortAmountUp{} Statistics};
|
||||
\draw[rounded corners=5pt] (7.3, -0.1) rectangle+(1.6, -0.5) node [midway] {\faFire{} Flame};
|
||||
\draw[rounded corners=5pt] (9.0, -0.1) rectangle+(2.2, -0.5) node [midway] {\faMemory{} Memory};
|
||||
\draw[rounded corners=5pt] (11.3, -0.1) rectangle+(2.1, -0.5) node [midway] {\faBalanceScale{} Compare};
|
||||
\draw[rounded corners=5pt] (13.5, -0.1) rectangle+(1.3, -0.5) node [midway] {\faFingerprint{} Info};
|
||||
\draw[rounded corners=5pt] (14.9, -0.1) rectangle+(0.5, -0.5) node [midway] {\faTools{}};
|
||||
\draw[rounded corners=5pt] (15.5, -0.1) rectangle+(0.5, -0.5) node [midway] {\faSearchPlus{}};
|
||||
\draw[rounded corners=5pt] (3.6, -0.1) rectangle+(1.3, -0.5) node [midway] {\faSearch{} Find};
|
||||
\draw[rounded corners=5pt] (5.0, -0.1) rectangle+(2, -0.5) node [midway] {\faSortAmountUp{} Statistics};
|
||||
\draw[rounded corners=5pt] (7.1, -0.1) rectangle+(1.5, -0.5) node [midway] {\faFire{} Flame};
|
||||
\draw[rounded corners=5pt] (8.7, -0.1) rectangle+(2.1, -0.5) node [midway] {\faMemory{} Memory};
|
||||
\draw[rounded corners=5pt] (10.9, -0.1) rectangle+(2.1, -0.5) node [midway] {\faBalanceScale{} Compare};
|
||||
\draw[rounded corners=5pt] (13.1, -0.1) rectangle+(1.2, -0.5) node [midway] {\faFingerprint{} Info};
|
||||
\draw[rounded corners=5pt] (14.4, -0.1) rectangle+(0.5, -0.5) node [midway] {\faTools{}};
|
||||
\draw[rounded corners=5pt] (15.0, -0.1) rectangle+(0.5, -0.5) node [midway] {\faSearchPlus{}};
|
||||
\draw[rounded corners=5pt] (15.6, -0.1) rectangle+(0.5, -0.5) node [midway] {\faRobot{}};
|
||||
\draw[rounded corners=5pt] (0.1, -0.7) rectangle+(0.4, -0.5) node [midway] {\faCaretLeft};
|
||||
\draw (0.6, -0.7) node[anchor=north west] {Frames: 364};
|
||||
\draw[rounded corners=5pt] (2.8, -0.7) rectangle+(0.4, -0.5) node [midway] {\faCaretRight};
|
||||
@@ -3200,8 +3225,8 @@ The main profiler window is split into three sections, as seen in figure~\ref{ma
|
||||
\draw (4, -0.65) node[anchor=north west] {\faEye~52.7 ms \hspace{5pt} \faDatabase~6.06 s \hspace{5pt} \faMemory~195.2 MB};
|
||||
\draw[dashed] (10.1, -0.75) rectangle+(3.2, -0.4) node[midway] {Notification area};
|
||||
|
||||
\draw (0.1, -1.3) rectangle+(15.9, -1) node [midway] {Frame time graph};
|
||||
\draw (0.1, -2.4) rectangle+(15.9, -3) node [midway] {Timeline view};
|
||||
\draw (0.1, -1.3) rectangle+(16.0, -1) node [midway] {Frame time graph};
|
||||
\draw (0.1, -2.4) rectangle+(16.0, -3) node [midway] {Timeline view};
|
||||
\end{tikzpicture}
|
||||
\caption{Main profiler window. Note that this manual has split the top line of buttons into two rows.}
|
||||
\label{mainwindow}
|
||||
@@ -3235,6 +3260,7 @@ The control menu (top row of buttons) provides access to various profiler featur
|
||||
\item \emph{\faHourglassHalf{}~Wait stacks} -- If sampling was performed, an option to display wait stacks may be available. See chapter~\ref{waitstacks} for more details.
|
||||
\end{itemize}
|
||||
\item \emph{\faSearchPlus{}~Display scale} -- Enables run-time resizing of the displayed content. This may be useful in environments with potentially reduced visibility, e.g. during a presentation. Note that this setting is independent to the UI scaling coming from the system DPI settings. The scale will be preserved across multiple profiler sessions if the \emph{Save UI scale} option is selected in global settings.
|
||||
\item \emph{\faRobot{}~Tracy Assist} -- Shows the automated assistant chat window (section~\ref{tracyassist}). Only available if enabled in global settings (section~\ref{aboutwindow}).
|
||||
\end{itemize}
|
||||
|
||||
The frame information block\footnote{Visible only if frame instrumentation was included in the capture.} consists of four elements: the current frame set name along with the number of captured frames (click on it with the \LMB{}~left mouse button to go to a specified frame), the two navigational buttons \faCaretLeft{} and \faCaretRight{}, which allow you to focus the timeline view on the previous or next frame, and the frame set selection button \faCaretDown{}, which is used to switch to another frame set\footnote{See section~\ref{framesets} for another way to change the active frame set.}. For more information about marking frames, see section~\ref{markingframes}.
|
||||
@@ -4536,6 +4562,143 @@ This window displays information about time range limits (section~\ref{timerange
|
||||
|
||||
Note that ranges displayed in the window have color hints that match the color of the striped regions on the timeline.
|
||||
|
||||
\subsection{Tracy Assist}
|
||||
\label{tracyassist}
|
||||
|
||||
With Tracy Profiler, you can use GenAI features to get help using the profiler or analyzing the code you're profiling.
|
||||
|
||||
This feature can be completely disabled in the \emph{Global settings}, as described in section~\ref{aboutwindow}.
|
||||
|
||||
\begin{bclogo}[
|
||||
noborder=true,
|
||||
couleur=black!5,
|
||||
logo=\bcattention
|
||||
]{Caution}
|
||||
Remember that the responses you receive from the automated assistant are the result of complex yet limited algorithms. While the answers may be convincing and, in most cases, reliable, you should always verify their accuracy.
|
||||
\end{bclogo}
|
||||
|
||||
\begin{bclogo}[
|
||||
noborder=true,
|
||||
couleur=black!5,
|
||||
logo=\bcquestion
|
||||
]{How do I enter my OpenAI API key?}
|
||||
You do not. Tracy is not a money funnel for Silicon Valley tech bros to get rich.
|
||||
|
||||
The only way to access the assistant is to run everything locally on your system. This ensures that everything you do stays private and that you won't be subject to forced changes in features or terms and conditions. You should own the tools you work with instead of renting them from someone else.
|
||||
\end{bclogo}
|
||||
|
||||
\subsubsection{Service provider}
|
||||
|
||||
To get started, you will need to install an LLM\footnote{Large Language Model.} provider on your system. Any service that's compatible with the standard API should work, but some may work better than others. The LLM field is advancing quickly, with new models frequently being released that often require specific support from provider services to deliver the best experience.
|
||||
|
||||
The ideal LLM provider should be a system service that loads and unloads models on demand and swaps between them as needed. It should provide a service to a variety of user-facing applications running on the system. The ideal provider should also implement a time-to-live mechanism that unloads models after a period of inactivity to make resources available to other programs. The user should be able to use the ideal provider to find and download models that they can run on their hardware.
|
||||
|
||||
There are no ideal LLM providers, but here are some options:
|
||||
|
||||
\begin{itemize}
|
||||
\item \emph{LM Studio} (\url{https://lmstudio.ai/}) -- It is the easiest to use and install on all platforms. It may be a bit overwhelming at first due to the number of options it offers. Some people may question the licensing. Its features lag behind. Manual configuration of each model is required.
|
||||
\item \emph{llama.cpp} (\url{https://github.com/ggml-org/llama.cpp}) -- Recommended for advanced users. It is rapidly advancing with new features and model support. Most other providers use it to do the actual work, and they typically use an outdated release. It requires a lot of manual setup and command line usage. It does not hold your hand.
|
||||
\item \emph{llama-swap} (\url{https://github.com/mostlygeek/llama-swap}) -- Wrapper for llama.cpp that allows model selection. Recommended to augment the above.
|
||||
\item \emph{Ollama} (\url{https://ollama.com/}) -- It lacks some features required by Tracy. Very limited configuration is only available via the system service's environment variables. Some practices are questionable. It will not use full capabilities of the available hardware.
|
||||
\end{itemize}
|
||||
|
||||
\subsubsection{Model selection}
|
||||
|
||||
Once you have installed the service provider, you will need to download the model files. The exact process depends on the provider you chose. LM Studio, for example, has a built-in downloader with an easy-to-use UI. For llama.cpp, you can follow their documentation or download the model file via your web browser.
|
||||
|
||||
\paragraph{Model family}
|
||||
|
||||
There are many factors to take into consideration when choosing a model to use. First, you should determine which model family you want to use:
|
||||
|
||||
\begin{itemize}
|
||||
\item \emph{Gemma 3} (\url{https://blog.google/technology/developers/gemma-3/}) is a well rounded model that can converse in multiple languages.
|
||||
\item \emph{Qwen3} (\url{https://qwenlm.github.io/blog/qwen3/}) has a more technical feeling to it.
|
||||
\item \emph{Mistral Small} (\url{https://mistral.ai/news/mistral-small-3-1}) may also be considered. Despite the name, it is not small.
|
||||
\end{itemize}
|
||||
|
||||
This list is not exhaustive; it's only a starting point.
|
||||
|
||||
When looking for a model you may encounter models that are "reasoning". These are generally not worth the additional time and resources they need.
|
||||
|
||||
\paragraph{Model size}
|
||||
|
||||
The next thing to consider when selecting a model is its size, which is typically measured in billions of parameters (weights) and written as 4B, for example. A model's size determines how much memory, computation, and time are required to run it. Generally, the larger the model, the "smarter" its responses will be.
|
||||
|
||||
Models with 4B parameters are too "dumb" to operate in Tracy and will produce nonsense results. The 8B models are barely capable, so their use is not recommended. Models such as Gemma 3 12B and Qwen3 14B should work reasonably well. However, if your hardware can handle it, you should look for even larger models.
|
||||
|
||||
Then there are models that are "Mixture of Experts". For instance, a model may have 30B total parameters, but only 3B are active when generating a response. While these models can generate responses faster, they still require the full set of parameters to be loaded into memory. Their results are also worse than those of "dense" models that use all their parameters.
|
||||
|
||||
\paragraph{Model quantization}
|
||||
|
||||
Running a model with full 32-bit floating-point weights is not feasible due to memory requirements. Instead, the model parameters are quantized, for which 4 bits is typically the sweet spot. In general, the lower the parameter precision, the more "dumbed down" the model becomes. However, the loss of model coherence due to quantization is less than the benefit of being able to run a larger model.
|
||||
|
||||
There are different ways to quantize that give the same bit size. It's best to follow the recommendations provided by LM Studio, for example.
|
||||
|
||||
Some models consider quantization during training, resulting in a more effective model. Gemma 3 refers to this as QAT (Quantization-Aware Training).
|
||||
|
||||
\paragraph{Multimodality}
|
||||
|
||||
Some models can recognize vision or audio. This is achieved by loading an additional model alongside the language model, which increases memory requirements. Since Tracy does not require these capabilities, it's best to either avoid multimodal models or configure the LLM provider appropriately.
|
||||
|
||||
\paragraph{Context size}
|
||||
|
||||
The model size only indicates the minimum memory requirement. For the model to operate properly, you also need to set the context size, which determines how much information from the conversation the model can "remember". This size is measured in tokens, and a very rough approximation is that each token is a combination of three or four letters.
|
||||
|
||||
Each token present in the context window requires a fairly large amount of memory, and that quickly adds up to gigabytes. The KV cache used for context can be quantized, just like model parameters. In this case, the recommended size per weight is 8 bits.
|
||||
|
||||
The minimum required context size for Tracy to run the assistant is 8K, but don't expect things to run smoothly. Using 16K provides more room to operate, but it's still tight. If you have the resources, it's recommended to use 32K or even 64K.
|
||||
|
||||
\paragraph{Hardware resources}
|
||||
|
||||
Ideally, you want to keep both the model and the context cache in your GPU's VRAM. This will provide the fastest possible speed. However, this won't be possible in many configurations.
|
||||
|
||||
LLM providers solve this problem by storing part of the model on the GPU and running the rest on the CPU. The more that can be run on the GPU, the faster it goes.
|
||||
|
||||
Determining how much of the model can be run on the GPU usually requires some experimentation. Other programs running on the system may affect or be affected by this setting. Generally, GPU offload capability is measured by the number of neural network layers.
|
||||
|
||||
\paragraph{In practice}
|
||||
|
||||
So, which model should you run and what hardware you need to be able to do so? Let's take look at some example systems.
|
||||
|
||||
\begin{itemize}
|
||||
\item On a Dell XPS 13" laptop with an i7-1185G7 CPU and integrated GPU, you will struggle to run even the most basic 4B model. Forget about it.
|
||||
\item With 16 GB of RAM and a weak 4 GB Nvidia GPU, you can run Gemma 3 12B (8K context, 8/48 layers offloaded) or Qwen3 14B (16K context, 11/40 layers offloaded) on a Ryzen laptop. A moderate amount of patience will be necessary.
|
||||
\item An 8 GB Nvidia GPU can reach usable speeds when running Gemma 3 12B (16K context, 28/48 layers offloaded) or Qwen3 14B (16K context, 30/40 layers offloaded).
|
||||
\item If you have a 4090 class GPU with 24 GB of VRAM, llama.cpp can run Gemma 3 27B with a 64K context.
|
||||
\end{itemize}
|
||||
|
||||
\subsubsection{Usage}
|
||||
|
||||
The automated assistant can be accessed via the various \emph{\faRobot{}~Tracy Assist} buttons in the UI. The button in the control menu (section~\ref{controlmenu}) gives quick access to the chat. Buttons in other profiler windows open the chat window and add context related to the program you are profiling.
|
||||
|
||||
The chat window is divided into three sections:
|
||||
|
||||
\begin{enumerate}
|
||||
\item The control section at the top.
|
||||
\item The chat contents take up most of the window.
|
||||
\item The entry box is at the bottom.
|
||||
\end{enumerate}
|
||||
|
||||
The control section allows you to clear the chat contents, reconnect to the LLM provider and open the settings panel consisting of:
|
||||
|
||||
\begin{itemize}
|
||||
\item \emph{API} -- Enter the endpoint URL of the LLM provider here. A drop-down list is provided as a convenient way to select the default configuration of various providers. Note that the drop-down list is only used to fill in the endpoint URL.
|
||||
\item \emph{Model} -- Here you can select one of the models you have configured in the LLM provider.
|
||||
\item \emph{Temperature} -- Allows changing default model temperature setting.
|
||||
\item \emph{Internet access} -- Determines whether the model can access network resources such as Wikipedia queries, web searches, and web page retrievals.
|
||||
\item \emph{External services} -- Allows optional configuration of network access.
|
||||
\begin{itemize}
|
||||
\item \emph{User agent} -- Allows changing the user agent parameter in web queries.
|
||||
\item \emph{Google Search Engine} and \emph{API Key} -- Enables use of Google search. If this is not set, searches will fall back to DuckDuckGo, which is very rate limited.
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
|
||||
The horizontal meter directly below shows how much of the context size has been used. Tracy uses various techniques to manage context size, such as limiting the amount of data provided to the model or removing older data. However, the context will eventually be fully utilized during an extended conversation, resulting in a significant degradation of the quality of model responses.
|
||||
|
||||
The chat section contains the conversation with the automated assistant. Each assistant reply includes a hidden "thinking" section in which various tool calls are made and the response is prepared.
|
||||
|
||||
Clicking on the~\emph{\faUser{}~User} role icon removes the chat content up to the selected question. Similarly, clicking on the~\emph{\faRobot{}~Assistant} role icon removes the conversation content up to this point and generates another response from the assistant.
|
||||
|
||||
\section{Exporting zone statistics to CSV}
|
||||
\label{csvexport}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user