2017-09-12 23:33:50 +00:00
|
|
|
#ifndef __TRACYVIEW_HPP__
|
|
|
|
#define __TRACYVIEW_HPP__
|
|
|
|
|
|
|
|
#include <atomic>
|
2018-04-02 00:19:46 +00:00
|
|
|
#include <functional>
|
2018-08-17 12:44:41 +00:00
|
|
|
#include <memory>
|
2017-09-12 23:33:50 +00:00
|
|
|
#include <string>
|
|
|
|
#include <thread>
|
2017-09-14 00:00:13 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2022-07-02 15:00:08 +00:00
|
|
|
#include "imgui.h"
|
|
|
|
|
2020-04-17 17:09:13 +00:00
|
|
|
#include "TracyBadVersion.hpp"
|
2018-08-17 20:23:16 +00:00
|
|
|
#include "TracyBuzzAnim.hpp"
|
2018-08-05 14:45:34 +00:00
|
|
|
#include "TracyDecayValue.hpp"
|
2021-05-15 12:25:45 +00:00
|
|
|
#include "TracyFileWrite.hpp"
|
2019-11-02 14:52:34 +00:00
|
|
|
#include "TracyShortPtr.hpp"
|
2021-03-27 12:25:21 +00:00
|
|
|
#include "TracySourceContents.hpp"
|
2022-08-15 11:29:45 +00:00
|
|
|
#include "TracyTimelineController.hpp"
|
2019-07-26 21:05:24 +00:00
|
|
|
#include "TracyUserData.hpp"
|
2017-09-15 18:17:39 +00:00
|
|
|
#include "TracyVector.hpp"
|
2019-08-28 17:35:54 +00:00
|
|
|
#include "TracyViewData.hpp"
|
2018-02-13 13:57:47 +00:00
|
|
|
#include "TracyWorker.hpp"
|
2020-01-28 20:49:36 +00:00
|
|
|
#include "tracy_robin_hood.h"
|
2017-09-12 23:33:50 +00:00
|
|
|
|
|
|
|
namespace tracy
|
|
|
|
{
|
|
|
|
|
2022-07-02 11:23:52 +00:00
|
|
|
constexpr const char* GpuContextNames[] = {
|
|
|
|
"Invalid",
|
|
|
|
"OpenGL",
|
|
|
|
"Vulkan",
|
|
|
|
"OpenCL",
|
|
|
|
"Direct3D 12",
|
|
|
|
"Direct3D 11"
|
|
|
|
};
|
|
|
|
|
2019-05-19 11:15:54 +00:00
|
|
|
struct MemoryPage;
|
2017-09-30 14:58:02 +00:00
|
|
|
class FileRead;
|
2020-03-22 19:53:59 +00:00
|
|
|
class SourceView;
|
2017-09-13 21:40:28 +00:00
|
|
|
|
2017-09-12 23:33:50 +00:00
|
|
|
class View
|
|
|
|
{
|
2017-11-27 21:41:30 +00:00
|
|
|
struct Animation
|
|
|
|
{
|
|
|
|
bool active = false;
|
|
|
|
int64_t start0, start1;
|
|
|
|
int64_t end0, end1;
|
|
|
|
double progress;
|
|
|
|
};
|
|
|
|
|
2018-03-04 21:21:35 +00:00
|
|
|
struct Region
|
|
|
|
{
|
|
|
|
bool active = false;
|
|
|
|
int64_t start;
|
|
|
|
int64_t end;
|
|
|
|
};
|
|
|
|
|
2019-10-20 01:24:58 +00:00
|
|
|
struct ZoneTimeData
|
|
|
|
{
|
|
|
|
int64_t time;
|
|
|
|
uint64_t count;
|
|
|
|
};
|
|
|
|
|
2021-06-05 18:41:21 +00:00
|
|
|
enum class AccumulationMode
|
|
|
|
{
|
|
|
|
SelfOnly,
|
|
|
|
AllChildren,
|
|
|
|
NonReentrantChildren
|
|
|
|
};
|
|
|
|
|
2020-11-01 15:24:08 +00:00
|
|
|
struct StatisticsCache
|
|
|
|
{
|
|
|
|
RangeSlim range;
|
2021-06-05 18:41:21 +00:00
|
|
|
AccumulationMode accumulationMode;
|
2020-11-01 15:24:08 +00:00
|
|
|
size_t sourceCount;
|
|
|
|
size_t count;
|
|
|
|
int64_t total;
|
|
|
|
};
|
|
|
|
|
2017-09-12 23:33:50 +00:00
|
|
|
public:
|
2019-02-21 20:18:41 +00:00
|
|
|
struct VisData
|
|
|
|
{
|
|
|
|
bool visible = true;
|
|
|
|
bool showFull = true;
|
2020-03-16 23:15:27 +00:00
|
|
|
bool ghost = false;
|
2019-02-21 20:18:41 +00:00
|
|
|
int offset = 0;
|
|
|
|
int height = 0;
|
|
|
|
};
|
|
|
|
|
2019-03-17 16:21:30 +00:00
|
|
|
struct PlotView
|
|
|
|
{
|
|
|
|
double min;
|
|
|
|
double max;
|
|
|
|
};
|
|
|
|
|
2018-08-17 15:24:18 +00:00
|
|
|
using SetTitleCallback = void(*)( const char* );
|
2021-11-18 21:22:11 +00:00
|
|
|
using SetScaleCallback = void(*)( float, ImFont*&, ImFont*&, ImFont*& );
|
2018-08-17 15:24:18 +00:00
|
|
|
|
2022-08-12 19:44:24 +00:00
|
|
|
View( void(*cbMainThread)(std::function<void()>, bool), ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, SetScaleCallback sscb = nullptr ) : View( cbMainThread, "127.0.0.1", 8086, fixedWidth, smallFont, bigFont, stcb, sscb ) {}
|
|
|
|
View( void(*cbMainThread)(std::function<void()>, bool), const char* addr, uint16_t port, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, SetScaleCallback sscb = nullptr );
|
|
|
|
View( void(*cbMainThread)(std::function<void()>, bool), FileRead& f, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, SetScaleCallback sscb = nullptr );
|
2017-09-12 23:33:50 +00:00
|
|
|
~View();
|
|
|
|
|
2018-04-29 23:16:08 +00:00
|
|
|
static bool Draw();
|
2017-09-13 00:08:35 +00:00
|
|
|
|
2018-08-17 14:54:56 +00:00
|
|
|
void NotifyRootWindowSize( float w, float h ) { m_rootWidth = w; m_rootHeight = h; }
|
2020-04-08 00:11:58 +00:00
|
|
|
void ViewSource( const char* fileName, int line );
|
|
|
|
void ViewSymbol( const char* fileName, int line, uint64_t baseAddr, uint64_t symAddr );
|
|
|
|
bool ViewDispatch( const char* fileName, int line, uint64_t symAddr );
|
2018-08-17 14:54:56 +00:00
|
|
|
|
2020-03-06 21:11:17 +00:00
|
|
|
bool ReconnectRequested() const { return m_reconnectRequested; }
|
2020-03-06 21:10:24 +00:00
|
|
|
std::string GetAddress() const { return m_worker.GetAddr(); }
|
2020-10-02 16:51:54 +00:00
|
|
|
uint16_t GetPort() const { return m_worker.GetPort(); }
|
2020-03-06 21:10:24 +00:00
|
|
|
|
2020-04-17 16:59:24 +00:00
|
|
|
const char* SourceSubstitution( const char* srcFile ) const;
|
|
|
|
|
2021-11-27 15:41:27 +00:00
|
|
|
void ShowSampleParents( uint64_t symAddr, bool withInlines ) { m_sampleParents.symAddr = symAddr; m_sampleParents.sel = 0; m_sampleParents.withInlines = withInlines; }
|
2020-08-09 19:11:18 +00:00
|
|
|
const ViewData& GetViewData() const { return m_vd; }
|
|
|
|
|
|
|
|
|
|
|
|
bool m_showRanges = false;
|
|
|
|
Range m_statRange;
|
2021-11-13 17:43:55 +00:00
|
|
|
Range m_waitStackRange;
|
2020-05-10 14:07:45 +00:00
|
|
|
|
2017-09-12 23:33:50 +00:00
|
|
|
private:
|
Change namespace shortening to zone name shortening.
Namespace shortening was kinda ok for function names produced by MSVC, which
are generally clean looking. However, gcc/clang like to produce function names
which include template arguments, function parameters, return values, etc. In
such cases the old algorithm simply didn't work, because removal of everything
before the last :: could as well happen in midst of function parameters list.
The result was certainly not an usable function name.
With this new approach namespaces are no longer explicitly mentioned and this
functionality is simply called zone name shortening.
The user-selectable options were changed to make the shortening always
enabled, disabled, or to apply as needed. Note that the "as needed" approach
will be dynamic, trying to gradually remove more and more from the name, until
it fits in the requested area.
Current implementation is only the first step into making this work. In this
first step the function parameters are reduced to () and the template
arguments are reduced to <>. This alone greatly improves readability of the
zone names.
The option to reduce namespaces to one letter (i.e. std::tr1::hash would
become s:t:hash) will no longer be present, now or in the future.
2022-08-15 12:19:57 +00:00
|
|
|
enum class ShortenName : uint8_t
|
2017-10-22 11:56:05 +00:00
|
|
|
{
|
Change namespace shortening to zone name shortening.
Namespace shortening was kinda ok for function names produced by MSVC, which
are generally clean looking. However, gcc/clang like to produce function names
which include template arguments, function parameters, return values, etc. In
such cases the old algorithm simply didn't work, because removal of everything
before the last :: could as well happen in midst of function parameters list.
The result was certainly not an usable function name.
With this new approach namespaces are no longer explicitly mentioned and this
functionality is simply called zone name shortening.
The user-selectable options were changed to make the shortening always
enabled, disabled, or to apply as needed. Note that the "as needed" approach
will be dynamic, trying to gradually remove more and more from the name, until
it fits in the requested area.
Current implementation is only the first step into making this work. In this
first step the function parameters are reduced to () and the template
arguments are reduced to <>. This alone greatly improves readability of the
zone names.
The option to reduce namespaces to one letter (i.e. std::tr1::hash would
become s:t:hash) will no longer be present, now or in the future.
2022-08-15 12:19:57 +00:00
|
|
|
Never,
|
|
|
|
Always,
|
|
|
|
WhenNoSpace
|
2017-10-22 11:56:05 +00:00
|
|
|
};
|
|
|
|
|
2018-12-22 16:36:20 +00:00
|
|
|
enum class ShortcutAction : uint8_t
|
|
|
|
{
|
|
|
|
None,
|
|
|
|
OpenFind
|
|
|
|
};
|
|
|
|
|
2018-12-16 18:58:11 +00:00
|
|
|
enum { InvalidId = 0xFFFFFFFF };
|
|
|
|
|
2021-11-13 20:28:56 +00:00
|
|
|
struct MemPathData
|
2019-02-06 12:46:50 +00:00
|
|
|
{
|
|
|
|
uint32_t cnt;
|
|
|
|
uint64_t mem;
|
|
|
|
};
|
|
|
|
|
2020-09-12 13:49:41 +00:00
|
|
|
enum class ViewMode
|
|
|
|
{
|
|
|
|
Paused,
|
|
|
|
LastFrames,
|
|
|
|
LastRange
|
|
|
|
};
|
|
|
|
|
2022-06-01 06:45:26 +00:00
|
|
|
enum class MemRange
|
|
|
|
{
|
|
|
|
Full,
|
|
|
|
Active,
|
|
|
|
Inactive
|
|
|
|
};
|
|
|
|
|
2021-06-19 14:20:35 +00:00
|
|
|
struct ZoneColorData
|
|
|
|
{
|
|
|
|
uint32_t color;
|
|
|
|
uint32_t accentColor;
|
|
|
|
float thickness;
|
|
|
|
bool highlight;
|
|
|
|
};
|
|
|
|
|
2021-09-04 14:03:42 +00:00
|
|
|
struct SymList
|
|
|
|
{
|
|
|
|
uint64_t symAddr;
|
|
|
|
uint32_t incl, excl;
|
|
|
|
uint32_t count;
|
|
|
|
};
|
|
|
|
|
2020-11-13 16:09:57 +00:00
|
|
|
void InitMemory();
|
2020-03-22 19:53:59 +00:00
|
|
|
void InitTextEditor( ImFont* font );
|
2018-08-17 12:44:41 +00:00
|
|
|
|
Change namespace shortening to zone name shortening.
Namespace shortening was kinda ok for function names produced by MSVC, which
are generally clean looking. However, gcc/clang like to produce function names
which include template arguments, function parameters, return values, etc. In
such cases the old algorithm simply didn't work, because removal of everything
before the last :: could as well happen in midst of function parameters list.
The result was certainly not an usable function name.
With this new approach namespaces are no longer explicitly mentioned and this
functionality is simply called zone name shortening.
The user-selectable options were changed to make the shortening always
enabled, disabled, or to apply as needed. Note that the "as needed" approach
will be dynamic, trying to gradually remove more and more from the name, until
it fits in the requested area.
Current implementation is only the first step into making this work. In this
first step the function parameters are reduced to () and the template
arguments are reduced to <>. This alone greatly improves readability of the
zone names.
The option to reduce namespaces to one letter (i.e. std::tr1::hash would
become s:t:hash) will no longer be present, now or in the future.
2022-08-15 12:19:57 +00:00
|
|
|
const char* ShortenZoneName( const char* name, ImVec2& tsz, float zsz ) const;
|
2017-10-22 11:56:05 +00:00
|
|
|
|
2018-04-29 23:16:08 +00:00
|
|
|
bool DrawImpl();
|
2019-08-28 18:27:39 +00:00
|
|
|
void DrawNotificationArea();
|
2018-11-25 18:29:20 +00:00
|
|
|
bool DrawConnection();
|
2017-09-18 00:37:25 +00:00
|
|
|
void DrawFrames();
|
2022-07-02 13:38:10 +00:00
|
|
|
void DrawTimelineFramesHeader();
|
|
|
|
void DrawTimelineFrames( const FrameData& frames );
|
|
|
|
void DrawTimeline();
|
2021-11-13 00:21:47 +00:00
|
|
|
void DrawContextSwitches( const ContextSwitch* ctx, const Vector<SampleData>& sampleData, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int endOffset, bool isFiber );
|
2020-02-22 17:51:45 +00:00
|
|
|
void DrawSamples( const Vector<SampleData>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset );
|
2020-03-17 01:10:36 +00:00
|
|
|
#ifndef TRACY_NO_STATISTICS
|
|
|
|
int DispatchGhostLevel( const Vector<GhostZone>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, float yMin, float yMax, uint64_t tid );
|
|
|
|
int DrawGhostLevel( const Vector<GhostZone>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, float yMin, float yMax, uint64_t tid );
|
|
|
|
int SkipGhostLevel( const Vector<GhostZone>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, float yMin, float yMax, uint64_t tid );
|
|
|
|
#endif
|
2019-11-02 15:17:20 +00:00
|
|
|
int DispatchZoneLevel( const Vector<short_ptr<ZoneEvent>>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, float yMin, float yMax, uint64_t tid );
|
2019-11-09 22:05:01 +00:00
|
|
|
template<typename Adapter, typename V>
|
|
|
|
int DrawZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, float yMin, float yMax, uint64_t tid );
|
|
|
|
template<typename Adapter, typename V>
|
|
|
|
int SkipZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, float yMin, float yMax, uint64_t tid );
|
2019-11-02 14:52:34 +00:00
|
|
|
int DispatchGpuZoneLevel( const Vector<short_ptr<GpuEvent>>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, uint64_t thread, float yMin, float yMax, int64_t begin, int drift );
|
2019-11-10 00:30:10 +00:00
|
|
|
template<typename Adapter, typename V>
|
|
|
|
int DrawGpuZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, uint64_t thread, float yMin, float yMax, int64_t begin, int drift );
|
|
|
|
template<typename Adapter, typename V>
|
|
|
|
int SkipGpuZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, uint64_t thread, float yMin, float yMax, int64_t begin, int drift );
|
2019-02-24 16:30:58 +00:00
|
|
|
void DrawLockHeader( uint32_t id, const LockMap& lockmap, const SourceLocation& srcloc, bool hover, ImDrawList* draw, const ImVec2& wpos, float w, float ty, float offset, uint8_t tid );
|
2018-04-20 20:53:15 +00:00
|
|
|
int DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int offset, LockHighlight& highlight, float yMin, float yMax );
|
2018-04-20 21:00:26 +00:00
|
|
|
int DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, float yMin, float yMax );
|
2020-09-25 15:51:05 +00:00
|
|
|
void DrawPlotPoint( const ImVec2& wpos, float x, float y, int offset, uint32_t color, bool hover, bool hasPrev, const PlotItem* item, double prev, bool merged, PlotType type, PlotValueFormatting format, float PlotHeight, uint64_t name );
|
2019-11-05 17:08:42 +00:00
|
|
|
void DrawPlotPoint( const ImVec2& wpos, float x, float y, int offset, uint32_t color, bool hover, bool hasPrev, double val, double prev, bool merged, PlotValueFormatting format, float PlotHeight );
|
2019-08-16 16:22:46 +00:00
|
|
|
int DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover, float yMin, float yMax );
|
2017-10-13 11:32:23 +00:00
|
|
|
void DrawOptions();
|
2017-10-14 12:36:30 +00:00
|
|
|
void DrawMessages();
|
2020-07-12 13:07:43 +00:00
|
|
|
void DrawMessageLine( const MessageData& msg, bool hasCallstack, int& idx );
|
2018-01-17 11:49:50 +00:00
|
|
|
void DrawFindZone();
|
2021-06-26 04:27:45 +00:00
|
|
|
void AccumulationModeComboBox();
|
2018-03-24 13:40:48 +00:00
|
|
|
void DrawStatistics();
|
2021-09-04 14:07:09 +00:00
|
|
|
void DrawSamplesStatistics(Vector<SymList>& data, int64_t timeRange, AccumulationMode accumulationMode);
|
2018-04-01 18:34:21 +00:00
|
|
|
void DrawMemory();
|
2018-09-27 21:16:10 +00:00
|
|
|
void DrawAllocList();
|
2018-04-21 22:52:33 +00:00
|
|
|
void DrawCompare();
|
2018-06-20 11:23:08 +00:00
|
|
|
void DrawCallstackWindow();
|
2021-11-13 14:56:57 +00:00
|
|
|
void DrawCallstackTable( uint32_t callstack, bool globalEntriesButton );
|
2018-07-17 21:03:03 +00:00
|
|
|
void DrawMemoryAllocWindow();
|
2018-08-08 17:25:13 +00:00
|
|
|
void DrawInfo();
|
2018-08-17 13:33:12 +00:00
|
|
|
void DrawTextEditor();
|
2018-12-16 18:58:11 +00:00
|
|
|
void DrawLockInfoWindow();
|
2019-06-11 23:26:49 +00:00
|
|
|
void DrawPlayback();
|
2019-08-18 10:28:38 +00:00
|
|
|
void DrawCpuDataWindow();
|
2019-10-13 13:50:37 +00:00
|
|
|
void DrawSelectedAnnotation();
|
2019-10-14 18:37:24 +00:00
|
|
|
void DrawAnnotationList();
|
2020-02-29 17:15:59 +00:00
|
|
|
void DrawSampleParents();
|
2020-07-31 14:37:47 +00:00
|
|
|
void DrawRanges();
|
2020-08-04 15:02:04 +00:00
|
|
|
void DrawRangeEntry( Range& range, const char* label, uint32_t color, const char* popupLabel, int id );
|
2021-03-27 12:25:21 +00:00
|
|
|
void DrawSourceTooltip( const char* filename, uint32_t line, int before = 3, int after = 3, bool separateTooltip = true );
|
2021-11-13 14:58:25 +00:00
|
|
|
void DrawWaitStacks();
|
2017-09-15 00:30:22 +00:00
|
|
|
|
2020-09-25 15:51:05 +00:00
|
|
|
void ListMemData( std::vector<const MemEvent*>& vec, std::function<void(const MemEvent*)> DrawAddress, const char* id = nullptr, int64_t startTime = -1, uint64_t pool = 0 );
|
2018-04-02 00:19:46 +00:00
|
|
|
|
2022-06-01 06:45:26 +00:00
|
|
|
unordered_flat_map<uint32_t, MemPathData> GetCallstackPaths( const MemData& mem, MemRange memRange ) const;
|
2021-11-13 20:26:28 +00:00
|
|
|
unordered_flat_map<uint64_t, MemCallstackFrameTree> GetCallstackFrameTreeBottomUp( const MemData& mem ) const;
|
|
|
|
unordered_flat_map<uint64_t, MemCallstackFrameTree> GetCallstackFrameTreeTopDown( const MemData& mem ) const;
|
|
|
|
void DrawFrameTreeLevel( const unordered_flat_map<uint64_t, MemCallstackFrameTree>& tree, int& idx );
|
2020-12-09 20:18:40 +00:00
|
|
|
void DrawZoneList( int id, const Vector<short_ptr<ZoneEvent>>& zones );
|
2018-08-14 16:37:06 +00:00
|
|
|
|
2021-11-13 20:49:04 +00:00
|
|
|
unordered_flat_map<uint64_t, CallstackFrameTree> GetCallstackFrameTreeBottomUp( const unordered_flat_map<uint32_t, uint64_t>& stacks, bool group ) const;
|
|
|
|
unordered_flat_map<uint64_t, CallstackFrameTree> GetCallstackFrameTreeTopDown( const unordered_flat_map<uint32_t, uint64_t>& stacks, bool group ) const;
|
2021-11-13 21:05:30 +00:00
|
|
|
void DrawFrameTreeLevel( const unordered_flat_map<uint64_t, CallstackFrameTree>& tree, int& idx );
|
2021-11-13 20:49:04 +00:00
|
|
|
|
2021-12-31 14:01:06 +00:00
|
|
|
unordered_flat_map<uint64_t, CallstackFrameTree> GetParentsCallstackFrameTreeBottomUp( const unordered_flat_map<uint32_t, uint32_t>& stacks, bool group ) const;
|
|
|
|
unordered_flat_map<uint64_t, CallstackFrameTree> GetParentsCallstackFrameTreeTopDown( const unordered_flat_map<uint32_t, uint32_t>& stacks, bool group ) const;
|
|
|
|
void DrawParentsFrameTreeLevel( const unordered_flat_map<uint64_t, CallstackFrameTree>& tree, int& idx );
|
|
|
|
|
2017-11-12 00:25:44 +00:00
|
|
|
void DrawInfoWindow();
|
|
|
|
void DrawZoneInfoWindow();
|
|
|
|
void DrawGpuInfoWindow();
|
|
|
|
|
2019-11-10 00:23:44 +00:00
|
|
|
template<typename Adapter, typename V>
|
|
|
|
void DrawZoneInfoChildren( const V& children, int64_t ztime );
|
2019-11-10 01:03:31 +00:00
|
|
|
template<typename Adapter, typename V>
|
|
|
|
void DrawGpuInfoChildren( const V& children, int64_t ztime );
|
2019-11-10 00:23:44 +00:00
|
|
|
|
2020-07-29 16:42:15 +00:00
|
|
|
void HandleRange( Range& range, int64_t timespan, const ImVec2& wpos, float w );
|
2022-07-02 13:42:01 +00:00
|
|
|
void HandleTimelineMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns );
|
2017-10-12 20:27:17 +00:00
|
|
|
|
2022-03-15 16:25:28 +00:00
|
|
|
void AddAnnotation( int64_t start, int64_t end );
|
|
|
|
|
2019-09-11 16:34:48 +00:00
|
|
|
uint32_t GetThreadColor( uint64_t thread, int depth );
|
2019-11-02 21:45:11 +00:00
|
|
|
uint32_t GetSrcLocColor( const SourceLocation& srcloc, int depth );
|
|
|
|
uint32_t GetRawSrcLocColor( const SourceLocation& srcloc, int depth );
|
2019-09-08 12:33:30 +00:00
|
|
|
uint32_t GetZoneColor( const ZoneEvent& ev, uint64_t thread, int depth );
|
2017-11-11 21:56:05 +00:00
|
|
|
uint32_t GetZoneColor( const GpuEvent& ev );
|
2021-06-19 14:20:35 +00:00
|
|
|
ZoneColorData GetZoneColorData( const ZoneEvent& ev, uint64_t thread, int depth );
|
|
|
|
ZoneColorData GetZoneColorData( const GpuEvent& ev );
|
2017-10-01 17:31:22 +00:00
|
|
|
|
2017-10-22 13:37:24 +00:00
|
|
|
void ZoomToZone( const ZoneEvent& ev );
|
2017-11-11 21:56:05 +00:00
|
|
|
void ZoomToZone( const GpuEvent& ev );
|
2020-09-12 13:49:41 +00:00
|
|
|
void ZoomToRange( int64_t start, int64_t end, bool pause = true );
|
2018-06-02 20:27:35 +00:00
|
|
|
void ZoomToPrevFrame();
|
|
|
|
void ZoomToNextFrame();
|
2018-06-22 18:21:02 +00:00
|
|
|
void CenterAtTime( int64_t t );
|
2017-11-27 21:12:26 +00:00
|
|
|
|
2018-05-02 17:23:46 +00:00
|
|
|
void ShowZoneInfo( const ZoneEvent& ev );
|
|
|
|
void ShowZoneInfo( const GpuEvent& ev, uint64_t thread );
|
|
|
|
|
2017-10-22 13:37:24 +00:00
|
|
|
void ZoneTooltip( const ZoneEvent& ev );
|
2017-11-11 21:56:05 +00:00
|
|
|
void ZoneTooltip( const GpuEvent& ev );
|
2018-06-19 20:19:33 +00:00
|
|
|
void CallstackTooltip( uint32_t idx );
|
2021-11-13 00:08:36 +00:00
|
|
|
void CallstackTooltipContents( uint32_t idx );
|
2019-06-26 19:01:54 +00:00
|
|
|
void CrashTooltip();
|
2018-06-19 20:19:33 +00:00
|
|
|
|
2017-10-22 14:15:27 +00:00
|
|
|
const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const;
|
2019-10-31 13:59:52 +00:00
|
|
|
const ZoneEvent* GetZoneParent( const ZoneEvent& zone, uint64_t tid ) const;
|
2022-07-23 11:31:41 +00:00
|
|
|
const ZoneEvent* GetZoneChild( const ZoneEvent& zone, int64_t time ) const;
|
2021-06-05 18:01:05 +00:00
|
|
|
bool IsZoneReentry( const ZoneEvent& zone ) const;
|
|
|
|
bool IsZoneReentry( const ZoneEvent& zone, uint64_t tid ) const;
|
2017-11-12 00:25:44 +00:00
|
|
|
const GpuEvent* GetZoneParent( const GpuEvent& zone ) const;
|
2019-03-17 15:17:47 +00:00
|
|
|
const ThreadData* GetZoneThreadData( const ZoneEvent& zone ) const;
|
2018-03-18 15:38:42 +00:00
|
|
|
uint64_t GetZoneThread( const ZoneEvent& zone ) const;
|
2018-03-19 15:11:37 +00:00
|
|
|
uint64_t GetZoneThread( const GpuEvent& zone ) const;
|
2018-06-27 23:07:21 +00:00
|
|
|
const GpuCtxData* GetZoneCtx( const GpuEvent& zone ) const;
|
2021-05-22 08:11:53 +00:00
|
|
|
bool FindMatchingZone( int prev0, int prev1, int flags );
|
2018-04-01 19:47:08 +00:00
|
|
|
const ZoneEvent* FindZoneAtTime( uint64_t thread, int64_t time ) const;
|
2019-08-26 17:01:51 +00:00
|
|
|
uint64_t GetFrameNumber( const FrameData& fd, int i, uint64_t offset ) const;
|
2018-08-04 19:19:24 +00:00
|
|
|
const char* GetFrameText( const FrameData& fd, int i, uint64_t ftime, uint64_t offset ) const;
|
2022-07-30 17:32:25 +00:00
|
|
|
const char* GetFrameSetName( const FrameData& fd ) const;
|
|
|
|
static const char* GetFrameSetName( const FrameData& fd, const Worker& worker );
|
2017-09-29 19:57:00 +00:00
|
|
|
|
2018-03-18 11:55:54 +00:00
|
|
|
#ifndef TRACY_NO_STATISTICS
|
2018-01-17 11:49:50 +00:00
|
|
|
void FindZones();
|
2018-04-21 22:52:33 +00:00
|
|
|
void FindZonesCompare();
|
2018-03-18 11:55:54 +00:00
|
|
|
#endif
|
2018-01-17 11:49:50 +00:00
|
|
|
|
2019-05-19 11:15:54 +00:00
|
|
|
std::vector<MemoryPage> GetMemoryPages() const;
|
2018-04-28 13:49:51 +00:00
|
|
|
const char* GetPlotName( const PlotData* plot ) const;
|
2022-07-23 23:26:20 +00:00
|
|
|
uint32_t GetPlotColor( const PlotData* plot ) const;
|
2018-04-02 16:14:59 +00:00
|
|
|
|
2019-02-27 01:27:05 +00:00
|
|
|
void SmallCallstackButton( const char* name, uint32_t callstack, int& idx, bool tooltip = true );
|
2020-03-28 17:04:33 +00:00
|
|
|
void DrawCallstackCalls( uint32_t callstack, uint16_t limit ) const;
|
2018-10-21 14:03:21 +00:00
|
|
|
void SetViewToLastFrames();
|
2019-01-23 12:39:44 +00:00
|
|
|
int64_t GetZoneChildTime( const ZoneEvent& zone );
|
2019-02-14 00:28:12 +00:00
|
|
|
int64_t GetZoneChildTime( const GpuEvent& zone );
|
2019-01-23 12:59:14 +00:00
|
|
|
int64_t GetZoneChildTimeFast( const ZoneEvent& zone );
|
2020-10-02 16:37:15 +00:00
|
|
|
int64_t GetZoneChildTimeFastClamped( const ZoneEvent& zone, int64_t t0, int64_t t1 );
|
2019-03-29 23:52:25 +00:00
|
|
|
int64_t GetZoneSelfTime( const ZoneEvent& zone );
|
|
|
|
int64_t GetZoneSelfTime( const GpuEvent& zone );
|
2019-08-14 15:54:50 +00:00
|
|
|
bool GetZoneRunningTime( const ContextSwitch* ctx, const ZoneEvent& ev, int64_t& time, uint64_t& cnt );
|
2020-05-03 12:21:27 +00:00
|
|
|
const char* GetThreadContextData( uint64_t thread, bool& local, bool& untracked, const char*& program );
|
2018-07-17 20:53:38 +00:00
|
|
|
|
2020-01-30 00:57:49 +00:00
|
|
|
tracy_force_inline void CalcZoneTimeData( unordered_flat_map<int16_t, ZoneTimeData>& data, int64_t& ztime, const ZoneEvent& zone );
|
|
|
|
tracy_force_inline void CalcZoneTimeData( const ContextSwitch* ctx, unordered_flat_map<int16_t, ZoneTimeData>& data, int64_t& ztime, const ZoneEvent& zone );
|
2019-11-10 00:08:15 +00:00
|
|
|
template<typename Adapter, typename V>
|
2020-01-30 00:57:49 +00:00
|
|
|
void CalcZoneTimeDataImpl( const V& children, unordered_flat_map<int16_t, ZoneTimeData>& data, int64_t& ztime, const ZoneEvent& zone );
|
2019-11-10 00:08:15 +00:00
|
|
|
template<typename Adapter, typename V>
|
2020-01-30 00:57:49 +00:00
|
|
|
void CalcZoneTimeDataImpl( const V& children, const ContextSwitch* ctx, unordered_flat_map<int16_t, ZoneTimeData>& data, int64_t& ztime, const ZoneEvent& zone );
|
2019-10-09 20:13:52 +00:00
|
|
|
|
2019-06-12 22:12:06 +00:00
|
|
|
void SetPlaybackFrame( uint32_t idx );
|
2021-05-15 13:50:20 +00:00
|
|
|
bool Save( const char* fn, FileWrite::Compression comp, int zlevel, bool buildDict );
|
2019-06-12 22:12:06 +00:00
|
|
|
|
2020-01-28 20:49:36 +00:00
|
|
|
unordered_flat_map<const void*, VisData> m_visData;
|
|
|
|
unordered_flat_map<uint64_t, bool> m_visibleMsgThread;
|
2021-11-13 17:20:06 +00:00
|
|
|
unordered_flat_map<uint64_t, bool> m_waitStackThread;
|
2020-01-28 20:49:36 +00:00
|
|
|
unordered_flat_map<const void*, int> m_gpuDrift;
|
|
|
|
unordered_flat_map<const PlotData*, PlotView> m_plotView;
|
2019-03-24 12:37:43 +00:00
|
|
|
Vector<const ThreadData*> m_threadOrder;
|
2019-07-11 18:28:04 +00:00
|
|
|
Vector<float> m_threadDnd;
|
2018-03-20 14:33:38 +00:00
|
|
|
|
2019-02-21 19:24:08 +00:00
|
|
|
tracy_force_inline VisData& Vis( const void* ptr )
|
2018-02-13 13:57:47 +00:00
|
|
|
{
|
2019-03-19 21:12:24 +00:00
|
|
|
auto it = m_visData.find( ptr );
|
|
|
|
if( it == m_visData.end() )
|
|
|
|
{
|
|
|
|
it = m_visData.emplace( ptr, VisData {} ).first;
|
|
|
|
}
|
|
|
|
return it->second;
|
2018-02-13 13:57:47 +00:00
|
|
|
}
|
2017-09-30 14:20:08 +00:00
|
|
|
|
2018-08-18 17:57:36 +00:00
|
|
|
tracy_force_inline bool& VisibleMsgThread( uint64_t thread )
|
|
|
|
{
|
|
|
|
auto it = m_visibleMsgThread.find( thread );
|
|
|
|
if( it == m_visibleMsgThread.end() )
|
|
|
|
{
|
|
|
|
it = m_visibleMsgThread.emplace( thread, true ).first;
|
|
|
|
}
|
|
|
|
return it->second;
|
|
|
|
}
|
|
|
|
|
2021-11-13 17:20:06 +00:00
|
|
|
tracy_force_inline bool& WaitStackThread( uint64_t thread )
|
|
|
|
{
|
|
|
|
auto it = m_waitStackThread.find( thread );
|
|
|
|
if( it == m_waitStackThread.end() )
|
|
|
|
{
|
|
|
|
it = m_waitStackThread.emplace( thread, true ).first;
|
|
|
|
}
|
|
|
|
return it->second;
|
|
|
|
}
|
|
|
|
|
2018-06-27 23:08:08 +00:00
|
|
|
tracy_force_inline int& GpuDrift( const void* ptr )
|
|
|
|
{
|
|
|
|
auto it = m_gpuDrift.find( ptr );
|
|
|
|
if( it == m_gpuDrift.end() )
|
|
|
|
{
|
|
|
|
it = m_gpuDrift.emplace( ptr, 0 ).first;
|
|
|
|
}
|
|
|
|
return it->second;
|
|
|
|
}
|
|
|
|
|
2020-04-12 21:41:18 +00:00
|
|
|
void AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset );
|
2022-07-02 12:35:11 +00:00
|
|
|
float AdjustThreadPosition( View::VisData& vis, float wy, int& offset );
|
2022-07-02 11:16:06 +00:00
|
|
|
static int64_t AdjustGpuTime( int64_t time, int64_t begin, int drift );
|
2020-04-12 21:41:18 +00:00
|
|
|
|
2022-07-02 11:35:47 +00:00
|
|
|
static const char* DecodeContextSwitchState( uint8_t state );
|
|
|
|
static const char* DecodeContextSwitchStateCode( uint8_t state );
|
|
|
|
static const char* DecodeContextSwitchReason( uint8_t reason );
|
|
|
|
static const char* DecodeContextSwitchReasonCode( uint8_t reason );
|
|
|
|
|
2018-02-13 13:57:47 +00:00
|
|
|
Worker m_worker;
|
2021-05-15 12:25:45 +00:00
|
|
|
std::string m_filename, m_filenameStaging;
|
2017-09-30 14:58:02 +00:00
|
|
|
bool m_staticView;
|
2020-09-12 13:49:41 +00:00
|
|
|
ViewMode m_viewMode;
|
2020-10-06 16:46:36 +00:00
|
|
|
bool m_viewModeHeuristicTry = false;
|
2020-05-07 23:49:15 +00:00
|
|
|
DecayValue<bool> m_forceConnectionPopup = false;
|
2020-11-13 16:09:57 +00:00
|
|
|
uint64_t m_totalMemory;
|
2017-09-20 19:21:21 +00:00
|
|
|
|
2019-08-28 17:35:54 +00:00
|
|
|
ViewData m_vd;
|
2022-08-15 11:29:45 +00:00
|
|
|
TimelineController m_tc;
|
2017-09-24 14:10:28 +00:00
|
|
|
|
2018-12-22 16:22:26 +00:00
|
|
|
const ZoneEvent* m_zoneInfoWindow = nullptr;
|
2017-10-22 13:37:24 +00:00
|
|
|
const ZoneEvent* m_zoneHighlight;
|
2019-08-15 15:42:26 +00:00
|
|
|
DecayValue<int16_t> m_zoneSrcLocHighlight = 0;
|
2018-12-22 16:22:26 +00:00
|
|
|
LockHighlight m_lockHighlight { -1 };
|
|
|
|
DecayValue<const MessageData*> m_msgHighlight = nullptr;
|
2019-02-17 15:20:56 +00:00
|
|
|
DecayValue<uint32_t> m_lockHoverHighlight = InvalidId;
|
2019-07-24 19:40:39 +00:00
|
|
|
DecayValue<const MessageData*> m_msgToFocus = nullptr;
|
2018-12-22 16:22:26 +00:00
|
|
|
const GpuEvent* m_gpuInfoWindow = nullptr;
|
2017-11-12 00:28:07 +00:00
|
|
|
const GpuEvent* m_gpuHighlight;
|
2017-11-13 23:48:26 +00:00
|
|
|
uint64_t m_gpuInfoWindowThread;
|
2018-12-22 16:22:26 +00:00
|
|
|
uint32_t m_callstackInfoWindow = 0;
|
|
|
|
int64_t m_memoryAllocInfoWindow = -1;
|
2020-09-25 15:51:05 +00:00
|
|
|
uint64_t m_memoryAllocInfoPool = 0;
|
2018-12-22 16:22:26 +00:00
|
|
|
int64_t m_memoryAllocHover = -1;
|
2020-09-25 15:51:05 +00:00
|
|
|
uint64_t m_memoryAllocHoverPool = 0;
|
2018-12-22 16:22:26 +00:00
|
|
|
int m_memoryAllocHoverWait = 0;
|
2018-08-04 17:47:09 +00:00
|
|
|
const FrameData* m_frames;
|
2018-12-22 16:22:26 +00:00
|
|
|
uint32_t m_lockInfoWindow = InvalidId;
|
2019-11-02 15:17:20 +00:00
|
|
|
const ZoneEvent* m_zoneHover = nullptr;
|
2019-12-28 16:50:54 +00:00
|
|
|
DecayValue<const ZoneEvent*> m_zoneHover2 = nullptr;
|
2019-06-16 22:59:16 +00:00
|
|
|
int m_frameHover = -1;
|
2019-07-12 23:25:37 +00:00
|
|
|
bool m_messagesScrollBottom;
|
2019-07-12 23:48:43 +00:00
|
|
|
ImGuiTextFilter m_messageFilter;
|
2020-02-24 00:29:57 +00:00
|
|
|
bool m_showMessageImages = false;
|
2019-07-31 00:16:14 +00:00
|
|
|
int m_visibleMessages = 0;
|
2020-07-12 13:26:05 +00:00
|
|
|
size_t m_prevMessages = 0;
|
2022-04-18 13:06:23 +00:00
|
|
|
bool m_messagesShowCallstack = false;
|
2020-07-12 13:26:05 +00:00
|
|
|
Vector<uint32_t> m_msgList;
|
2019-08-01 21:14:09 +00:00
|
|
|
bool m_disconnectIssued = false;
|
2019-09-12 18:08:57 +00:00
|
|
|
DecayValue<uint64_t> m_drawThreadMigrations = 0;
|
2019-09-29 16:49:48 +00:00
|
|
|
DecayValue<uint64_t> m_drawThreadHighlight = 0;
|
2019-10-13 13:50:37 +00:00
|
|
|
Annotation* m_selectedAnnotation = nullptr;
|
2020-05-23 14:40:15 +00:00
|
|
|
bool m_reactToCrash = false;
|
2020-11-18 00:23:46 +00:00
|
|
|
bool m_reactToLostConnection = false;
|
2017-10-13 11:32:23 +00:00
|
|
|
|
2020-08-04 12:15:28 +00:00
|
|
|
ImGuiTextFilter m_statisticsFilter;
|
2020-08-21 12:23:23 +00:00
|
|
|
ImGuiTextFilter m_statisticsImageFilter;
|
2020-08-04 12:15:28 +00:00
|
|
|
|
2018-03-04 21:21:35 +00:00
|
|
|
Region m_highlight;
|
2018-07-29 18:15:49 +00:00
|
|
|
Region m_highlightZoom;
|
2017-10-15 14:42:56 +00:00
|
|
|
|
2019-11-24 00:40:32 +00:00
|
|
|
DecayValue<uint64_t> m_cpuDataThread = 0;
|
2018-12-22 16:22:26 +00:00
|
|
|
uint64_t m_gpuThread = 0;
|
|
|
|
int64_t m_gpuStart = 0;
|
|
|
|
int64_t m_gpuEnd = 0;
|
|
|
|
|
|
|
|
bool m_showOptions = false;
|
|
|
|
bool m_showMessages = false;
|
|
|
|
bool m_showStatistics = false;
|
|
|
|
bool m_showInfo = false;
|
2019-06-11 23:26:49 +00:00
|
|
|
bool m_showPlayback = false;
|
2019-08-18 10:28:38 +00:00
|
|
|
bool m_showCpuDataWindow = false;
|
2019-10-14 18:37:24 +00:00
|
|
|
bool m_showAnnotationList = false;
|
2021-11-13 14:58:25 +00:00
|
|
|
bool m_showWaitStacks = false;
|
2018-12-22 16:22:26 +00:00
|
|
|
|
2021-06-05 18:41:21 +00:00
|
|
|
AccumulationMode m_statAccumulationMode = AccumulationMode::SelfOnly;
|
2020-02-27 01:08:20 +00:00
|
|
|
bool m_statSampleTime = true;
|
2020-02-27 11:24:28 +00:00
|
|
|
int m_statMode = 0;
|
2020-03-30 21:58:42 +00:00
|
|
|
int m_statSampleLocation = 2;
|
2020-03-25 21:53:47 +00:00
|
|
|
bool m_statHideUnknown = true;
|
2020-03-26 21:22:09 +00:00
|
|
|
bool m_showAllSymbols = false;
|
2020-02-26 18:01:21 +00:00
|
|
|
int m_showCallstackFrameAddress = 0;
|
2018-12-22 16:22:26 +00:00
|
|
|
bool m_showUnknownFrames = true;
|
2020-04-09 17:44:42 +00:00
|
|
|
bool m_statSeparateInlines = false;
|
2020-05-30 13:31:41 +00:00
|
|
|
bool m_statShowAddress = false;
|
2021-06-15 23:43:09 +00:00
|
|
|
bool m_statShowKernel = true;
|
2019-02-10 15:14:13 +00:00
|
|
|
bool m_groupChildrenLocations = false;
|
2019-03-17 15:53:09 +00:00
|
|
|
bool m_allocTimeRelativeToZone = true;
|
2019-08-14 16:25:12 +00:00
|
|
|
bool m_ctxSwitchTimeRelativeToZone = true;
|
2019-11-27 00:42:44 +00:00
|
|
|
bool m_messageTimeRelativeToZone = true;
|
2022-07-23 11:19:30 +00:00
|
|
|
bool m_messagesExcludeChildren = true;
|
2020-10-05 23:24:32 +00:00
|
|
|
uint64_t m_zoneInfoMemPool = 0;
|
2021-11-13 14:58:25 +00:00
|
|
|
int m_waitStack = 0;
|
2021-11-13 20:54:04 +00:00
|
|
|
int m_waitStackMode = 0;
|
|
|
|
bool m_groupWaitStackBottomUp = true;
|
|
|
|
bool m_groupWaitStackTopDown = true;
|
2018-12-22 16:22:26 +00:00
|
|
|
|
2018-12-22 16:36:20 +00:00
|
|
|
ShortcutAction m_shortcut = ShortcutAction::None;
|
Change namespace shortening to zone name shortening.
Namespace shortening was kinda ok for function names produced by MSVC, which
are generally clean looking. However, gcc/clang like to produce function names
which include template arguments, function parameters, return values, etc. In
such cases the old algorithm simply didn't work, because removal of everything
before the last :: could as well happen in midst of function parameters list.
The result was certainly not an usable function name.
With this new approach namespaces are no longer explicitly mentioned and this
functionality is simply called zone name shortening.
The user-selectable options were changed to make the shortening always
enabled, disabled, or to apply as needed. Note that the "as needed" approach
will be dynamic, trying to gradually remove more and more from the name, until
it fits in the requested area.
Current implementation is only the first step into making this work. In this
first step the function parameters are reduced to () and the template
arguments are reduced to <>. This alone greatly improves readability of the
zone names.
The option to reduce namespaces to one letter (i.e. std::tr1::hash would
become s:t:hash) will no longer be present, now or in the future.
2022-08-15 12:19:57 +00:00
|
|
|
ShortenName m_shortenName = ShortenName::WhenNoSpace;
|
2017-11-27 21:41:30 +00:00
|
|
|
Animation m_zoomAnim;
|
2018-08-17 20:23:16 +00:00
|
|
|
BuzzAnim<int> m_callstackBuzzAnim;
|
2020-02-29 17:15:59 +00:00
|
|
|
BuzzAnim<int> m_sampleParentBuzzAnim;
|
2018-08-17 20:51:26 +00:00
|
|
|
BuzzAnim<int> m_callstackTreeBuzzAnim;
|
2018-08-18 12:26:10 +00:00
|
|
|
BuzzAnim<const void*> m_zoneinfoBuzzAnim;
|
2018-08-18 18:35:25 +00:00
|
|
|
BuzzAnim<int> m_findZoneBuzzAnim;
|
2019-08-15 15:42:26 +00:00
|
|
|
BuzzAnim<int16_t> m_optionsLockBuzzAnim;
|
2018-12-16 18:58:11 +00:00
|
|
|
BuzzAnim<uint32_t> m_lockInfoAnim;
|
2019-03-08 23:15:23 +00:00
|
|
|
BuzzAnim<uint32_t> m_statBuzzAnim;
|
2017-10-22 11:56:05 +00:00
|
|
|
|
2018-05-02 17:23:46 +00:00
|
|
|
Vector<const ZoneEvent*> m_zoneInfoStack;
|
|
|
|
Vector<const GpuEvent*> m_gpuInfoStack;
|
|
|
|
|
2021-03-27 12:25:21 +00:00
|
|
|
SourceContents m_srcHintCache;
|
2020-03-22 19:53:59 +00:00
|
|
|
std::unique_ptr<SourceView> m_sourceView;
|
|
|
|
const char* m_sourceViewFile;
|
2020-05-06 22:53:31 +00:00
|
|
|
bool m_uarchSet = false;
|
2018-08-17 12:44:41 +00:00
|
|
|
|
2019-08-16 14:02:57 +00:00
|
|
|
ImFont* m_smallFont;
|
2019-07-12 17:16:56 +00:00
|
|
|
ImFont* m_bigFont;
|
2021-03-27 12:16:19 +00:00
|
|
|
ImFont* m_fixedFont;
|
2019-07-12 17:16:56 +00:00
|
|
|
|
2018-08-17 14:54:56 +00:00
|
|
|
float m_rootWidth, m_rootHeight;
|
2018-08-17 15:24:18 +00:00
|
|
|
SetTitleCallback m_stcb;
|
2018-12-22 16:22:26 +00:00
|
|
|
bool m_titleSet = false;
|
2021-11-18 21:22:11 +00:00
|
|
|
SetScaleCallback m_sscb;
|
2018-08-17 14:54:56 +00:00
|
|
|
|
2019-01-06 18:14:24 +00:00
|
|
|
float m_notificationTime = 0;
|
|
|
|
std::string m_notificationText;
|
|
|
|
|
2019-02-06 22:09:38 +00:00
|
|
|
bool m_groupCallstackTreeByNameBottomUp = true;
|
|
|
|
bool m_groupCallstackTreeByNameTopDown = true;
|
2022-06-01 06:45:26 +00:00
|
|
|
MemRange m_memRangeBottomUp = MemRange::Full;
|
|
|
|
MemRange m_memRangeTopDown = MemRange::Full;
|
2019-02-06 20:45:26 +00:00
|
|
|
|
2019-05-28 17:56:18 +00:00
|
|
|
enum class SaveThreadState
|
|
|
|
{
|
|
|
|
Inert,
|
|
|
|
Saving,
|
|
|
|
NeedsJoin
|
|
|
|
};
|
|
|
|
|
2021-05-22 08:11:53 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
FindMatchingZoneFlagDefault = 0,
|
|
|
|
FindMatchingZoneFlagSourceFile = (1 << 0),
|
|
|
|
FindMatchingZoneFlagLineNum = (1 << 1),
|
|
|
|
};
|
|
|
|
|
2019-06-02 11:15:55 +00:00
|
|
|
std::atomic<SaveThreadState> m_saveThreadState { SaveThreadState::Inert };
|
2019-05-28 17:56:18 +00:00
|
|
|
std::thread m_saveThread;
|
2020-02-08 12:07:02 +00:00
|
|
|
std::atomic<size_t> m_srcFileBytes { 0 };
|
|
|
|
std::atomic<size_t> m_dstFileBytes { 0 };
|
2019-05-28 17:56:18 +00:00
|
|
|
|
2019-06-06 21:14:49 +00:00
|
|
|
void* m_frameTexture = nullptr;
|
2019-06-06 21:10:01 +00:00
|
|
|
const void* m_frameTexturePtr = nullptr;
|
2019-06-06 20:14:25 +00:00
|
|
|
|
2020-07-29 23:58:08 +00:00
|
|
|
void* m_frameTextureConn = nullptr;
|
|
|
|
const void* m_frameTextureConnPtr = nullptr;
|
|
|
|
|
2019-10-13 13:28:52 +00:00
|
|
|
std::vector<std::unique_ptr<Annotation>> m_annotations;
|
2019-07-26 21:05:24 +00:00
|
|
|
UserData m_userData;
|
|
|
|
|
2020-03-06 21:11:17 +00:00
|
|
|
bool m_reconnectRequested = false;
|
2021-08-18 22:24:11 +00:00
|
|
|
bool m_firstFrame = true;
|
|
|
|
std::chrono::time_point<std::chrono::high_resolution_clock> m_firstFrameTime;
|
2020-08-05 15:20:19 +00:00
|
|
|
float m_yDelta;
|
2020-03-06 21:11:17 +00:00
|
|
|
|
2020-04-17 16:38:14 +00:00
|
|
|
std::vector<SourceRegex> m_sourceSubstitutions;
|
|
|
|
bool m_sourceRegexValid = true;
|
|
|
|
|
2020-07-31 15:50:12 +00:00
|
|
|
RangeSlim m_setRangePopup;
|
2020-08-04 14:49:39 +00:00
|
|
|
bool m_setRangePopupOpen = false;
|
2020-07-31 15:50:12 +00:00
|
|
|
|
2020-11-01 15:24:08 +00:00
|
|
|
unordered_flat_map<int16_t, StatisticsCache> m_statCache;
|
2022-01-29 14:35:25 +00:00
|
|
|
unordered_flat_map<int16_t, StatisticsCache> m_gpuStatCache;
|
2020-11-01 15:24:08 +00:00
|
|
|
|
2021-11-18 21:46:59 +00:00
|
|
|
void(*m_cbMainThread)(std::function<void()>, bool);
|
2020-08-15 12:59:16 +00:00
|
|
|
|
2018-07-21 18:26:13 +00:00
|
|
|
struct FindZone {
|
2018-03-20 13:37:58 +00:00
|
|
|
enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 };
|
2020-07-04 10:36:04 +00:00
|
|
|
enum class GroupBy : int { Thread, UserText, ZoneName, Callstack, Parent, NoGrouping };
|
2019-01-30 00:54:18 +00:00
|
|
|
enum class SortBy : int { Order, Count, Time, Mtpc };
|
2018-03-20 13:37:58 +00:00
|
|
|
|
2018-07-21 21:53:11 +00:00
|
|
|
struct Group
|
|
|
|
{
|
2020-01-20 22:40:07 +00:00
|
|
|
uint16_t id;
|
2019-11-02 15:40:23 +00:00
|
|
|
Vector<short_ptr<ZoneEvent>> zones;
|
2021-09-13 19:40:02 +00:00
|
|
|
Vector<uint16_t> zonesTids;
|
2018-07-21 21:53:11 +00:00
|
|
|
int64_t time = 0;
|
|
|
|
};
|
|
|
|
|
2018-04-01 19:24:30 +00:00
|
|
|
bool show = false;
|
2018-12-18 15:38:55 +00:00
|
|
|
bool ignoreCase = false;
|
2019-08-15 15:42:26 +00:00
|
|
|
std::vector<int16_t> match;
|
2020-01-28 20:49:36 +00:00
|
|
|
unordered_flat_map<uint64_t, Group> groups;
|
2018-03-18 15:41:58 +00:00
|
|
|
size_t processed;
|
2020-01-20 22:40:07 +00:00
|
|
|
uint16_t groupId;
|
2018-03-18 15:07:07 +00:00
|
|
|
int selMatch = 0;
|
2018-07-21 21:41:50 +00:00
|
|
|
uint64_t selGroup = Unselected;
|
2018-04-01 19:24:30 +00:00
|
|
|
char pattern[1024] = {};
|
2018-02-16 12:28:40 +00:00
|
|
|
bool logVal = false;
|
2018-04-21 20:21:15 +00:00
|
|
|
bool logTime = true;
|
2018-03-05 19:15:18 +00:00
|
|
|
bool cumulateTime = false;
|
2019-01-23 13:25:28 +00:00
|
|
|
bool selfTime = false;
|
2019-08-14 19:28:19 +00:00
|
|
|
bool runningTime = false;
|
2018-07-21 18:26:13 +00:00
|
|
|
GroupBy groupBy = GroupBy::Thread;
|
2018-09-02 11:34:00 +00:00
|
|
|
SortBy sortBy = SortBy::Count;
|
2018-03-04 21:52:36 +00:00
|
|
|
Region highlight;
|
2018-09-02 00:09:29 +00:00
|
|
|
int64_t hlOrig_t0, hlOrig_t1;
|
2018-06-06 21:06:00 +00:00
|
|
|
int64_t numBins = -1;
|
|
|
|
std::unique_ptr<int64_t[]> bins, binTime, selBin;
|
2020-01-20 22:58:36 +00:00
|
|
|
Vector<int64_t> sorted, selSort;
|
2018-09-03 18:21:28 +00:00
|
|
|
size_t sortedNum = 0, selSortNum, selSortActive;
|
2018-09-02 10:48:04 +00:00
|
|
|
float average, selAverage;
|
|
|
|
float median, selMedian;
|
|
|
|
int64_t total, selTotal;
|
2019-12-28 14:48:45 +00:00
|
|
|
int64_t selTime;
|
2018-09-02 11:06:09 +00:00
|
|
|
bool drawAvgMed = true;
|
|
|
|
bool drawSelAvgMed = true;
|
2019-01-23 13:25:28 +00:00
|
|
|
bool scheduleResetMatch = false;
|
2019-02-27 19:37:38 +00:00
|
|
|
int selCs = 0;
|
2019-06-15 23:29:09 +00:00
|
|
|
int minBinVal = 1;
|
2019-08-14 19:10:58 +00:00
|
|
|
int64_t tmin, tmax;
|
2019-11-10 22:27:37 +00:00
|
|
|
bool showZoneInFrames = false;
|
2020-07-28 13:12:45 +00:00
|
|
|
Range range;
|
2020-07-29 16:48:49 +00:00
|
|
|
RangeSlim rangeSlim;
|
2018-03-04 21:52:36 +00:00
|
|
|
|
2019-06-16 14:41:52 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int numBins = -1;
|
|
|
|
ptrdiff_t distBegin;
|
|
|
|
ptrdiff_t distEnd;
|
|
|
|
} binCache;
|
|
|
|
|
2021-09-04 20:16:20 +00:00
|
|
|
struct {
|
|
|
|
Vector<SymList> counts;
|
|
|
|
bool scheduleUpdate = false;
|
2021-09-13 19:40:02 +00:00
|
|
|
bool enabled = false;
|
|
|
|
} samples;
|
2021-09-04 20:16:20 +00:00
|
|
|
|
2018-03-04 21:52:36 +00:00
|
|
|
void Reset()
|
|
|
|
{
|
2018-09-02 11:25:17 +00:00
|
|
|
ResetMatch();
|
2018-03-04 21:52:36 +00:00
|
|
|
match.clear();
|
2018-03-18 15:07:07 +00:00
|
|
|
selMatch = 0;
|
2018-07-21 21:41:50 +00:00
|
|
|
selGroup = Unselected;
|
2018-03-04 21:52:36 +00:00
|
|
|
highlight.active = false;
|
2021-09-13 20:09:40 +00:00
|
|
|
samples.counts.clear();
|
2018-09-02 11:25:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ResetMatch()
|
|
|
|
{
|
|
|
|
ResetGroups();
|
2018-09-01 22:19:15 +00:00
|
|
|
sorted.clear();
|
|
|
|
sortedNum = 0;
|
2018-09-01 22:28:57 +00:00
|
|
|
average = 0;
|
|
|
|
median = 0;
|
|
|
|
total = 0;
|
2019-08-14 19:53:09 +00:00
|
|
|
tmin = std::numeric_limits<int64_t>::max();
|
|
|
|
tmax = std::numeric_limits<int64_t>::min();
|
2018-03-04 21:52:36 +00:00
|
|
|
}
|
2018-03-18 15:41:58 +00:00
|
|
|
|
2018-07-21 21:41:50 +00:00
|
|
|
void ResetGroups()
|
2018-03-18 15:41:58 +00:00
|
|
|
{
|
2018-09-02 01:17:05 +00:00
|
|
|
ResetSelection();
|
2018-07-21 21:41:50 +00:00
|
|
|
groups.clear();
|
2018-03-18 15:41:58 +00:00
|
|
|
processed = 0;
|
2020-01-20 22:40:07 +00:00
|
|
|
groupId = 0;
|
2019-02-27 19:37:38 +00:00
|
|
|
selCs = 0;
|
2019-12-28 17:03:30 +00:00
|
|
|
selGroup = Unselected;
|
2018-03-18 15:41:58 +00:00
|
|
|
}
|
2018-04-05 17:30:32 +00:00
|
|
|
|
2018-09-02 01:17:05 +00:00
|
|
|
void ResetSelection()
|
|
|
|
{
|
|
|
|
selSort.clear();
|
|
|
|
selSortNum = 0;
|
|
|
|
selSortActive = 0;
|
2018-09-02 10:48:04 +00:00
|
|
|
selAverage = 0;
|
|
|
|
selMedian = 0;
|
|
|
|
selTotal = 0;
|
2019-12-28 14:48:45 +00:00
|
|
|
selTime = 0;
|
2019-06-16 14:41:52 +00:00
|
|
|
binCache.numBins = -1;
|
2021-09-13 19:40:02 +00:00
|
|
|
samples.scheduleUpdate = true;
|
2018-09-02 01:17:05 +00:00
|
|
|
}
|
|
|
|
|
2019-08-15 15:42:26 +00:00
|
|
|
void ShowZone( int16_t srcloc, const char* name )
|
2018-04-05 17:30:32 +00:00
|
|
|
{
|
|
|
|
show = true;
|
2020-07-28 13:12:45 +00:00
|
|
|
range.active = false;
|
2019-12-28 16:28:39 +00:00
|
|
|
Reset();
|
|
|
|
match.emplace_back( srcloc );
|
|
|
|
strcpy( pattern, name );
|
|
|
|
}
|
|
|
|
|
|
|
|
void ShowZone( int16_t srcloc, const char* name, int64_t limitMin, int64_t limitMax )
|
|
|
|
{
|
|
|
|
assert( limitMin <= limitMax );
|
|
|
|
show = true;
|
2020-07-28 13:12:45 +00:00
|
|
|
range.active = true;
|
|
|
|
range.min = limitMin;
|
|
|
|
range.max = limitMax;
|
2018-04-05 17:30:32 +00:00
|
|
|
Reset();
|
|
|
|
match.emplace_back( srcloc );
|
|
|
|
strcpy( pattern, name );
|
|
|
|
}
|
2018-01-17 11:49:50 +00:00
|
|
|
} m_findZone;
|
2018-04-01 19:24:30 +00:00
|
|
|
|
2018-07-21 18:26:13 +00:00
|
|
|
tracy_force_inline uint64_t GetSelectionTarget( const Worker::ZoneThreadData& ev, FindZone::GroupBy groupBy ) const;
|
|
|
|
|
2018-06-06 21:09:46 +00:00
|
|
|
struct CompVal
|
|
|
|
{
|
|
|
|
double v0;
|
|
|
|
double v1;
|
|
|
|
};
|
|
|
|
|
2018-04-21 22:52:33 +00:00
|
|
|
struct {
|
|
|
|
bool show = false;
|
2018-12-18 15:56:19 +00:00
|
|
|
bool ignoreCase = false;
|
2019-06-02 13:40:19 +00:00
|
|
|
bool link = true;
|
2018-04-21 22:52:33 +00:00
|
|
|
std::unique_ptr<Worker> second;
|
2019-07-26 21:25:03 +00:00
|
|
|
std::unique_ptr<UserData> userData;
|
2018-07-28 16:47:33 +00:00
|
|
|
std::thread loadThread;
|
2019-08-12 10:04:27 +00:00
|
|
|
BadVersionState badVer;
|
2018-04-21 22:52:33 +00:00
|
|
|
char pattern[1024] = {};
|
2019-08-15 15:42:26 +00:00
|
|
|
std::vector<int16_t> match[2];
|
2018-04-21 22:52:33 +00:00
|
|
|
int selMatch[2] = { 0, 0 };
|
|
|
|
bool logVal = false;
|
|
|
|
bool logTime = true;
|
|
|
|
bool cumulateTime = false;
|
2019-06-18 17:41:20 +00:00
|
|
|
bool normalize = true;
|
2018-06-06 21:09:46 +00:00
|
|
|
int64_t numBins = -1;
|
|
|
|
std::unique_ptr<CompVal[]> bins, binTime;
|
2018-09-03 18:34:07 +00:00
|
|
|
std::vector<int64_t> sorted[2];
|
|
|
|
size_t sortedNum[2] = { 0, 0 };
|
|
|
|
float average[2];
|
|
|
|
float median[2];
|
|
|
|
int64_t total[2];
|
2019-06-18 20:27:25 +00:00
|
|
|
int minBinVal = 1;
|
2019-09-16 19:51:36 +00:00
|
|
|
int compareMode = 0;
|
2018-09-03 18:34:07 +00:00
|
|
|
|
|
|
|
void ResetSelection()
|
|
|
|
{
|
|
|
|
for( int i=0; i<2; i++ )
|
|
|
|
{
|
|
|
|
sorted[i].clear();
|
|
|
|
sortedNum[i] = 0;
|
|
|
|
average[i] = 0;
|
|
|
|
median[i] = 0;
|
|
|
|
total[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
2018-04-21 22:52:33 +00:00
|
|
|
|
|
|
|
void Reset()
|
|
|
|
{
|
2018-09-03 18:34:07 +00:00
|
|
|
ResetSelection();
|
2018-04-21 22:52:33 +00:00
|
|
|
for( int i=0; i<2; i++ )
|
|
|
|
{
|
|
|
|
match[i].clear();
|
|
|
|
selMatch[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} m_compare;
|
|
|
|
|
2018-04-01 19:24:30 +00:00
|
|
|
struct {
|
|
|
|
bool show = false;
|
|
|
|
char pattern[1024] = {};
|
|
|
|
uint64_t ptrFind = 0;
|
2020-09-25 15:51:05 +00:00
|
|
|
uint64_t pool = 0;
|
2018-09-27 21:16:10 +00:00
|
|
|
bool showAllocList = false;
|
2018-09-27 21:18:47 +00:00
|
|
|
std::vector<size_t> allocList;
|
2021-11-29 17:17:19 +00:00
|
|
|
Range range;
|
2018-04-01 19:24:30 +00:00
|
|
|
} m_memInfo;
|
2018-08-31 16:51:00 +00:00
|
|
|
|
|
|
|
struct {
|
2018-08-31 23:02:08 +00:00
|
|
|
std::vector<int64_t> data;
|
2018-08-31 16:51:00 +00:00
|
|
|
const FrameData* frameSet = nullptr;
|
|
|
|
size_t frameNum = 0;
|
|
|
|
float average = 0;
|
|
|
|
float median = 0;
|
2018-08-31 23:12:04 +00:00
|
|
|
int64_t total = 0;
|
2018-08-31 23:12:16 +00:00
|
|
|
bool logVal = false;
|
|
|
|
bool logTime = true;
|
|
|
|
int64_t numBins = -1;
|
|
|
|
std::unique_ptr<int64_t[]> bins;
|
2018-09-02 11:37:36 +00:00
|
|
|
bool drawAvgMed = true;
|
2019-04-26 21:19:31 +00:00
|
|
|
bool limitToView = false;
|
|
|
|
std::pair<int, int> limitRange = { -1, 0 };
|
2019-06-16 22:44:34 +00:00
|
|
|
int minBinVal = 1;
|
2018-08-31 16:51:00 +00:00
|
|
|
} m_frameSortData;
|
2019-03-29 23:52:25 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
std::pair<const ZoneEvent*, int64_t> zoneSelfTime = { nullptr, 0 };
|
2019-03-29 23:54:22 +00:00
|
|
|
std::pair<const ZoneEvent*, int64_t> zoneSelfTime2 = { nullptr, 0 };
|
2019-03-29 23:52:25 +00:00
|
|
|
std::pair<const GpuEvent*, int64_t> gpuSelfTime = { nullptr, 0 };
|
2019-03-29 23:54:22 +00:00
|
|
|
std::pair<const GpuEvent*, int64_t> gpuSelfTime2 = { nullptr, 0 };
|
2019-03-29 23:52:25 +00:00
|
|
|
} m_cache;
|
2019-06-11 23:26:49 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
void* texture = nullptr;
|
|
|
|
float timeLeft = 0;
|
|
|
|
float speed = 1;
|
|
|
|
uint32_t frame = 0;
|
|
|
|
uint32_t currFrame = -1;
|
|
|
|
bool pause = true;
|
|
|
|
bool sync = false;
|
2019-07-18 22:51:52 +00:00
|
|
|
bool zoom = false;
|
2019-06-11 23:26:49 +00:00
|
|
|
} m_playback;
|
2019-10-09 19:42:46 +00:00
|
|
|
|
|
|
|
struct TimeDistribution {
|
2019-10-09 20:13:52 +00:00
|
|
|
bool runningTime = false;
|
2019-12-25 14:07:52 +00:00
|
|
|
bool exclusiveTime = true;
|
2020-01-28 20:49:36 +00:00
|
|
|
unordered_flat_map<int16_t, ZoneTimeData> data;
|
2019-10-20 01:24:58 +00:00
|
|
|
const ZoneEvent* dataValidFor = nullptr;
|
|
|
|
float fztime;
|
2019-10-09 19:42:46 +00:00
|
|
|
} m_timeDist;
|
2020-02-29 17:15:59 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
uint64_t symAddr = 0;
|
|
|
|
int sel;
|
2021-11-27 15:41:27 +00:00
|
|
|
bool withInlines = false;
|
2021-12-31 14:01:06 +00:00
|
|
|
int mode = 0;
|
|
|
|
bool groupBottomUp = true;
|
|
|
|
bool groupTopDown = true;
|
2020-02-29 17:15:59 +00:00
|
|
|
} m_sampleParents;
|
2021-06-20 12:18:59 +00:00
|
|
|
|
2022-07-03 12:52:18 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool enabled = false;
|
|
|
|
bool monitor = false;
|
|
|
|
int64_t time;
|
|
|
|
} m_sendQueueWarning;
|
|
|
|
|
2021-06-20 12:18:59 +00:00
|
|
|
std::vector<std::pair<int, int>> m_cpuUsageBuf;
|
2017-09-12 23:33:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|