Skip to content

Commit 650541f

Browse files
authored
Merge pull request wolfpld#1136 from moritz-h/python-docs
Update Python docs
2 parents 8bea64a + 18e7566 commit 650541f

File tree

2 files changed

+30
-42
lines changed

2 files changed

+30
-42
lines changed

‎manual/tracy.md‎

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The user manual
1212

1313
**Bartosz Taudul** [\<wolf@nereid.pl\>](mailto:wolf@nereid.pl)
1414

15-
2025-07-23 <https://github.com/wolfpld/tracy>
15+
2025-08-14 <https://github.com/wolfpld/tracy>
1616
:::
1717

1818
# Quick overview {#quick-overview .unnumbered}
@@ -2109,33 +2109,26 @@ Please not the use of ids as way to cope with the need for unique pointers for c
21092109

21102110
### Building the Python package
21112111

2112-
To build the Python package, you will need to use the CMake build system to compile the Tracy-Client. The CMake option `-D TRACY_CLIENT_PYTHON=ON` is used to enable the generation of the Python bindings in conjunction with a mandatory creation of a shared Tracy-Client library via one of the CMake options `-D BUILD_SHARED_LIBS=ON` or `-D DEFAULT_STATIC=OFF`.
2112+
To build the Python package, run the following commands:
21132113

2114-
The following other variables are available in addition:
2115-
2116-
- `EXTERNAL_PYBIND11` --- Can be used to disable the download of pybind11 when Tracy is embedded in another CMake project that already uses pybind11.
2114+
cd ../python
2115+
pip wheel .
21172116

2118-
- `TRACY_CLIENT_PYTHON_TARGET` --- Optional directory to copy Tracy Python bindings to when Tracy is embedded in another CMake project.
2117+
This will create a wheel package in the `python` folder. Please note that this requires CMake and a C++ compiler installed on the system, as the Tracy-Client library is built in the background.
21192118

2120-
- `BUFFER_SIZE` --- The size of the global pointer buffer (defaults to 128) for naming Tracy profiling entities like frame marks, plots, and memory locations.
2119+
You can pass additional CMake options to the package build to configure the Tracy-Client library:
21212120

