forked from wolfpld/tracy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTracyView.hpp
More file actions
674 lines (585 loc) · 22.8 KB
/
TracyView.hpp
File metadata and controls
674 lines (585 loc) · 22.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
#ifndef __TRACYVIEW_HPP__
#define __TRACYVIEW_HPP__
#include <atomic>
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <thread>
#include <vector>
#include "TracyBadVersion.hpp"
#include "TracyBuzzAnim.hpp"
#include "TracyDecayValue.hpp"
#include "TracyImGui.hpp"
#include "TracyShortPtr.hpp"
#include "TracyTexture.hpp"
#include "TracyUserData.hpp"
#include "TracyVector.hpp"
#include "TracyViewData.hpp"
#include "TracyWorker.hpp"
#include "tracy_robin_hood.h"
struct ImVec2;
struct ImFont;
namespace tracy
{
struct MemoryPage;
struct QueueItem;
class FileRead;
class SourceView;
struct ZoneTimeData;
class View
{
struct Animation
{
bool active = false;
int64_t start0, start1;
int64_t end0, end1;
double progress;
};
struct Region
{
bool active = false;
int64_t start;
int64_t end;
};
struct ZoneTimeData
{
int64_t time;
uint64_t count;
};
public:
struct VisData
{
bool visible = true;
bool showFull = true;
bool ghost = false;
int offset = 0;
int height = 0;
};
struct PlotView
{
double min;
double max;
};
using SetTitleCallback = void(*)( const char* );
View( ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr ) : View( "127.0.0.1", 8086, fixedWidth, smallFont, bigFont, stcb ) {}
View( const char* addr, int port, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr );
View( FileRead& f, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr );
~View();
static bool Draw();
void NotifyRootWindowSize( float w, float h ) { m_rootWidth = w; m_rootHeight = h; }
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 );
bool ReconnectRequested() const { return m_reconnectRequested; }
std::string GetAddress() const { return m_worker.GetAddr(); }
int GetPort() const { return m_worker.GetPort(); }
const char* SourceSubstitution( const char* srcFile ) const;
private:
enum class Namespace : uint8_t
{
Full,
Mid,
Short
};
enum class ShortcutAction : uint8_t
{
None,
OpenFind
};
enum { InvalidId = 0xFFFFFFFF };
struct PathData
{
uint32_t cnt;
uint64_t mem;
};
void InitTextEditor( ImFont* font );
const char* ShortenNamespace( const char* name ) const;
void DrawHelpMarker( const char* desc ) const;
bool DrawImpl();
void DrawNotificationArea();
bool DrawConnection();
void DrawFrames();
bool DrawZoneFramesHeader();
bool DrawZoneFrames( const FrameData& frames );
void DrawZones();
void DrawContextSwitches( const ContextSwitch* ctx, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int endOffset );
void DrawSamples( const Vector<SampleData>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset );
#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
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 );
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 );
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 );
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 );
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 );
int DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int offset, LockHighlight& highlight, float yMin, float yMax );
int DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, float yMin, float yMax );
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 );
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 );
int DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover, float yMin, float yMax );
void DrawOptions();
void DrawMessages();
void DrawFindZone();
void DrawStatistics();
void DrawMemory();
void DrawAllocList();
void DrawCompare();
void DrawCallstackWindow();
void DrawMemoryAllocWindow();
void DrawInfo();
void DrawTextEditor();
void DrawGoToFrame();
void DrawLockInfoWindow();
void DrawPlayback();
void DrawCpuDataWindow();
void DrawSelectedAnnotation();
void DrawAnnotationList();
void DrawSampleParents();
void ListMemData( std::vector<const MemEvent*>& vec, std::function<void(const MemEvent*)> DrawAddress, const char* id = nullptr, int64_t startTime = -1 );
unordered_flat_map<uint32_t, PathData> GetCallstackPaths( const MemData& mem, bool onlyActive ) const;
unordered_flat_map<uint64_t, CallstackFrameTree> GetCallstackFrameTreeBottomUp( const MemData& mem ) const;
unordered_flat_map<uint64_t, CallstackFrameTree> GetCallstackFrameTreeTopDown( const MemData& mem ) const;
void DrawFrameTreeLevel( const unordered_flat_map<uint64_t, CallstackFrameTree>& tree, int& idx );
void DrawZoneList( const Vector<short_ptr<ZoneEvent>>& zones );
void DrawInfoWindow();
void DrawZoneInfoWindow();
void DrawGpuInfoWindow();
template<typename Adapter, typename V>
void DrawZoneInfoChildren( const V& children, int64_t ztime );
template<typename Adapter, typename V>
void DrawGpuInfoChildren( const V& children, int64_t ztime );
void HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns );
uint32_t GetThreadColor( uint64_t thread, int depth );
uint32_t GetSrcLocColor( const SourceLocation& srcloc, int depth );
uint32_t GetRawSrcLocColor( const SourceLocation& srcloc, int depth );
uint32_t GetZoneColor( const ZoneEvent& ev, uint64_t thread, int depth );
uint32_t GetZoneColor( const GpuEvent& ev );
uint32_t GetRawZoneColor( const ZoneEvent& ev, uint64_t thread, int depth );
uint32_t GetRawZoneColor( const GpuEvent& ev );
uint32_t HighlightColor( uint32_t color );
uint32_t GetZoneHighlight( const ZoneEvent& ev, uint64_t thread, int depth );
uint32_t GetZoneHighlight( const GpuEvent& ev );
float GetZoneThickness( const ZoneEvent& ev );
float GetZoneThickness( const GpuEvent& ev );
void ZoomToZone( const ZoneEvent& ev );
void ZoomToZone( const GpuEvent& ev );
void ZoomToRange( int64_t start, int64_t end );
void ZoomToPrevFrame();
void ZoomToNextFrame();
void CenterAtTime( int64_t t );
void ShowZoneInfo( const ZoneEvent& ev );
void ShowZoneInfo( const GpuEvent& ev, uint64_t thread );
void ZoneTooltip( const ZoneEvent& ev );
void ZoneTooltip( const GpuEvent& ev );
void CallstackTooltip( uint32_t idx );
void CrashTooltip();
int GetZoneDepth( const ZoneEvent& zone, uint64_t tid ) const;
const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const;
const ZoneEvent* GetZoneParent( const ZoneEvent& zone, uint64_t tid ) const;
const GpuEvent* GetZoneParent( const GpuEvent& zone ) const;
const ThreadData* GetZoneThreadData( const ZoneEvent& zone ) const;
uint64_t GetZoneThread( const ZoneEvent& zone ) const;
uint64_t GetZoneThread( const GpuEvent& zone ) const;
const GpuCtxData* GetZoneCtx( const GpuEvent& zone ) const;
const ZoneEvent* FindZoneAtTime( uint64_t thread, int64_t time ) const;
uint64_t GetFrameNumber( const FrameData& fd, int i, uint64_t offset ) const;
const char* GetFrameText( const FrameData& fd, int i, uint64_t ftime, uint64_t offset ) const;
#ifndef TRACY_NO_STATISTICS
void FindZones();
void FindZonesCompare();
#endif
std::vector<MemoryPage> GetMemoryPages() const;
const char* GetPlotName( const PlotData* plot ) const;
void SmallCallstackButton( const char* name, uint32_t callstack, int& idx, bool tooltip = true );
void DrawCallstackCalls( uint32_t callstack, uint16_t limit ) const;
void SetViewToLastFrames();
int64_t GetZoneChildTime( const ZoneEvent& zone );
int64_t GetZoneChildTime( const GpuEvent& zone );
int64_t GetZoneChildTimeFast( const ZoneEvent& zone );
int64_t GetZoneSelfTime( const ZoneEvent& zone );
int64_t GetZoneSelfTime( const GpuEvent& zone );
bool GetZoneRunningTime( const ContextSwitch* ctx, const ZoneEvent& ev, int64_t& time, uint64_t& cnt );
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 );
template<typename Adapter, typename V>
void CalcZoneTimeDataImpl( const V& children, unordered_flat_map<int16_t, ZoneTimeData>& data, int64_t& ztime, const ZoneEvent& zone );
template<typename Adapter, typename V>
void CalcZoneTimeDataImpl( const V& children, const ContextSwitch* ctx, unordered_flat_map<int16_t, ZoneTimeData>& data, int64_t& ztime, const ZoneEvent& zone );
void SetPlaybackFrame( uint32_t idx );
unordered_flat_map<const void*, VisData> m_visData;
unordered_flat_map<uint64_t, bool> m_visibleMsgThread;
unordered_flat_map<const void*, int> m_gpuDrift;
unordered_flat_map<const PlotData*, PlotView> m_plotView;
Vector<const ThreadData*> m_threadOrder;
Vector<float> m_threadDnd;
tracy_force_inline VisData& Vis( const void* ptr )
{
auto it = m_visData.find( ptr );
if( it == m_visData.end() )
{
it = m_visData.emplace( ptr, VisData {} ).first;
}
return it->second;
}
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;
}
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;
}
void AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset );
Worker m_worker;
std::string m_filename;
bool m_staticView;
bool m_pause;
bool m_forceConnectionPopup = false;
ViewData m_vd;
const ZoneEvent* m_zoneInfoWindow = nullptr;
const ZoneEvent* m_zoneHighlight;
DecayValue<int16_t> m_zoneSrcLocHighlight = 0;
LockHighlight m_lockHighlight { -1 };
DecayValue<const MessageData*> m_msgHighlight = nullptr;
DecayValue<uint32_t> m_lockHoverHighlight = InvalidId;
DecayValue<const MessageData*> m_msgToFocus = nullptr;
const GpuEvent* m_gpuInfoWindow = nullptr;
const GpuEvent* m_gpuHighlight;
uint64_t m_gpuInfoWindowThread;
uint32_t m_callstackInfoWindow = 0;
int64_t m_memoryAllocInfoWindow = -1;
int64_t m_memoryAllocHover = -1;
int m_memoryAllocHoverWait = 0;
const FrameData* m_frames;
uint32_t m_lockInfoWindow = InvalidId;
const ZoneEvent* m_zoneHover = nullptr;
DecayValue<const ZoneEvent*> m_zoneHover2 = nullptr;
int m_frameHover = -1;
bool m_messagesScrollBottom;
ImGuiTextFilter m_messageFilter;
bool m_showMessageImages = false;
ImGuiTextFilter m_statisticsFilter;
int m_visibleMessages = 0;
bool m_disconnectIssued = false;
DecayValue<uint64_t> m_drawThreadMigrations = 0;
DecayValue<uint64_t> m_drawThreadHighlight = 0;
Annotation* m_selectedAnnotation = nullptr;
Region m_highlight;
Region m_highlightZoom;
DecayValue<uint64_t> m_cpuDataThread = 0;
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;
bool m_showPlayback = false;
bool m_showCpuDataWindow = false;
bool m_goToFrame = false;
bool m_showAnnotationList = false;
enum class CpuDataSortBy
{
Pid,
Name,
Time,
Regions,
Migrations
};
CpuDataSortBy m_cpuDataSort = CpuDataSortBy::Pid;
int m_statSort = 0;
bool m_statSelf = true;
bool m_statSampleTime = true;
int m_statMode = 0;
int m_statSampleLocation = 2;
bool m_statHideUnknown = true;
bool m_showAllSymbols = false;
int m_showCallstackFrameAddress = 0;
bool m_showUnknownFrames = true;
bool m_statSeparateInlines = false;
bool m_groupChildrenLocations = false;
bool m_allocTimeRelativeToZone = true;
bool m_ctxSwitchTimeRelativeToZone = true;
bool m_messageTimeRelativeToZone = true;
ShortcutAction m_shortcut = ShortcutAction::None;
Namespace m_namespace = Namespace::Short;
Animation m_zoomAnim;
BuzzAnim<int> m_callstackBuzzAnim;
BuzzAnim<int> m_sampleParentBuzzAnim;
BuzzAnim<int> m_callstackTreeBuzzAnim;
BuzzAnim<const void*> m_zoneinfoBuzzAnim;
BuzzAnim<int> m_findZoneBuzzAnim;
BuzzAnim<int16_t> m_optionsLockBuzzAnim;
BuzzAnim<uint32_t> m_lockInfoAnim;
BuzzAnim<uint32_t> m_statBuzzAnim;
Vector<const ZoneEvent*> m_zoneInfoStack;
Vector<const GpuEvent*> m_gpuInfoStack;
std::unique_ptr<SourceView> m_sourceView;
const char* m_sourceViewFile;
ImFont* m_smallFont;
ImFont* m_bigFont;
float m_rootWidth, m_rootHeight;
SetTitleCallback m_stcb;
bool m_titleSet = false;
float m_notificationTime = 0;
std::string m_notificationText;
bool m_groupCallstackTreeByNameBottomUp = true;
bool m_groupCallstackTreeByNameTopDown = true;
bool m_activeOnlyBottomUp = false;
bool m_activeOnlyTopDown = false;
enum class SaveThreadState
{
Inert,
Saving,
NeedsJoin
};
std::atomic<SaveThreadState> m_saveThreadState { SaveThreadState::Inert };
std::thread m_saveThread;
std::atomic<size_t> m_srcFileBytes { 0 };
std::atomic<size_t> m_dstFileBytes { 0 };
void* m_frameTexture = nullptr;
const void* m_frameTexturePtr = nullptr;
std::vector<std::unique_ptr<Annotation>> m_annotations;
UserData m_userData;
bool m_reconnectRequested = false;
bool m_firstFrame = true;
std::vector<SourceRegex> m_sourceSubstitutions;
bool m_sourceRegexValid = true;
struct FindZone {
enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 };
enum class GroupBy : int { Thread, UserText, Callstack, Parent, NoGrouping };
enum class SortBy : int { Order, Count, Time, Mtpc };
enum class TableSortBy : int { Starttime, Runtime, Name };
struct Group
{
uint16_t id;
Vector<short_ptr<ZoneEvent>> zones;
int64_t time = 0;
};
bool show = false;
bool ignoreCase = false;
std::vector<int16_t> match;
unordered_flat_map<uint64_t, Group> groups;
size_t processed;
uint16_t groupId;
int selMatch = 0;
uint64_t selGroup = Unselected;
char pattern[1024] = {};
bool logVal = false;
bool logTime = true;
bool cumulateTime = false;
bool selfTime = false;
bool runningTime = false;
GroupBy groupBy = GroupBy::Thread;
SortBy sortBy = SortBy::Count;
TableSortBy tableSortBy = TableSortBy::Starttime;
Region highlight;
int64_t hlOrig_t0, hlOrig_t1;
int64_t numBins = -1;
std::unique_ptr<int64_t[]> bins, binTime, selBin;
Vector<int64_t> sorted, selSort;
size_t sortedNum = 0, selSortNum, selSortActive;
float average, selAverage;
float median, selMedian;
int64_t total, selTotal;
int64_t selTime;
bool drawAvgMed = true;
bool drawSelAvgMed = true;
bool scheduleResetMatch = false;
int selCs = 0;
int minBinVal = 1;
int64_t tmin, tmax;
bool showZoneInFrames = false;
bool limitRange = false;
int64_t rangeMin, rangeMax;
struct
{
int numBins = -1;
ptrdiff_t distBegin;
ptrdiff_t distEnd;
} binCache;
void Reset()
{
ResetMatch();
match.clear();
selMatch = 0;
selGroup = Unselected;
highlight.active = false;
}
void ResetMatch()
{
ResetGroups();
sorted.clear();
sortedNum = 0;
average = 0;
median = 0;
total = 0;
tmin = std::numeric_limits<int64_t>::max();
tmax = std::numeric_limits<int64_t>::min();
}
void ResetGroups()
{
ResetSelection();
groups.clear();
processed = 0;
groupId = 0;
selCs = 0;
selGroup = Unselected;
}
void ResetSelection()
{
selSort.clear();
selSortNum = 0;
selSortActive = 0;
selAverage = 0;
selMedian = 0;
selTotal = 0;
selTime = 0;
binCache.numBins = -1;
}
void ShowZone( int16_t srcloc, const char* name )
{
show = true;
limitRange = false;
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;
limitRange = true;
rangeMin = limitMin;
rangeMax = limitMax;
Reset();
match.emplace_back( srcloc );
strcpy( pattern, name );
}
} m_findZone;
tracy_force_inline uint64_t GetSelectionTarget( const Worker::ZoneThreadData& ev, FindZone::GroupBy groupBy ) const;
struct CompVal
{
double v0;
double v1;
};
struct {
bool show = false;
bool ignoreCase = false;
bool link = true;
std::unique_ptr<Worker> second;
std::unique_ptr<UserData> userData;
std::thread loadThread;
BadVersionState badVer;
char pattern[1024] = {};
std::vector<int16_t> match[2];
int selMatch[2] = { 0, 0 };
bool logVal = false;
bool logTime = true;
bool cumulateTime = false;
bool normalize = true;
int64_t numBins = -1;
std::unique_ptr<CompVal[]> bins, binTime;
std::vector<int64_t> sorted[2];
size_t sortedNum[2] = { 0, 0 };
float average[2];
float median[2];
int64_t total[2];
int minBinVal = 1;
int compareMode = 0;
void ResetSelection()
{
for( int i=0; i<2; i++ )
{
sorted[i].clear();
sortedNum[i] = 0;
average[i] = 0;
median[i] = 0;
total[i] = 0;
}
}
void Reset()
{
ResetSelection();
for( int i=0; i<2; i++ )
{
match[i].clear();
selMatch[i] = 0;
}
}
} m_compare;
struct {
bool show = false;
char pattern[1024] = {};
uint64_t ptrFind = 0;
bool restrictTime = false;
bool showAllocList = false;
std::vector<size_t> allocList;
} m_memInfo;
struct {
std::vector<int64_t> data;
const FrameData* frameSet = nullptr;
size_t frameNum = 0;
float average = 0;
float median = 0;
int64_t total = 0;
bool logVal = false;
bool logTime = true;
int64_t numBins = -1;
std::unique_ptr<int64_t[]> bins;
bool drawAvgMed = true;
bool limitToView = false;
std::pair<int, int> limitRange = { -1, 0 };
int minBinVal = 1;
} m_frameSortData;
struct {
std::pair<const ZoneEvent*, int64_t> zoneSelfTime = { nullptr, 0 };
std::pair<const ZoneEvent*, int64_t> zoneSelfTime2 = { nullptr, 0 };
std::pair<const GpuEvent*, int64_t> gpuSelfTime = { nullptr, 0 };
std::pair<const GpuEvent*, int64_t> gpuSelfTime2 = { nullptr, 0 };
} m_cache;
struct {
void* texture = nullptr;
float timeLeft = 0;
float speed = 1;
uint32_t frame = 0;
uint32_t currFrame = -1;
bool pause = true;
bool sync = false;
bool zoom = false;
} m_playback;
struct TimeDistribution {
enum class SortBy : int { Count, Time, Mtpc };
SortBy sortBy = SortBy::Time;
bool runningTime = false;
bool exclusiveTime = true;
unordered_flat_map<int16_t, ZoneTimeData> data;
const ZoneEvent* dataValidFor = nullptr;
float fztime;
} m_timeDist;
struct {
uint64_t symAddr = 0;
int sel;
} m_sampleParents;
};
}
#endif