VR-Vantage 2.7 API Documentation
Home
Modules
Namespaces
Classes
Files
Libraries
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
TracyClient
common
TracyQueue.hpp
Go to the documentation of this file.
1
#ifndef __TRACYQUEUE_HPP__
2
#define __TRACYQUEUE_HPP__
3
4
#include <
stdint.h
>
5
6
namespace
tracy
7
{
8
9
enum class
QueueType
:
uint8_t
10
{
11
ZoneText
,
12
ZoneName
,
13
Message,
14
MessageColor,
15
MessageCallstack,
16
MessageColorCallstack,
17
MessageAppInfo,
18
ZoneBeginAllocSrcLoc,
19
ZoneBeginAllocSrcLocCallstack,
20
CallstackMemory,
21
Callstack,
22
CallstackAlloc,
23
CallstackSample,
24
FrameImage
,
25
ZoneBegin,
26
ZoneBeginCallstack,
27
ZoneEnd,
28
LockWait,
29
LockObtain,
30
LockRelease,
31
LockSharedWait,
32
LockSharedObtain,
33
LockSharedRelease,
34
LockName,
35
MemAlloc
,
36
MemFree
,
37
MemAllocCallstack,
38
MemFreeCallstack,
39
GpuZoneBegin,
40
GpuZoneBeginCallstack,
41
GpuZoneEnd,
42
GpuZoneBeginSerial,
43
GpuZoneBeginCallstackSerial,
44
GpuZoneEndSerial,
45
PlotData,
46
ContextSwitch,
47
ThreadWakeup,
48
GpuTime,
49
Terminate,
50
KeepAlive,
51
ThreadContext,
52
GpuCalibration,
53
Crash,
54
CrashReport,
55
ZoneValidation,
56
ZoneValue
,
57
FrameMarkMsg,
58
FrameMarkMsgStart,
59
FrameMarkMsgEnd,
60
SourceLocation,
61
LockAnnounce,
62
LockTerminate,
63
LockMark
,
64
MessageLiteral,
65
MessageLiteralColor,
66
MessageLiteralCallstack,
67
MessageLiteralColorCallstack,
68
GpuNewContext,
69
CallstackFrameSize,
70
CallstackFrame,
71
SymbolInformation,
72
CodeInformation,
73
SysTimeReport,
74
TidToPid,
75
PlotConfig,
76
ParamSetup,
77
ParamPingback,
78
CpuTopology,
79
SingleStringData,
80
SecondStringData,
81
StringData,
82
ThreadName,
83
PlotName,
84
SourceLocationPayload,
85
CallstackPayload,
86
CallstackAllocPayload,
87
FrameName,
88
FrameImageData,
89
ExternalName,
90
ExternalThreadName,
91
SymbolCode,
92
NUM_TYPES
93
};
94
95
#pragma pack( 1 )
96
97
struct
QueueThreadContext
98
{
99
uint64_t
thread
;
100
};
101
102
struct
QueueZoneBeginLean
103
{
104
int64_t
time
;
105
};
106
107
struct
QueueZoneBegin
:
public
QueueZoneBeginLean
108
{
109
uint64_t
srcloc
;
// ptr
110
};
111
112
struct
QueueZoneEnd
113
{
114
int64_t
time
;
115
};
116
117
struct
QueueZoneValidation
118
{
119
uint32_t
id
;
120
};
121
122
struct
QueueZoneValue
123
{
124
uint64_t
value
;
125
};
126
127
struct
QueueStringTransfer
128
{
129
uint64_t
ptr
;
130
};
131
132
struct
QueueFrameMark
133
{
134
int64_t
time
;
135
uint64_t
name
;
// ptr
136
};
137
138
struct
QueueFrameImage
139
{
140
uint32_t
frame
;
141
uint16_t
w
;
142
uint16_t
h
;
143
uint8_t
flip
;
144
};
145
146
struct
QueueFrameImageFat
:
public
QueueFrameImage
147
{
148
uint64_t
image
;
// ptr
149
};
150
151
struct
QueueSourceLocation
152
{
153
uint64_t
name
;
154
uint64_t
function
;
// ptr
155
uint64_t
file
;
// ptr
156
uint32_t
line
;
157
uint8_t
r
;
158
uint8_t
g
;
159
uint8_t
b
;
160
};
161
162
struct
QueueZoneTextFat
163
{
164
uint64_t
text
;
// ptr
165
uint16_t
size
;
166
};
167
168
enum class
LockType
:
uint8_t
169
{
170
Lockable
,
171
SharedLockable
172
};
173
174
struct
QueueLockAnnounce
175
{
176
uint32_t
id
;
177
int64_t
time
;
178
uint64_t
lckloc
;
// ptr
179
LockType
type
;
180
};
181
182
struct
QueueLockTerminate
183
{
184
uint32_t
id
;
185
int64_t
time
;
186
};
187
188
struct
QueueLockWait
189
{
190
uint64_t
thread
;
191
uint32_t
id
;
192
int64_t
time
;
193
};
194
195
struct
QueueLockObtain
196
{
197
uint64_t
thread
;
198
uint32_t
id
;
199
int64_t
time
;
200
};
201
202
struct
QueueLockRelease
203
{
204
uint64_t
thread
;
205
uint32_t
id
;
206
int64_t
time
;
207
};
208
209
struct
QueueLockMark
210
{
211
uint64_t
thread
;
212
uint32_t
id
;
213
uint64_t
srcloc
;
// ptr
214
};
215
216
struct
QueueLockName
217
{
218
uint32_t
id
;
219
};
220
221
struct
QueueLockNameFat
:
public
QueueLockName
222
{
223
uint64_t
name
;
// ptr
224
uint16_t
size
;
225
};
226
227
enum class
PlotDataType
:
uint8_t
228
{
229
Float,
230
Double,
231
Int
232
};
233
234
struct
QueuePlotData
235
{
236
uint64_t
name
;
// ptr
237
int64_t
time
;
238
PlotDataType
type
;
239
union
240
{
241
double
d
;
242
float
f
;
243
int64_t
i
;
244
}
data
;
245
};
246
247
struct
QueueMessage
248
{
249
int64_t
time
;
250
};
251
252
struct
QueueMessageColor
:
public
QueueMessage
253
{
254
uint8_t
r
;
255
uint8_t
g
;
256
uint8_t
b
;
257
};
258
259
struct
QueueMessageLiteral
:
public
QueueMessage
260
{
261
uint64_t
text
;
// ptr
262
};
263
264
struct
QueueMessageColorLiteral
:
public
QueueMessageColor
265
{
266
uint64_t
text
;
// ptr
267
};
268
269
struct
QueueMessageFat
:
public
QueueMessage
270
{
271
uint64_t
text
;
// ptr
272
uint16_t
size
;
273
};
274
275
struct
QueueMessageColorFat
:
public
QueueMessageColor
276
{
277
uint64_t
text
;
// ptr
278
uint16_t
size
;
279
};
280
281
// Don't change order, only add new entries at the end, this is also used on trace dumps!
282
enum class
GpuContextType
:
uint8_t
283
{
284
Invalid,
285
OpenGl,
286
Vulkan,
287
OpenCL,
288
Direct3D12
289
};
290
291
enum
GpuContextFlags
:
uint8_t
292
{
293
GpuContextCalibration
= 1 << 0
294
};
295
296
struct
QueueGpuNewContext
297
{
298
int64_t
cpuTime
;
299
int64_t
gpuTime
;
300
uint64_t
thread
;
301
float
period
;
302
uint8_t
context
;
303
GpuContextFlags
flags
;
304
GpuContextType
type
;
305
};
306
307
struct
QueueGpuZoneBegin
308
{
309
int64_t
cpuTime
;
310
uint64_t
srcloc
;
311
uint64_t
thread
;
312
uint16_t
queryId
;
313
uint8_t
context
;
314
};
315
316
struct
QueueGpuZoneEnd
317
{
318
int64_t
cpuTime
;
319
uint64_t
thread
;
320
uint16_t
queryId
;
321
uint8_t
context
;
322
};
323
324
struct
QueueGpuTime
325
{
326
int64_t
gpuTime
;
327
uint16_t
queryId
;
328
uint8_t
context
;
329
};
330
331
struct
QueueGpuCalibration
332
{
333
int64_t
gpuTime
;
334
int64_t
cpuTime
;
335
int64_t
cpuDelta
;
336
uint8_t
context
;
337
};
338
339
struct
QueueMemAlloc
340
{
341
int64_t
time
;
342
uint64_t
thread
;
343
uint64_t
ptr
;
344
char
size
[6];
345
};
346
347
struct
QueueMemFree
348
{
349
int64_t
time
;
350
uint64_t
thread
;
351
uint64_t
ptr
;
352
};
353
354
struct
QueueCallstackFat
355
{
356
uint64_t
ptr
;
357
};
358
359
struct
QueueCallstackAllocFat
360
{
361
uint64_t
ptr
;
362
uint64_t
nativePtr
;
363
};
364
365
struct
QueueCallstackSample
366
{
367
int64_t
time
;
368
uint64_t
thread
;
369
};
370
371
struct
QueueCallstackSampleFat
:
public
QueueCallstackSample
372
{
373
uint64_t
ptr
;
374
};
375
376
struct
QueueCallstackFrameSize
377
{
378
uint64_t
ptr
;
379
uint8_t
size
;
380
};
381
382
struct
QueueCallstackFrame
383
{
384
uint32_t
line
;
385
uint64_t
symAddr
;
386
uint32_t
symLen
;
387
};
388
389
struct
QueueSymbolInformation
390
{
391
uint32_t
line
;
392
uint64_t
symAddr
;
393
};
394
395
struct
QueueCodeInformation
396
{
397
uint64_t
ptr
;
398
uint32_t
line
;
399
};
400
401
struct
QueueCrashReport
402
{
403
int64_t
time
;
404
uint64_t
text
;
// ptr
405
};
406
407
struct
QueueSysTime
408
{
409
int64_t
time
;
410
float
sysTime
;
411
};
412
413
struct
QueueContextSwitch
414
{
415
int64_t
time
;
416
uint64_t
oldThread
;
417
uint64_t
newThread
;
418
uint8_t
cpu
;
419
uint8_t
reason
;
420
uint8_t
state
;
421
};
422
423
struct
QueueThreadWakeup
424
{
425
int64_t
time
;
426
uint64_t
thread
;
427
};
428
429
struct
QueueTidToPid
430
{
431
uint64_t
tid
;
432
uint64_t
pid
;
433
};
434
435
enum class
PlotFormatType
:
uint8_t
436
{
437
Number,
438
Memory,
439
Percentage
440
};
441
442
struct
QueuePlotConfig
443
{
444
uint64_t
name
;
// ptr
445
uint8_t
type
;
446
};
447
448
struct
QueueParamSetup
449
{
450
uint32_t
idx
;
451
uint64_t
name
;
// ptr
452
uint8_t
isBool
;
453
int32_t
val
;
454
};
455
456
struct
QueueCpuTopology
457
{
458
uint32_t
package
;
459
uint32_t
core
;
460
uint32_t
thread
;
461
};
462
463
struct
QueueHeader
464
{
465
union
466
{
467
QueueType
type
;
468
uint8_t
idx
;
469
};
470
};
471
472
struct
QueueItem
473
{
474
QueueHeader
hdr
;
475
union
476
{
477
QueueThreadContext
threadCtx
;
478
QueueZoneBegin
zoneBegin
;
479
QueueZoneBeginLean
zoneBeginLean
;
480
QueueZoneEnd
zoneEnd
;
481
QueueZoneValidation
zoneValidation
;
482
QueueZoneValue
zoneValue
;
483
QueueStringTransfer
stringTransfer
;
484
QueueFrameMark
frameMark
;
485
QueueFrameImage
frameImage
;
486
QueueFrameImageFat
frameImageFat
;
487
QueueSourceLocation
srcloc
;
488
QueueZoneTextFat
zoneTextFat
;
489
QueueLockAnnounce
lockAnnounce
;
490
QueueLockTerminate
lockTerminate
;
491
QueueLockWait
lockWait
;
492
QueueLockObtain
lockObtain
;
493
QueueLockRelease
lockRelease
;
494
QueueLockMark
lockMark
;
495
QueueLockName
lockName
;
496
QueueLockNameFat
lockNameFat
;
497
QueuePlotData
plotData
;
498
QueueMessage
message
;
499
QueueMessageColor
messageColor
;
500
QueueMessageLiteral
messageLiteral
;
501
QueueMessageColorLiteral
messageColorLiteral
;
502
QueueMessageFat
messageFat
;
503
QueueMessageColorFat
messageColorFat
;
504
QueueGpuNewContext
gpuNewContext
;
505
QueueGpuZoneBegin
gpuZoneBegin
;
506
QueueGpuZoneEnd
gpuZoneEnd
;
507
QueueGpuTime
gpuTime
;
508
QueueGpuCalibration
gpuCalibration
;
509
QueueMemAlloc
memAlloc
;
510
QueueMemFree
memFree
;
511
QueueCallstackFat
callstackFat
;
512
QueueCallstackAllocFat
callstackAllocFat
;
513
QueueCallstackSample
callstackSample
;
514
QueueCallstackSampleFat
callstackSampleFat
;
515
QueueCallstackFrameSize
callstackFrameSize
;
516
QueueCallstackFrame
callstackFrame
;
517
QueueSymbolInformation
symbolInformation
;
518
QueueCodeInformation
codeInformation
;
519
QueueCrashReport
crashReport
;
520
QueueSysTime
sysTime
;
521
QueueContextSwitch
contextSwitch
;
522
QueueThreadWakeup
threadWakeup
;
523
QueueTidToPid
tidToPid
;
524
QueuePlotConfig
plotConfig
;
525
QueueParamSetup
paramSetup
;
526
QueueCpuTopology
cpuTopology
;
527
};
528
};
529
#pragma pack()
530
531
532
enum
{
QueueItemSize
=
sizeof
(
QueueItem
) };
533
534
static
constexpr
size_t
QueueDataSize
[] = {
535
sizeof
(
QueueHeader
),
// zone text
536
sizeof
(
QueueHeader
),
// zone name
537
sizeof
(
QueueHeader
) +
sizeof
(
QueueMessage
),
538
sizeof
(
QueueHeader
) +
sizeof
(
QueueMessageColor
),
539
sizeof
(
QueueHeader
) +
sizeof
(
QueueMessage
),
// callstack
540
sizeof
(
QueueHeader
) +
sizeof
(
QueueMessageColor
),
// callstack
541
sizeof
(
QueueHeader
) +
sizeof
(
QueueMessage
),
// app info
542
sizeof
(
QueueHeader
) +
sizeof
(
QueueZoneBeginLean
),
// allocated source location
543
sizeof
(
QueueHeader
) +
sizeof
(
QueueZoneBeginLean
),
// allocated source location, callstack
544
sizeof
(
QueueHeader
),
// callstack memory
545
sizeof
(
QueueHeader
),
// callstack
546
sizeof
(
QueueHeader
),
// callstack alloc
547
sizeof
(
QueueHeader
) +
sizeof
(
QueueCallstackSample
),
548
sizeof
(
QueueHeader
) +
sizeof
(
QueueFrameImage
),
549
sizeof
(
QueueHeader
) +
sizeof
(
QueueZoneBegin
),
550
sizeof
(
QueueHeader
) +
sizeof
(
QueueZoneBegin
),
// callstack
551
sizeof
(
QueueHeader
) +
sizeof
(
QueueZoneEnd
),
552
sizeof
(
QueueHeader
) +
sizeof
(
QueueLockWait
),
553
sizeof
(
QueueHeader
) +
sizeof
(
QueueLockObtain
),
554
sizeof
(
QueueHeader
) +
sizeof
(
QueueLockRelease
),
555
sizeof
(
QueueHeader
) +
sizeof
(
QueueLockWait
),
// shared
556
sizeof
(
QueueHeader
) +
sizeof
(
QueueLockObtain
),
// shared
557
sizeof
(
QueueHeader
) +
sizeof
(
QueueLockRelease
),
// shared
558
sizeof
(
QueueHeader
) +
sizeof
(
QueueLockName
),
559
sizeof
(
QueueHeader
) +
sizeof
(
QueueMemAlloc
),
560
sizeof
(
QueueHeader
) +
sizeof
(
QueueMemFree
),
561
sizeof
(
QueueHeader
) +
sizeof
(
QueueMemAlloc
),
// callstack
562
sizeof
(
QueueHeader
) +
sizeof
(
QueueMemFree
),
// callstack
563
sizeof
(
QueueHeader
) +
sizeof
(
QueueGpuZoneBegin
),
564
sizeof
(
QueueHeader
) +
sizeof
(
QueueGpuZoneBegin
),
// callstack
565
sizeof
(
QueueHeader
) +
sizeof
(
QueueGpuZoneEnd
),
566
sizeof
(
QueueHeader
) +
sizeof
(
QueueGpuZoneBegin
),
// serial
567
sizeof
(
QueueHeader
) +
sizeof
(
QueueGpuZoneBegin
),
// serial, callstack
568
sizeof
(
QueueHeader
) +
sizeof
(
QueueGpuZoneEnd
),
// serial
569
sizeof
(
QueueHeader
) +
sizeof
(
QueuePlotData
),
570
sizeof
(
QueueHeader
) +
sizeof
(
QueueContextSwitch
),
571
sizeof
(
QueueHeader
) +
sizeof
(
QueueThreadWakeup
),
572
sizeof
(
QueueHeader
) +
sizeof
(
QueueGpuTime
),
573
// above items must be first
574
sizeof
(
QueueHeader
),
// terminate
575
sizeof
(
QueueHeader
),
// keep alive
576
sizeof
(
QueueHeader
) +
sizeof
(
QueueThreadContext
),
577
sizeof
(
QueueHeader
) +
sizeof
(
QueueGpuCalibration
),
578
sizeof
(
QueueHeader
),
// crash
579
sizeof
(
QueueHeader
) +
sizeof
(
QueueCrashReport
),
580
sizeof
(
QueueHeader
) +
sizeof
(
QueueZoneValidation
),
581
sizeof
(
QueueHeader
) +
sizeof
(
QueueZoneValue
),
582
sizeof
(
QueueHeader
) +
sizeof
(
QueueFrameMark
),
// continuous frames
583
sizeof
(
QueueHeader
) +
sizeof
(
QueueFrameMark
),
// start
584
sizeof
(
QueueHeader
) +
sizeof
(
QueueFrameMark
),
// end
585
sizeof
(
QueueHeader
) +
sizeof
(
QueueSourceLocation
),
586
sizeof
(
QueueHeader
) +
sizeof
(
QueueLockAnnounce
),
587
sizeof
(
QueueHeader
) +
sizeof
(
QueueLockTerminate
),
588
sizeof
(
QueueHeader
) +
sizeof
(
QueueLockMark
),
589
sizeof
(
QueueHeader
) +
sizeof
(
QueueMessageLiteral
),
590
sizeof
(
QueueHeader
) +
sizeof
(
QueueMessageColorLiteral
),
591
sizeof
(
QueueHeader
) +
sizeof
(
QueueMessageLiteral
),
// callstack
592
sizeof
(
QueueHeader
) +
sizeof
(
QueueMessageColorLiteral
),
// callstack
593
sizeof
(
QueueHeader
) +
sizeof
(
QueueGpuNewContext
),
594
sizeof
(
QueueHeader
) +
sizeof
(
QueueCallstackFrameSize
),
595
sizeof
(
QueueHeader
) +
sizeof
(
QueueCallstackFrame
),
596
sizeof
(
QueueHeader
) +
sizeof
(
QueueSymbolInformation
),
597
sizeof
(
QueueHeader
) +
sizeof
(
QueueCodeInformation
),
598
sizeof
(
QueueHeader
) +
sizeof
(
QueueSysTime
),
599
sizeof
(
QueueHeader
) +
sizeof
(
QueueTidToPid
),
600
sizeof
(
QueueHeader
) +
sizeof
(
QueuePlotConfig
),
601
sizeof
(
QueueHeader
) +
sizeof
(
QueueParamSetup
),
602
sizeof
(
QueueHeader
),
// param pingback
603
sizeof
(
QueueHeader
) +
sizeof
(
QueueCpuTopology
),
604
sizeof
(
QueueHeader
),
// single string data
605
sizeof
(
QueueHeader
),
// second string data
606
// keep all QueueStringTransfer below
607
sizeof
(
QueueHeader
) +
sizeof
(
QueueStringTransfer
),
// string data
608
sizeof
(
QueueHeader
) +
sizeof
(
QueueStringTransfer
),
// thread name
609
sizeof
(
QueueHeader
) +
sizeof
(
QueueStringTransfer
),
// plot name
610
sizeof
(
QueueHeader
) +
sizeof
(
QueueStringTransfer
),
// allocated source location payload
611
sizeof
(
QueueHeader
) +
sizeof
(
QueueStringTransfer
),
// callstack payload
612
sizeof
(
QueueHeader
) +
sizeof
(
QueueStringTransfer
),
// callstack alloc payload
613
sizeof
(
QueueHeader
) +
sizeof
(
QueueStringTransfer
),
// frame name
614
sizeof
(
QueueHeader
) +
sizeof
(
QueueStringTransfer
),
// frame image data
615
sizeof
(
QueueHeader
) +
sizeof
(
QueueStringTransfer
),
// external name
616
sizeof
(
QueueHeader
) +
sizeof
(
QueueStringTransfer
),
// external thread name
617
sizeof
(
QueueHeader
) +
sizeof
(
QueueStringTransfer
),
// symbol code
618
};
619
620
static_assert
(
QueueItemSize
== 32,
"Queue item size not 32 bytes"
);
621
static_assert
(
sizeof
( QueueDataSize ) /
sizeof
(
size_t
) == (
uint8_t
)QueueType::NUM_TYPES,
"QueueDataSize mismatch"
);
622
static_assert
(
sizeof
(
void
* ) <=
sizeof
(
uint64_t
),
"Pointer size > 8 bytes"
);
623
static_assert
(
sizeof
(
void
* ) ==
sizeof
(
uintptr_t
),
"Pointer size != uintptr_t"
);
624
625
}
626
627
#endif
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (
www.mak.com
)