2122-
- `NAME_LENGTH` --- The maximum length (defaults to 128) of a name stored in the global pointer buffer.
2123-
2124-
Be aware that the memory allocated by this buffer is global and is not freed, see section [3.1.2](#uniquepointers).
2121+
pip wheel . --config-settings cmake.define.TRACY_ENABLE=OFF
21252122

2126-
See below for example steps to build the Python bindings using CMake:
2123+
The following additional CMake options are available when building the Python package:
21272124

2128-
mkdir build
2129-
cd build
2130-
cmake -DTRACY_STATIC=OFF -DTRACY_CLIENT_PYTHON=ON ../
2131-
make -j$(nproc)
2125+
- `BUFFER_SIZE` --- The size of the global pointer buffer (defaults to 128) for naming Tracy profiling entities like frame marks, plots, and memory locations.
21322126

2133-
Once this has finished building the Python package can be built as follows:
2127+
- `NAME_LENGTH` --- The maximum length (defaults to 128) of a name stored in the global pointer buffer.
21342128

2135-
cd ../python
2136-
python3 setup.py bdist_wheel
2129+
- `EXTERNAL_PYBIND11` --- Can be used to disable the download of pybind11 when Tracy is embedded in another CMake project that already uses pybind11.
21372130

2138-
The created package will be in the folder `python/dist`.
2131+
Be aware that the memory allocated by this buffer is global and is not freed, see section [3.1.2](#uniquepointers).
21392132

21402133
## Fortran API {#fortranapi}
21412134

@@ -2395,6 +2388,8 @@ By default, sampling is performed at 8 kHz frequency on Windows (the maximum pos
23952388

23962389
Call stack sampling may be disabled by using the `TRACY_NO_SAMPLING` define.
23972390

2391+
When enabled, by default, sampling starts at the beginning of the application and ends with it. You can instead have programmatic (manual) control over when sampling should begin and end by defining `TRACY_SAMPLING_PROFILER_MANUAL_START` when compiling `TracyClient.cpp`. Use `tracy::BeginSamplingProfiling()` and `tracy::EndSamplingProfiling()` to control it. There are C interfaces for it as well: `TracyCBeginSamplingProfiling()` and `TracyCEndSamplingProfiling()`.
2392+
23982393
::: bclogo
23992394
Linux sampling rate limits The operating system may decide that sampling takes too much CPU time and reduce the allowed sampling rate. This can be seen in `dmesg` output as:
24002395

‎manual/tracy.tex‎

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,37 +2392,30 @@ \subsubsection{Bindings}
23922392

23932393
\subsubsection{Building the Python package}
23942394

2395-
To build the Python package, you will need to use the CMake build system to compile the Tracy-Client.
2396-
The CMake option \texttt{-D TRACY\_CLIENT\_PYTHON=ON} is used to enable the generation of the Python bindings in conjunction with a mandatory creation of a shared Tracy-Client library via one of the CMake options \texttt{-D BUILD\_SHARED\_LIBS=ON} or \texttt{-D DEFAULT\_STATIC=OFF}.
2397-
2398-
The following other variables are available in addition:
2399-
2400-
\begin{itemize}
2401-
\item \texttt{EXTERNAL\_PYBIND11} --- Can be used to disable the download of pybind11 when Tracy is embedded in another CMake project that already uses pybind11.
2402-
\item \texttt{TRACY\_CLIENT\_PYTHON\_TARGET} --- Optional directory to copy Tracy Python bindings to when Tracy is embedded in another CMake project.
2403-
\item \texttt{BUFFER\_SIZE} --- The size of the global pointer buffer (defaults to 128) for naming Tracy profiling entities like frame marks, plots, and memory locations.
2404-
\item \texttt{NAME\_LENGTH} --- The maximum length (defaults to 128) of a name stored in the global pointer buffer.
2405-
\end{itemize}
2406-
2407-
Be aware that the memory allocated by this buffer is global and is not freed, see section~\ref{uniquepointers}.
2408-
2409-
See below for example steps to build the Python bindings using CMake:
2395+
To build the Python package, run the following commands:
24102396

24112397
\begin{lstlisting}
2412-
mkdir build
2413-
cd build
2414-
cmake -DTRACY_STATIC=OFF -DTRACY_CLIENT_PYTHON=ON ../
2415-
make -j$(nproc)
2398+
cd ../python
2399+
pip wheel .
24162400
\end{lstlisting}
24172401

2418-
Once this has finished building the Python package can be built as follows:
2402+
This will create a wheel package in the \texttt{python} folder.
2403+
Please note that this requires CMake and a C++ compiler installed on the system, as the Tracy-Client library is built in the background.
24192404

2405+
You can pass additional CMake options to the package build to configure the Tracy-Client library:
24202406
\begin{lstlisting}
2421-
cd ../python
2422-
python3 setup.py bdist_wheel
2407+
pip wheel . --config-settings cmake.define.TRACY_ENABLE=OFF
24232408
\end{lstlisting}
24242409

2425-
The created package will be in the folder \texttt{python/dist}.
2410+
The following additional CMake options are available when building the Python package:
2411+
2412+
\begin{itemize}
2413+
\item \texttt{BUFFER\_SIZE} --- The size of the global pointer buffer (defaults to 128) for naming Tracy profiling entities like frame marks, plots, and memory locations.
2414+
\item \texttt{NAME\_LENGTH} --- The maximum length (defaults to 128) of a name stored in the global pointer buffer.
2415+
\item \texttt{EXTERNAL\_PYBIND11} --- Can be used to disable the download of pybind11 when Tracy is embedded in another CMake project that already uses pybind11.
2416+
\end{itemize}
2417+
2418+
Be aware that the memory allocated by this buffer is global and is not freed, see section~\ref{uniquepointers}.
24262419

24272420
\subsection{Fortran API}
24282421
\label{fortranapi}

0 commit comments

Comments
 (0)