mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Updated the manual and Added Destroy Macro
This commit is contained in:
parent
a5c50a622d
commit
31485cb345
@ -6,6 +6,7 @@
|
|||||||
#if !defined TRACY_ENABLE || !defined _WIN32
|
#if !defined TRACY_ENABLE || !defined _WIN32
|
||||||
|
|
||||||
#define TracyD3D11Context(x,y)
|
#define TracyD3D11Context(x,y)
|
||||||
|
#define TracyD3D11Destroy(x)
|
||||||
#define TracyD3D11NamedZone(x,y,z)
|
#define TracyD3D11NamedZone(x,y,z)
|
||||||
#define TracyD3D11NamedZoneC(x,y,z,w)
|
#define TracyD3D11NamedZoneC(x,y,z,w)
|
||||||
#define TracyD3D11Zone(x,y)
|
#define TracyD3D11Zone(x,y)
|
||||||
@ -339,6 +340,7 @@ static inline void DestroyD3D11Context( D3D11Ctx* ctx )
|
|||||||
using TracyD3D11Ctx = tracy::D3D11Ctx*;
|
using TracyD3D11Ctx = tracy::D3D11Ctx*;
|
||||||
|
|
||||||
#define TracyD3D11Context( device, devicectx ) tracy::CreateD3D11Context( device, devicectx );
|
#define TracyD3D11Context( device, devicectx ) tracy::CreateD3D11Context( device, devicectx );
|
||||||
|
#define TracyD3D11Destroy( devicectx ) tracy::DestroyD3D11Context( devicectx );
|
||||||
#define TracyD3D11NamedZone( ctx, varname, name, active ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::D3D11CtxScope varname( ctx, &TracyConcat(__tracy_gpu_source_location,__LINE__), active );
|
#define TracyD3D11NamedZone( ctx, varname, name, active ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::D3D11CtxScope varname( ctx, &TracyConcat(__tracy_gpu_source_location,__LINE__), active );
|
||||||
#define TracyD3D11NamedZoneC( ctx, varname, name, color, active ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::D3D11CtxScope varname( ctx, &TracyConcat(__tracy_gpu_source_location,__LINE__), active );
|
#define TracyD3D11NamedZoneC( ctx, varname, name, color, active ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::D3D11CtxScope varname( ctx, &TracyConcat(__tracy_gpu_source_location,__LINE__), active );
|
||||||
#define TracyD3D11Zone( ctx, name ) TracyD3D11NamedZone( ctx, ___tracy_gpu_zone, name, true )
|
#define TracyD3D11Zone( ctx, name ) TracyD3D11NamedZone( ctx, ___tracy_gpu_zone, name, true )
|
||||||
|
|||||||
@ -137,7 +137,7 @@ There's much more Tracy can do, which can be explored by carefully reading this
|
|||||||
\section{A quick look at Tracy Profiler}
|
\section{A quick look at Tracy Profiler}
|
||||||
\label{quicklook}
|
\label{quicklook}
|
||||||
|
|
||||||
Tracy is a real-time, nanosecond resolution \emph{hybrid frame and sampling profiler} that can be used for remote or embedded telemetry of games and other applications. It can profile CPU (C, C++11, Lua), GPU (OpenGL, Vulkan, Direct3D 12, OpenCL) and memory. It also can monitor locks held by threads and show where contention does happen.
|
Tracy is a real-time, nanosecond resolution \emph{hybrid frame and sampling profiler} that can be used for remote or embedded telemetry of games and other applications. It can profile CPU (C, C++11, Lua), GPU (OpenGL, Vulkan, Direct3D 12, Direct3D 11, OpenCL) and memory. It also can monitor locks held by threads and show where contention does happen.
|
||||||
|
|
||||||
While Tracy can perform statistical analysis of sampled call stack data, just like other \emph{statistical profilers} (such as VTune, perf or Very Sleepy), it mainly focuses on manual markup of the source code, which allows frame-by-frame inspection of the program execution. You will be able to see exactly which functions are called, how much time is spent in them, and how do they interact with each other in a multi-threaded environment. In contrast, the statistical analysis may show you the hot spots in your code, but it is unable to accurately pinpoint the underlying cause for semi-random frame stutter that may occur every couple of seconds.
|
While Tracy can perform statistical analysis of sampled call stack data, just like other \emph{statistical profilers} (such as VTune, perf or Very Sleepy), it mainly focuses on manual markup of the source code, which allows frame-by-frame inspection of the program execution. You will be able to see exactly which functions are called, how much time is spent in them, and how do they interact with each other in a multi-threaded environment. In contrast, the statistical analysis may show you the hot spots in your code, but it is unable to accurately pinpoint the underlying cause for semi-random frame stutter that may occur every couple of seconds.
|
||||||
|
|
||||||
@ -1356,6 +1356,14 @@ logo=\bcattention
|
|||||||
\end{itemize}
|
\end{itemize}
|
||||||
\end{bclogo}
|
\end{bclogo}
|
||||||
|
|
||||||
|
\subsubsection{Direct3D 11}
|
||||||
|
|
||||||
|
Similar to OpenGL to enable Direct3D 11 support, include the \texttt{tracy/TracyD3D11.hpp} header file. To start profiling for Direct3D 11 , where a \texttt{TracyD3D11Ctx} is returned from a call to \texttt{TracyD3D11Context(device,ctx)}, which should be later cleaned up with the \texttt{TracyD3D11Destroy(ctx)} macro.
|
||||||
|
|
||||||
|
To mark a GPU zone use the \texttt{TracyD3D11Zone(ctx,name)} macro, where \texttt{name} is a string literal name of the zone. Alternatively you may use \texttt{TracyD3D11ZoneC(ctx,name,color)} to specify zone color.
|
||||||
|
|
||||||
|
You also need to periodically collect the GPU events similar to the OpenGL using the \texttt{TracyD3D11Collect(ctx)} macro. Recommended place to do it is after the swap buffers function call or end of a frame.
|
||||||
|
|
||||||
\subsubsection{Vulkan}
|
\subsubsection{Vulkan}
|
||||||
|
|
||||||
Similarly, for Vulkan support you should include the \texttt{tracy/TracyVulkan.hpp} header file. Tracing Vulkan devices and queues is a bit more involved, and the Vulkan initialization macro \texttt{TracyVkContext(physdev, device, queue, cmdbuf)} returns an instance of \texttt{TracyVkCtx} object, which tracks an associated Vulkan queue. Cleanup is performed using the \texttt{TracyVkDestroy(ctx)} macro. You may create multiple Vulkan contexts.
|
Similarly, for Vulkan support you should include the \texttt{tracy/TracyVulkan.hpp} header file. Tracing Vulkan devices and queues is a bit more involved, and the Vulkan initialization macro \texttt{TracyVkContext(physdev, device, queue, cmdbuf)} returns an instance of \texttt{TracyVkCtx} object, which tracks an associated Vulkan queue. Cleanup is performed using the \texttt{TracyVkDestroy(ctx)} macro. You may create multiple Vulkan contexts.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user