-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathmicroprofile.h
1960 lines (1812 loc) · 122 KB
/
microprofile.h
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
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#pragma once
// MIT License
//
// Copyright (c) 2023 Jonas Meyer
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// ***********************************************************************
#ifdef MICROPROFILE_USE_CONFIG
#include "microprofile.config.h"
#endif
#ifndef MICROPROFILE_ENABLED
#define MICROPROFILE_ENABLED 1
#endif
#ifndef MICROPROFILE_DYNAMIC_INSTRUMENT
#if(defined(__APPLE__) && defined(__MACH__)) || (defined(_WIN32) && defined(_M_X64)) || (defined(__unix__) && defined(__x86_64__))
#ifdef MICROPROFILE_DYNAMIC_INSTRUMENT_ENABLE
#define MICROPROFILE_DYNAMIC_INSTRUMENT 1
#endif
#endif
#endif
#ifndef MICROPROFILE_DYNAMIC_INSTRUMENT
#define MICROPROFILE_DYNAMIC_INSTRUMENT 0
#endif
#ifndef MICROPROFILE_GPU_TIMERS_D3D11
#define MICROPROFILE_GPU_TIMERS_D3D11 0
#endif
#ifndef MICROPROFILE_GPU_TIMERS_GL
#define MICROPROFILE_GPU_TIMERS_GL 0
#endif
#ifndef MICROPROFILE_GPU_TIMERS_D3D12
#define MICROPROFILE_GPU_TIMERS_D3D12 0
#endif
#ifndef MICROPROFILE_BIG_ENDIAN
#define MICROPROFILE_BIG_ENDIAN 0
#endif
#ifndef MICROPROFILE_GPU_TIMERS_VULKAN
#define MICROPROFILE_GPU_TIMERS_VULKAN 0
#endif
#ifndef MICROPROFILE_LEGACY_CSV // set this if you rely on the legacy csv dump format. (single file with multiple csv sections)
#define MICROPROFILE_LEGACY_CSV 0
#endif
#ifndef MICROPROFILE_FRAME_EXTRA_DATA // Set this to always allocate frame extra data. This is useful if you're doing profiling on platform where there is plenty of memory.
#define MICROPROFILE_FRAME_EXTRA_DATA 0
#endif
#ifndef MICROPROFILE_ONCE
#define MICROPROFILE_ONCE
#include <stdint.h>
typedef uint64_t MicroProfileToken;
typedef uint16_t MicroProfileGroupId;
typedef uint32_t MicroProfileTimelineToken;
#if 0 == MICROPROFILE_ENABLED
#define MICROPROFILE_DECLARE(var)
#define MICROPROFILE_DEFINE(var, group, name, color)
#define MICROPROFILE_REGISTER_GROUP(group, color, category)
#define MICROPROFILE_DECLARE_GPU(var)
#define MICROPROFILE_DEFINE_GPU(var, name, color)
#define MICROPROFILE_SCOPE(var) \
do \
{ \
} while(0)
#define MICROPROFILE_SCOPEI(group, name, color) \
do \
{ \
} while(0)
#define MICROPROFILE_SCOPE_CSTR(cstr) \
do \
{ \
} while(0)
#define MICROPROFILE_SCOPE_TOKEN(token) \
do \
{ \
} while(0)
#define MICROPROFILE_SCOPEGPU_TOKEN(token)
#define MICROPROFILE_SCOPEGPU(var) \
do \
{ \
} while(0)
#define MICROPROFILE_SCOPEGPUI(name, color) \
do \
{ \
} while(0)
#define MICROPROFILE_SCOPEGPU_CSTR(cstr) \
do \
{ \
} while(0)
#define MICROPROFILE_SCOPEGPU_TOKEN_L(Log, token) \
do \
{ \
} while(0)
#define MICROPROFILE_SCOPEGPU_L(Log, var) \
do \
{ \
} while(0)
#define MICROPROFILE_SCOPEGPUI_L(Log, name, color) \
do \
{ \
} while(0)
#define MICROPROFILE_SCOPEGPU_CSTR_L(Log, cstr) \
do \
{ \
} while(0)
#define MICROPROFILE_SECTIONGPU_TOKEN(token) \
do \
{ \
} while(0)
#define MICROPROFILE_SECTIONGPU(var) \
do \
{ \
} while(0)
#define MICROPROFILE_SECTIONGPUI(name, color) \
do \
{ \
} while(0)
#define MICROPROFILE_SECTIONGPU_TOKEN_L(Log, token) \
do \
{ \
} while(0)
#define MICROPROFILE_SECTIONGPU_L(Log, var) \
do \
{ \
} while(0)
#define MICROPROFILE_SECTIONGPUI_L(Log, name, color) \
do \
{ \
} while(0)
#define MICROPROFILE_CONDITIONAL_SCOPEI(condition, group, name, color) \
do \
{ \
} while(0)
#define MICROPROFILE_ENTER(var) \
do \
{ \
} while(0)
#define MICROPROFILE_ENTER_TOKEN(var) \
do \
{ \
} while(0)
#define MICROPROFILE_ENTERI(group, name, color) \
do \
{ \
} while(0)
#define MICROPROFILE_LEAVE() \
do \
{ \
} while(0)
#define MICROPROFILE_ENTER_NEGATIVE() \
do \
{ \
} while(0)
#define MICROPROFILE_LEAVE_NEGATIVE() \
do \
{ \
} while(0)
#define MICROPROFILE_ENTER_NEGATIVEGPU() \
do \
{ \
} while(0)
#define MICROPROFILE_LEAVE_NEGATIVEGPU() \
do \
{ \
} while(0)
#define MICROPROFILE_ENTER_NEGATIVEGPU_C(c) \
do \
{ \
} while(0)
#define MICROPROFILE_LEAVE_NEGATIVEGPU_C(c) \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_ENTER(var) \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_ENTER_TOKEN(token) \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_ENTERI(group, name, color) \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_LEAVE() \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_ENTER_L(Log, var) \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_ENTER_TOKEN_L(Log, token) \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_ENTERI_L(Log, name, color) \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_LEAVE_L(Log) \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_INIT_QUEUE(QueueName) \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_GET_QUEUE(QueueName) \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_BEGIN(pContext, pLog) \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_SET_CONTEXT(pContext, pLog) \
do \
{ \
} while(0)
#define MICROPROFILE_GPU_END(pLog) 0
#define MICROPROFILE_GPU_SUBMIT(Queue, Work) \
do \
{ \
} while(0)
#define MICROPROFILE_TIMELINE_TOKEN(token) \
do \
{ \
} while(0)
#define MICROPROFILE_TIMELINE_ENTER(token, color, name) \
do \
{ \
} while(0)
#define MICROPROFILE_TIMELINE_ENTERF(token, color, fmt, ...) \
do \
{ \
} while(0)
#define MICROPROFILE_TIMELINE_LEAVE(token) \
do \
{ \
} while(0)
#define MICROPROFILE_TIMELINE_ENTER_STATIC(color, name) \
do \
{ \
} while(0)
#define MICROPROFILE_TIMELINE_LEAVE_STATIC(name) \
do \
{ \
} while(0)
#define MICROPROFILE_TIMELINE_SCOPE(...) \
do \
{ \
} while(0)
#define MICROPROFILE_THREADLOGGPURESET(a) \
do \
{ \
} while(0)
#define MICROPROFILE_META_CPU(name, count)
#define MICROPROFILE_META_GPU(name, count)
#define MICROPROFILE_FORCEENABLECPUGROUP(s) \
do \
{ \
} while(0)
#define MICROPROFILE_FORCEDISABLECPUGROUP(s) \
do \
{ \
} while(0)
#define MICROPROFILE_FORCEENABLEGPUGROUP(s) \
do \
{ \
} while(0)
#define MICROPROFILE_FORCEDISABLEGPUGROUP(s) \
do \
{ \
} while(0)
#define MICROPROFILE_COUNTER_ADD(name, count) \
do \
{ \
} while(0)
#define MICROPROFILE_COUNTER_SUB(name, count) \
do \
{ \
} while(0)
#define MICROPROFILE_COUNTER_SET(name, count) \
do \
{ \
} while(0)
#define MICROPROFILE_COUNTER_SET_INT32_PTR(name, ptr) \
do \
{ \
} while(0)
#define MICROPROFILE_COUNTER_SET_INT64_PTR(name, ptr) \
do \
{ \
} while(0)
#define MICROPROFILE_COUNTER_CLEAR_PTR(name) \
do \
{ \
} while(0)
#define MICROPROFILE_COUNTER_SET_LIMIT(name, count) \
do \
{ \
} while(0)
#define MICROPROFILE_CONDITIONAL(expr)
#define MICROPROFILE_COUNTER_CONFIG(name, type, limit, flags)
#define MICROPROFILE_COUNTER_CONFIG_ONCE(name, type, limit, flags)
#define MICROPROFILE_DECLARE_LOCAL_COUNTER(var)
#define MICROPROFILE_DEFINE_LOCAL_COUNTER(var, name)
#define MICROPROFILE_DECLARE_LOCAL_ATOMIC_COUNTER(var)
#define MICROPROFILE_DEFINE_LOCAL_ATOMIC_COUNTER(var, name)
#define MICROPROFILE_COUNTER_LOCAL_ADD(var, count) do{}while(0)
#define MICROPROFILE_COUNTER_LOCAL_SUB(var, count) do{}while(0)
#define MICROPROFILE_COUNTER_LOCAL_SET(var, count) do{}while(0)
#define MICROPROFILE_COUNTER_LOCAL_UPDATE_ADD(var) do{}while(0)
#define MICROPROFILE_COUNTER_LOCAL_UPDATE_SET(var) do{}while(0)
#define MICROPROFILE_COUNTER_LOCAL_ADD_ATOMIC(var, count) do{}while(0)
#define MICROPROFILE_COUNTER_LOCAL_SUB_ATOMIC(var, count) do{}while(0)
#define MICROPROFILE_COUNTER_LOCAL_SET_ATOMIC(var, count) do{}while(0)
#define MICROPROFILE_COUNTER_LOCAL_UPDATE_ADD_ATOMIC(var) do{}while(0)
#define MICROPROFILE_COUNTER_LOCAL_UPDATE_SET_ATOMIC(var) do{}while(0)
#define MicroProfileStartAutoFlip(nHz) do{}while(0)
#define MicroProfileStopAutoFlip() do{}while(0)
#define MicroProfileEnableFrameExtraCounterData() do{}while(0)
#define MicroProfileGetTime(group, name) 0.f
#define MicroProfileOnThreadCreate(foo) \
do \
{ \
} while(0)
#define MicroProfileOnThreadExit() \
do \
{ \
} while(0)
#define MicroProfileFlip(...) \
do \
{ \
} while(0)
#define MicroProfileFlip_CB(pContext, FreezeCB, Flag) \
do \
{ \
} while(0)
#define MicroProfileSetAggregateFrames(a) \
do \
{ \
} while(0)
#define MicroProfileGetAggregateFrames() 0
#define MicroProfileGetCurrentAggregateFrames() 0
#define MicroProfileTogglePause() \
do \
{ \
} while(0)
#define MicroProfileToggleAllGroups() \
do \
{ \
} while(0)
#define MicroProfileDumpTimers() \
do \
{ \
} while(0)
#define MicroProfileShutdown() \
do \
{ \
} while(0)
#define MicroProfileSetForceEnable(a) \
do \
{ \
} while(0)
#define MicroProfileGetForceEnable() false
#define MicroProfileSetEnableAllGroups(b) \
do \
{ \
} while(0)
#define MicroProfileEnableCategory(a) \
do \
{ \
} while(0)
#define MicroProfileDisableCategory(a) \
do \
{ \
} while(0)
#define MicroProfileGetEnableAllGroups() false
#define MicroProfileSetForceMetaCounters(a)
#define MicroProfileGetForceMetaCounters() 0
#define MicroProfileEnableMetaCounter(c) \
do \
{ \
} while(0)
#define MicroProfileDisableMetaCounter(c) \
do \
{ \
} while(0)
#define MicroProfileDumpFile(...) \
do \
{ \
} while(0)
#define MicroProfileDumpFileImmediately(...) \
do \
{ \
} while(0)
#define MicroProfileStartContextSwitchTrace() \
do \
{ \
} while(0)
#define MicroProfileGpuInsertTimeStamp(a) 1
#define MicroProfileGpuGetTimeStamp(a) 0
#define MicroProfileTicksPerSecondGpu() 1
#define MicroProfileGetGpuTickReference(a, b) 0
#define MicroProfileGpuInitD3D12(pDevice, nNodeCount, pCommandQueue, pCopyQueue) \
do \
{ \
} while(0)
#define MicroProfileGpuInitD3D11(pDevice, pDeviceContext) \
do \
{ \
} while(0)
#define MicroProfileGpuShutdown() \
do \
{ \
} while(0)
#define MicroProfileGpuInitGL() \
do \
{ \
} while(0)
#define MicroProfileSetCurrentNodeD3D12(nNode) \
do \
{ \
} while(0)
#define MicroProfilePlatformMarkersGetEnabled() 0
#define MicroProfilePlatformMarkersSetEnabled(bEnabled) \
do \
{ \
} while(0)
#define MicroProfileTickToMsMultiplierCpu() 1.f
#define MicroProfileTickToMsMultiplierGpu() 0.f
#define MicroProfileTicksPerSecondCpu() 1
#define MicroProfileTick() 0
#define MicroProfileEnabled() 0
#define MicroProfileCounterString nullptr
#define MicroProfileCounterTokenTree 0
#define MicroProfileCounterTokenTreeDynamic 0
#define MicroProfileCsvConfigEnd()
#define MicroProfileCsvConfigBegin(...)
#define MicroProfileCsvConfigAddTimer(...)
#define MicroProfileCsvConfigAddGroup(...)
#define MicroProfileCsvConfigAddCounter(...)
#define MicroProfileUpdateSettingsPath(...)
#else
#include <stdint.h>
#ifdef MICROPROFILE_EXPORT
#include "microprofile.export.h"
#else
#ifndef MICROPROFILE_API
#define MICROPROFILE_API
#endif
#endif
#ifdef MICROPROFILE_PS4
#include "microprofile_ps4.h"
#endif
#ifdef MICROPROFILE_XBOXONE
#include "microprofile_xboxone.h"
#endif
#ifdef _WIN32
typedef uint32_t MicroProfileThreadIdType;
#else
#ifdef MICROPROFILE_THREADID_SIZE_4BYTE
typedef uint32_t MicroProfileThreadIdType;
#elif MICROPROFILE_THREADID_SIZE_8BYTE
typedef uint64_t MicroProfileThreadIdType;
#else
typedef uint64_t MicroProfileThreadIdType;
#endif
#endif
typedef void (*MicroProfileOnFreeze)(int nFrozen);
#define MICROPROFILE_TOKEN_PASTE0(a, b) a##b
#define MICROPROFILE_TOKEN_PASTE(a, b) MICROPROFILE_TOKEN_PASTE0(a, b)
#define MICROPROFILE_DECLARE(var) extern MicroProfileToken g_mp_##var
#define MICROPROFILE_DECLARE_GPU(var) extern MicroProfileToken g_mpGPU_##var
#define MICROPROFILE_DECLARE_SECTION(var) extern MicroProfileToken g_mp_##var
#define MICROPROFILE_DECLARE_SECTION_GPU(var) extern MicroProfileToken g_mpGPU_##var
#define MICROPROFILE_DEFINE(var, group, name, color) MicroProfileToken g_mp_##var = MicroProfileGetToken(group, name, color, MicroProfileTokenTypeCpu, 0)
#define MICROPROFILE_DEFINE_GPU(var, name, color) MicroProfileToken g_mpGPU_##var = MicroProfileGetToken("GPU", name, color, MicroProfileTokenTypeGpu, 0)
#define MICROPROFILE_DEFINE_SECTION(var, name, color) MicroProfileToken g_mp_##var = MicroProfileGetToken("__SECTION", name, color, MicroProfileTokenTypeCpu, MICROPROFILE_TIMER_FLAG_SECTION)
#define MICROPROFILE_DEFINE_SECTION_GPU(var, name, color) MicroProfileToken g_mpGPU_##var = MicroProfileGetToken("GPU", name, color, MicroProfileTokenTypeGpu, MICROPROFILE_TIMER_FLAG_SECTION)
#define MICROPROFILE_REGISTER_GROUP(group, category, color) MicroProfileRegisterGroup(group, category, color)
#define MICROPROFILE_SCOPE(var) MicroProfileScopeHandler MICROPROFILE_TOKEN_PASTE(foo, __LINE__)(g_mp_##var)
#define MICROPROFILE_SCOPE_TOKEN(token) MicroProfileScopeHandler MICROPROFILE_TOKEN_PASTE(foo, __LINE__)(token)
#define MICROPROFILE_SCOPEI(group, name, color) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp, __LINE__) = MicroProfileGetToken(group, name, color, MicroProfileTokenTypeCpu, 0); \
MicroProfileScopeHandler MICROPROFILE_TOKEN_PASTE(foo, __LINE__)(MICROPROFILE_TOKEN_PASTE(g_mp, __LINE__))
#define MICROPROFILE_SCOPE_CSTR(CStr) MicroProfileScopeHandlerCStr MICROPROFILE_TOKEN_PASTE(foo, __LINE__)(CStr)
#define MICROPROFILE_SECTION(var) MICROPROFILE_SCOPE(var)
#define MICROPROFILE_SECTIONI(name, color) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp, __LINE__) = MicroProfileGetToken("__SECTION", name, color, MicroProfileTokenTypeCpu, MICROPROFILE_TIMER_FLAG_SECTION); \
MicroProfileScopeHandler MICROPROFILE_TOKEN_PASTE(foo, __LINE__)(MICROPROFILE_TOKEN_PASTE(g_mp, __LINE__))
#define MICROPROFILE_SCOPEGPU_TOKEN(token) MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE(fooGPU, __LINE__)(token, MicroProfileGetGlobalGpuThreadLog())
#define MICROPROFILE_SCOPEGPU(var) MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE(fooGPU, __LINE__)(g_mpGPU_##var, MicroProfileGetGlobalGpuThreadLog())
#define MICROPROFILE_SCOPEGPUI(name, color) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__) = MicroProfileGetToken("GPU", name, color, MicroProfileTokenTypeGpu, 0); \
MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE(fooGPU, __LINE__)(MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__), MicroProfileGetGlobalGpuThreadLog())
#define MICROPROFILE_SCOPEGPU_CSTR(CStr) MicroProfileScopeGpuHandlerCStr MICROPROFILE_TOKEN_PASTE(foo, __LINE__)(CStr, MicroProfileGetGlobalGpuThreadLog())
#define MICROPROFILE_SCOPEGPU_TOKEN_L(Log, token) MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE(fooGPU, __LINE__)(token, Log)
#define MICROPROFILE_SCOPEGPU_L(Log, var) MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE(fooGPU, __LINE__)(g_mpGPU_##var, Log)
#define MICROPROFILE_SCOPEGPUI_L(Log, name, color) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__) = MicroProfileGetToken("GPU", name, color, MicroProfileTokenTypeGpu, 0); \
MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE(fooGPU, __LINE__)(MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__), Log)
#define MICROPROFILE_SCOPEGPU_CSTR_L(Log, CStr) MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE(foo, __LINE__)(CStr, Log)
#define MICROPROFILE_SECTIONGPU_TOKEN(token) MICROPROFILE_SCOPEGPU_TOKEN(token)
#define MICROPROFILE_SECTIONGPU(var) MICROPROFILE_SCOPEGPU(var)
#define MICROPROFILE_SECTIONGPUI(name, color) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__) = MicroProfileGetToken("__SECTIONGPU", name, color, MicroProfileTokenTypeGpu, MICROPROFILE_TIMER_FLAG_SECTION); \
MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE(fooGPU, __LINE__)(MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__))
#define MICROPROFILE_SECTIONGPU_TOKEN_L(Log, token) MICROPROFILE_SCOPEGPU_TOKEN_L(token, Log)
#define MICROPROFILE_SECTIONGPU_L(Log, var) MICROPROFILE_SCOPEGPU_L(var, Log)
#define MICROPROFILE_SECTIONGPUI_L(Log, name, color) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__) = MicroProfileGetToken("__SECTIONGPU", name, color, MicroProfileTokenTypeGpu, MICROPROFILE_TIMER_FLAG_SECTION); \
MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE(fooGPU, __LINE__)(MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__), Log)
#define MICROPROFILE_CONDITIONAL_SCOPEI(condition, group, name, color) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp, __LINE__) = MicroProfileGetToken(group, name, color, MicroProfileTokenTypeCpu, 0); \
MicroProfileConditionalScopeHandler MICROPROFILE_TOKEN_PASTE(foo, __LINE__)(MICROPROFILE_TOKEN_PASTE(g_mp, __LINE__), condition)
#define MICROPROFILE_ENTER(var) MicroProfileEnter(g_mp_##var)
#define MICROPROFILE_ENTER_TOKEN(token) MicroProfileEnter(token)
#define MICROPROFILE_ENTERI(group, name, color) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp, __LINE__) = MICROPROFILE_INVALID_TOKEN; \
if(MICROPROFILE_INVALID_TOKEN == MICROPROFILE_TOKEN_PASTE(g_mp, __LINE__)) \
{ \
MicroProfileGetTokenC(&MICROPROFILE_TOKEN_PASTE(g_mp, __LINE__), group, name, color, MicroProfileTokenTypeCpu, 0); \
} \
MicroProfileEnter(MICROPROFILE_TOKEN_PASTE(g_mp, __LINE__))
#define MICROPROFILE_LEAVE() MicroProfileLeave()
#define MICROPROFILE_ENTER_NEGATIVE() MicroProfileEnterNegative()
#define MICROPROFILE_LEAVE_NEGATIVE() MicroProfileLeave()
#define MICROPROFILE_ENTER_NEGATIVEGPU() MicroProfileEnterNegativeGpu(MicroProfileGetGlobalGpuThreadLog())
#define MICROPROFILE_LEAVE_NEGATIVEGPU() MicroProfileLeaveGpu(MicroProfileGetGlobalGpuThreadLog())
#define MICROPROFILE_ENTER_NEGATIVEGPU_C(c) MicroProfileEnterNegativeGpu(c)
#define MICROPROFILE_LEAVE_NEGATIVEGPU_C(c) MicroProfileLeaveGpu(c)
#define MICROPROFILE_GPU_ENTER(var) MicroProfileEnterGpu(g_mpGPU_##var, MicroProfileGetGlobalGpuThreadLog())
#define MICROPROFILE_GPU_ENTER_TOKEN(token) MicroProfileEnterGpu(token, MicroProfileGetGlobalGpuThreadLog())
#define MICROPROFILE_GPU_ENTERI(group, name, color) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__) = MICROPROFILE_INVALID_TOKEN; \
if(MICROPROFILE_INVALID_TOKEN == MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__)) \
{ \
MicroProfileGetTokenC(&MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__), group, name, color, MicroProfileTokenTypeGpu, 0); \
} \
MicroProfileEnterGpu(MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__), MicroProfileGetGlobalGpuThreadLog())
#define MICROPROFILE_GPU_LEAVE() MicroProfileLeaveGpu(MicroProfileGetGlobalGpuThreadLog())
#define MICROPROFILE_GPU_ENTER_L(Log, var) MicroProfileEnterGpu(g_mpGPU_##var, Log)
#define MICROPROFILE_GPU_ENTER_TOKEN_L(Log, token) MicroProfileEnterGpu(token, Log)
#define MICROPROFILE_GPU_ENTERI_L(Log, name, color) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__) = MICROPROFILE_INVALID_TOKEN; \
if(MICROPROFILE_INVALID_TOKEN == MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__)) \
{ \
MicroProfileGetTokenC(&MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__), group, name, color, MicroProfileTokenTypeGpu, 0); \
} \
MicroProfileEnterGpu(MICROPROFILE_TOKEN_PASTE(g_mpGPU, __LINE__), Log)
#define MICROPROFILE_GPU_LEAVE_L(Log) MicroProfileLeaveGpu(Log)
#define MICROPROFILE_GPU_INIT_QUEUE(QueueName) MicroProfileInitGpuQueue(QueueName)
#define MICROPROFILE_GPU_FREE_QUEUE(QueueName) MicroProfileFreeGpuQueue(QueueName)
#define MICROPROFILE_GPU_GET_QUEUE(QueueName) MicroProfileGetGpuQueue(QueueName)
#define MICROPROFILE_GPU_BEGIN(pContext, pLog) MicroProfileGpuBegin(pContext, pLog)
#define MICROPROFILE_GPU_SET_CONTEXT(pContext, pLog) MicroProfileGpuSetContext(pContext, pLog)
#define MICROPROFILE_GPU_END(pLog) MicroProfileGpuEnd(pLog)
#define MICROPROFILE_GPU_SUBMIT(Queue, Work) MicroProfileGpuSubmit(Queue, Work)
#define MICROPROFILE_TIMELINE_TOKEN(token) MicroProfileTimelineToken token = 0
#define MICROPROFILE_TIMELINE_ENTER(token, color, name) token = MicroProfileTimelineEnter(color, name)
#define MICROPROFILE_TIMELINE_ENTERF(token, color, fmt, ...) token = MicroProfileTimelineEnterf(color, fmt, ##__VA_ARGS__)
#define MICROPROFILE_TIMELINE_LEAVE(token) \
do \
{ \
if(token) \
{ \
MicroProfileTimelineLeave(token); \
} \
} while(0)
// use only with static string literals
#define MICROPROFILE_TIMELINE_ENTER_STATIC(color, name) MicroProfileTimelineEnterStatic(color, name)
// use only with static string literals
#define MICROPROFILE_TIMELINE_LEAVE_STATIC(name) MicroProfileTimelineLeaveStatic(name)
#define MICROPROFILE_TIMELINE_SCOPE(color, fmt, ...) \
MicroProfileTimelineToken MICROPROFILE_TOKEN_PASTE(__timeline__, __LINE__) = MicroProfileTimelineEnterf(color, fmt, ##__VA_ARGS__);\
MicroProfileScopeTimelineExitHandler MICROPROFILE_TOKEN_PASTE(__timeline__0, __LINE__)(MICROPROFILE_TOKEN_PASTE(__timeline__, __LINE__))
#define MICROPROFILE_THREADLOGGPURESET(a) MicroProfileThreadLogGpuReset(a)
#define MICROPROFILE_META_CPU(name, count) \
do \
{ \
} while(0) // static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp_meta,__LINE__) = MicroProfileGetMetaToken(name); MicroProfileMetaUpdate(MICROPROFILE_TOKEN_PASTE(g_mp_meta,__LINE__), count,
// MicroProfileTokenTypeCpu)
#define MICROPROFILE_COUNTER_ADD(name, count) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp_counter, __LINE__) = MicroProfileGetCounterToken(name, 0); \
MicroProfileCounterAdd(MICROPROFILE_TOKEN_PASTE(g_mp_counter, __LINE__), count)
#define MICROPROFILE_COUNTER_SUB(name, count) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp_counter, __LINE__) = MicroProfileGetCounterToken(name, 0); \
MicroProfileCounterAdd(MICROPROFILE_TOKEN_PASTE(g_mp_counter, __LINE__), -(int64_t)count)
#define MICROPROFILE_COUNTER_SET(name, count) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp_counter_set, __LINE__) = MicroProfileGetCounterToken(name, 0); \
MicroProfileCounterSet(MICROPROFILE_TOKEN_PASTE(g_mp_counter_set, __LINE__), count)
#define MICROPROFILE_COUNTER_SET_INT32_PTR(name, ptr) MicroProfileCounterSetPtr(name, ptr, sizeof(int32_t))
#define MICROPROFILE_COUNTER_SET_INT64_PTR(name, ptr) MicroProfileCounterSetPtr(name, ptr, sizeof(int64_t))
#define MICROPROFILE_COUNTER_CLEAR_PTR(name) MicroProfileCounterSetPtr(name, 0, 0)
#define MICROPROFILE_COUNTER_SET_LIMIT(name, count) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp_counter, __LINE__) = MicroProfileGetCounterToken(name, 0); \
MicroProfileCounterSetLimit(MICROPROFILE_TOKEN_PASTE(g_mp_counter, __LINE__), count)
#define MICROPROFILE_COUNTER_CONFIG(name, type, limit, flags) MicroProfileCounterConfig(name, type, limit, flags)
#define MICROPROFILE_COUNTER_CONFIG_ONCE(name, type, limit, flags) \
do \
{ \
static bool MICROPROFILE_TOKEN_PASTE(g_mponce, __LINE__) = false; \
if(!MICROPROFILE_TOKEN_PASTE(g_mponce, __LINE__)) \
{ \
MICROPROFILE_TOKEN_PASTE(g_mponce, __LINE__) = true; \
MicroProfileCounterConfig(name, type, limit, flags); \
} \
} while(0)
#define MICROPROFILE_DECLARE_LOCAL_COUNTER(var) \
extern int64_t g_mp_local_counter##var; \
extern MicroProfileToken g_mp_counter_token##var;
#define MICROPROFILE_DEFINE_LOCAL_COUNTER(var, name) \
int64_t g_mp_local_counter##var = 0; \
MicroProfileToken g_mp_counter_token##var = MicroProfileGetCounterToken(name, 0)
#define MICROPROFILE_DECLARE_LOCAL_ATOMIC_COUNTER(var) extern MicroProfileToken g_mp_counter_token##var;
#define MICROPROFILE_DEFINE_LOCAL_ATOMIC_COUNTER(var, name) MicroProfileToken g_mp_counter_token##var = MicroProfileGetCounterToken(name, 0)
#define MICROPROFILE_COUNTER_LOCAL_ADD(var, count) MicroProfileLocalCounterAdd(&g_mp_local_counter##var, (count))
#define MICROPROFILE_COUNTER_LOCAL_SUB(var, count) MicroProfileLocalCounterAdd(&g_mp_local_counter##var, -(int64_t)(count))
#define MICROPROFILE_COUNTER_LOCAL_SET(var, count) MicroProfileLocalCounterSet(&g_mp_local_counter##var, count)
#define MICROPROFILE_COUNTER_LOCAL_UPDATE_ADD(var) MicroProfileCounterAdd(g_mp_counter_token##var, MicroProfileLocalCounterSet(&g_mp_local_counter##var, 0))
#define MICROPROFILE_COUNTER_LOCAL_UPDATE_SET(var) MicroProfileCounterSet(g_mp_counter_token##var, MicroProfileLocalCounterSet(&g_mp_local_counter##var, 0))
#define MICROPROFILE_COUNTER_LOCAL_ADD_ATOMIC(var, count) MicroProfileLocalCounterAddAtomic(g_mp_counter_token##var, (count))
#define MICROPROFILE_COUNTER_LOCAL_SUB_ATOMIC(var, count) MicroProfileLocalCounterAddAtomic(g_mp_counter_token##var, -(int64_t)(count))
#define MICROPROFILE_COUNTER_LOCAL_SET_ATOMIC(var, count) MicroProfileLocalCounterSetAtomic(g_mp_counter_token##var, count)
#define MICROPROFILE_COUNTER_LOCAL_UPDATE_ADD_ATOMIC(var) MicroProfileCounterAdd(g_mp_counter_token##var, MicroProfileLocalCounterSetAtomic(g_mp_counter_token##var, 0))
#define MICROPROFILE_COUNTER_LOCAL_UPDATE_SET_ATOMIC(var) MicroProfileCounterSet(g_mp_counter_token##var, MicroProfileLocalCounterSetAtomic(g_mp_counter_token##var, 0))
#define MICROPROFILE_FORCEENABLECPUGROUP(s) MicroProfileForceEnableGroup(s, MicroProfileTokenTypeCpu)
#define MICROPROFILE_FORCEDISABLECPUGROUP(s) MicroProfileForceDisableGroup(s, MicroProfileTokenTypeCpu)
#define MICROPROFILE_FORCEENABLEGPUGROUP(s) MicroProfileForceEnableGroup(s, MicroProfileTokenTypeGpu)
#define MICROPROFILE_FORCEDISABLEGPUGROUP(s) MicroProfileForceDisableGroup(s, MicroProfileTokenTypeGpu)
#define MICROPROFILE_CONDITIONAL(expr) expr
#ifndef MICROPROFILE_PLATFORM_MARKERS
#define MICROPROFILE_PLATFORM_MARKERS 0
#endif
#if MICROPROFILE_PLATFORM_MARKERS
#define MICROPROFILE_PLATFORM_MARKERS_ENABLED S.nPlatformMarkersEnabled
#define MICROPROFILE_PLATFORM_MARKER_BEGIN(color, marker) MicroProfilePlatformMarkerBegin(color, marker)
#define MICROPROFILE_PLATFORM_MARKER_END() MicroProfilePlatformMarkerEnd()
#else
#define MICROPROFILE_PLATFORM_MARKER_BEGIN(color, marker) \
do \
{ \
(void)color; \
(void)marker; \
} while(0)
#define MICROPROFILE_PLATFORM_MARKER_END() \
do \
{ \
} while(0)
#define MICROPROFILE_PLATFORM_MARKERS_ENABLED 0
#endif
#define MICROPROFILE_MAJOR_VERSION 4
#define MICROPROFILE_MINOR_VERSION 0
#ifndef MICROPROFILE_USE_THREAD_NAME_CALLBACK
#define MICROPROFILE_USE_THREAD_NAME_CALLBACK 0
#endif
#ifndef MICROPROFILE_PER_THREAD_BUFFER_SIZE
#define MICROPROFILE_PER_THREAD_BUFFER_SIZE (2048 << 10)
#endif
#ifndef MICROPROFILE_PER_THREAD_GPU_BUFFER_SIZE
#define MICROPROFILE_PER_THREAD_GPU_BUFFER_SIZE (128 << 10)
#endif
#ifndef MICROPROFILE_MAX_FRAME_HISTORY
#define MICROPROFILE_MAX_FRAME_HISTORY 512
#endif
#ifndef MICROPROFILE_PRINTF
#define MICROPROFILE_PRINTF printf
#endif
// #ifndef MICROPROFILE_META_MAX
// #define MICROPROFILE_META_MAX 8
// #endif
#ifndef MICROPROFILE_WEBSERVER_PORT
#define MICROPROFILE_WEBSERVER_PORT 1338
#endif
#ifndef MICROPROFILE_WEBSERVER
#define MICROPROFILE_WEBSERVER 1
#endif
#ifndef MICROPROFILE_WEBSERVER_AUTO_START
#define MICROPROFILE_WEBSERVER_AUTO_START 1 // when set to 1, the webserver will start on first call to MicroProfileFlip
#endif
#ifndef MICROPROFILE_WEBSERVER_DEFAULT_FRAMES
#define MICROPROFILE_WEBSERVER_DEFAULT_FRAMES 30
#endif
#ifndef MICROPROFILE_WEBSERVER_SOCKET_BUFFER_SIZE
#define MICROPROFILE_WEBSERVER_SOCKET_BUFFER_SIZE (16 << 10)
#endif
#ifndef MICROPROFILE_GPU_TIMERS
#define MICROPROFILE_GPU_TIMERS 0
#endif
#ifndef MICROPROFILE_GPU_TIMER_CALLBACKS
#define MICROPROFILE_GPU_TIMER_CALLBACKS 0
#endif
#ifndef MICROPROFILE_GPU_FRAME_DELAY
#define MICROPROFILE_GPU_FRAME_DELAY 5 // must be > 0
#endif
#ifndef MICROPROFILE_NAME_MAX_LEN
#define MICROPROFILE_NAME_MAX_LEN 64
#endif
#ifndef MICROPROFILE_MAX_TIMERS
#define MICROPROFILE_MAX_TIMERS 1024
#endif
#ifndef MICROPROFILE_MAX_THREADS
#define MICROPROFILE_MAX_THREADS 128
#endif
#ifndef MICROPROFILE_UNPACK_RED
#define MICROPROFILE_UNPACK_RED(c) (0xff&((c) >> 16))
#endif
#ifndef MICROPROFILE_UNPACK_GREEN
#define MICROPROFILE_UNPACK_GREEN(c) (0xff&((c) >> 8))
#endif
#ifndef MICROPROFILE_UNPACK_BLUE
#define MICROPROFILE_UNPACK_BLUE(c) (0xff&((c)))
#endif
#ifndef MICROPROFILE_DEFAULT_PRESET
#define MICROPROFILE_DEFAULT_PRESET "Default"
#endif
#ifndef MICROPROFILE_TIMELINE_MAX_ENTRIES
#define MICROPROFILE_TIMELINE_MAX_ENTRIES (4 << 10)
#endif
#ifndef MICROPROFILE_MAX_STRING
#define MICROPROFILE_MAX_STRING 128
#endif
#ifndef MICROPROFILE_TIMELINE_MAX_TOKENS
#define MICROPROFILE_TIMELINE_MAX_TOKENS 64
#endif
#ifndef MICROPROFILE_THREAD_LOG_FRAMES_REUSE
#define MICROPROFILE_THREAD_LOG_FRAMES_REUSE 200
#endif
#ifndef MICROPROFILE_CONTEXT_SWITCH_TRACE
#if defined(_WIN32)
#define MICROPROFILE_CONTEXT_SWITCH_TRACE 1
#elif defined(__APPLE__)
#define MICROPROFILE_CONTEXT_SWITCH_TRACE 0 // disabled until dtrace script is working.
#else
#define MICROPROFILE_CONTEXT_SWITCH_TRACE 0
#endif
#endif
#if MICROPROFILE_CONTEXT_SWITCH_TRACE
#define MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE (128 * 1024) // 2mb with 16 byte entry size
#else
#define MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE (1)
#endif
#ifndef MICROPROFILE_MINIZ
#define MICROPROFILE_MINIZ 0
#endif
#ifndef MICROPROFILE_COUNTER_HISTORY
#define MICROPROFILE_COUNTER_HISTORY 1
#endif
#ifndef MICROPROFILE_MAX_GROUPS
#define MICROPROFILE_MAX_GROUPS 128 // must be multiple of 32
#endif
#ifndef MICROPROFILE_STACK_MAX
#define MICROPROFILE_STACK_MAX 64
#endif
#ifndef MICROPROFILE_BREAK_ON_PATCH_FAIL
#define MICROPROFILE_BREAK_ON_PATCH_FAIL 0
#endif
#ifndef MICROPROFILE_INSTRUMENT_MICROPROFILE
#define MICROPROFILE_INSTRUMENT_MICROPROFILE 0
#endif
#ifndef MICROPROFILE_MAX_DYNAMIC_TOKENS
#define MICROPROFILE_MAX_DYNAMIC_TOKENS 2048
#endif
#ifndef MICROPROFILE_INSTRUMENT_SYMBOLNAME_MAXLEN
#define MICROPROFILE_INSTRUMENT_SYMBOLNAME_MAXLEN 128
#endif
#ifndef MICROPROFILE_INSTRUMENT_MAX_MODULES
#define MICROPROFILE_INSTRUMENT_MAX_MODULES 256
#endif
#ifndef MICROPROFILE_INSTRUMENT_MAX_MODULE_CHARS
#define MICROPROFILE_INSTRUMENT_MAX_MODULE_CHARS (8 << 10)
#endif
#ifndef MICROPROFILE_ASSERT_LOG_FREED
#define MICROPROFILE_ASSERT_LOG_FREED 0
#endif
#define MICROPROFILE_FLIP_FLAG_START_WEBSERVER 0x1
#if MICROPROFILE_WEBSERVER_AUTO_START
#define MICROPROFILE_FLIP_FLAG_DEFAULT (MICROPROFILE_FLIP_FLAG_START_WEBSERVER)
#else
#define MICROPROFILE_FLIP_FLAG_DEFAULT (0)
#endif
#ifndef MICROPROFILE_GET_SETTINGS_FILE_PATH
#define MICROPROFILE_GET_SETTINGS_FILE_PATH ""
#endif
#ifndef MICROPROFILE_MAX_CPU_CORES
#define MICROPROFILE_MAX_CPU_CORES 256
#endif
typedef enum MicroProfileTokenType_t
{
MicroProfileTokenTypeCpu,
MicroProfileTokenTypeGpu,
} MicroProfileTokenType;
struct MicroProfile;
struct MicroProfileThreadLogGpu;
struct MicroProfileScopeStateC;
#ifdef __cplusplus
#define IF_CPP(exp) exp
#else
#define IF_CPP(exp)
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#define MICROPROFILE_INVALID_TOKEN ((uint64_t)-1)
#define MICROPROFILE_TIMER_FLAG_SECTION 0x1
#define MICROPROFILE_TIMER_FLAG_PLACEHOLDER 0x1000
#define MICROPROFILE_COUNTER_TOKEN_DONT_CREATE 0x1
#define MICROPROFILE_CSV_FLAG_FRAME_NUMBERS 0x0
#define MICROPROFILE_CSV_FLAG_FRAME_TIME 0x1
MICROPROFILE_API void MicroProfileInit();
MICROPROFILE_API void MicroProfileShutdown();
MICROPROFILE_API void MicroProfileStartAutoFlip(uint32_t nHz);
MICROPROFILE_API void MicroProfileStopAutoFlip();
MICROPROFILE_API void MicroProfileEnableFrameExtraCounterData(); // enable per frame counter storage. uses more memory
MICROPROFILE_API MicroProfileToken MicroProfileFindToken(const char* sGroup, const char* sName);
MICROPROFILE_API MicroProfileToken MicroProfileGetToken(const char* sGroup, const char* sName, uint32_t nColor, MicroProfileTokenType Token, uint32_t flags);
MICROPROFILE_API void MicroProfileGetTokenC(MicroProfileToken* pToken, const char* sGroup, const char* sName, uint32_t nColor, MicroProfileTokenType Token, uint32_t flags);
MICROPROFILE_API MicroProfileToken MicroProfileGetCounterToken(const char* pName, uint32_t CounterTokenFlag);
MICROPROFILE_API void MicroProfileCounterAdd(MicroProfileToken nToken, int64_t nCount);
MICROPROFILE_API void MicroProfileCounterSet(MicroProfileToken nToken, int64_t nCount);
MICROPROFILE_API void MicroProfileCounterSetLimit(MicroProfileToken nToken, int64_t nCount);
MICROPROFILE_API void MicroProfileCounterConfig(const char* pCounterName, uint32_t nFormat, int64_t nLimit, uint32_t nFlags);
MICROPROFILE_API void MicroProfileCounterSetPtr(const char* pCounterName, void* pValue, uint32_t nSize);
MICROPROFILE_API void MicroProfileCounterFetchCounters();
MICROPROFILE_API void MicroProfileLocalCounterAdd(int64_t* pCounter, int64_t nCount);
MICROPROFILE_API int64_t MicroProfileLocalCounterSet(int64_t* pCounter, int64_t nCount);
MICROPROFILE_API uint64_t MicroProfileEnterInternal(MicroProfileToken nToken);
MICROPROFILE_API void MicroProfileLeaveInternal(MicroProfileToken nToken, uint64_t nTick);
MICROPROFILE_API uint64_t MicroProfileEnterInternalCStr(const char* pStr);
MICROPROFILE_API void MicroProfileLeaveInternalCStr(const char* pStr, uint64_t nTickStart);
MICROPROFILE_API void MicroProfileEnter(MicroProfileToken nToken);
MICROPROFILE_API void MicroProfileLeave();
MICROPROFILE_API void MicroProfileEnterSection(const char* pName, uint32_t nColor);
MICROPROFILE_API void MicroProfileLeaveSection();
MICROPROFILE_API void MicroProfileEnterGpu(MicroProfileToken nToken, struct MicroProfileThreadLogGpu* pLog);
MICROPROFILE_API void MicroProfileLeaveGpu(struct MicroProfileThreadLogGpu* pLog);
MICROPROFILE_API void MicroProfileEnterNegative();
MICROPROFILE_API void MicroProfileEnterNegativeGpu(struct MicroProfileThreadLogGpu* pLog);
MICROPROFILE_API MicroProfileTimelineToken MicroProfileTimelineEnterInternal(uint32_t nColor, const char* pStr, uint32_t nStrLen, int bIsStaticString);
MICROPROFILE_API MicroProfileTimelineToken MicroProfileTimelineEnter(uint32_t nColor, const char* pStr);
MICROPROFILE_API MicroProfileTimelineToken MicroProfileTimelineEnterf(uint32_t nColor, const char* pStr, ...);
MICROPROFILE_API void MicroProfileTimelineLeave(MicroProfileTimelineToken id);
MICROPROFILE_API void MicroProfileTimelineEnterStatic(uint32_t nColor, const char* pStr);
MICROPROFILE_API void MicroProfileTimelineLeaveStatic(const char* pStr);
MICROPROFILE_API uint64_t MicroProfileGpuEnterInternal(struct MicroProfileThreadLogGpu* pLog, MicroProfileToken nToken);
MICROPROFILE_API void MicroProfileGpuLeaveInternal(struct MicroProfileThreadLogGpu* pLog, MicroProfileToken nToken, uint64_t nTick);
MICROPROFILE_API uint64_t MicroProfileGpuEnterInternalCStr(struct MicroProfileThreadLogGpu* pGpuLog, const char* pStr);
MICROPROFILE_API void MicroProfileGpuLeaveInternalCStr(struct MicroProfileThreadLogGpu* pGpuLog, uint64_t nTickStart);
MICROPROFILE_API void MicroProfileGpuBegin(void* pContext, struct MicroProfileThreadLogGpu* pLog);
MICROPROFILE_API void MicroProfileGpuSetContext(void* pContext, struct MicroProfileThreadLogGpu* pLog);
MICROPROFILE_API uint64_t MicroProfileGpuEnd(struct MicroProfileThreadLogGpu* pLog);
MICROPROFILE_API struct MicroProfileThreadLogGpu* MicroProfileThreadLogGpuAlloc();
MICROPROFILE_API void MicroProfileThreadLogGpuFree(struct MicroProfileThreadLogGpu* pLog);
MICROPROFILE_API void MicroProfileThreadLogGpuReset(struct MicroProfileThreadLogGpu* pLog);
MICROPROFILE_API void MicroProfileGpuSubmit(int nQueue, uint64_t nWork);
MICROPROFILE_API int MicroProfileInitGpuQueue(const char* pQueueName);
MICROPROFILE_API void MicroProfileFreeGpuQueue(int nQueue);
MICROPROFILE_API int MicroProfileGetGpuQueue(const char* pQueueName);
MICROPROFILE_API void MicroProfileFlip(void* pGpuContext, uint32_t FlipFlag IF_CPP(= MICROPROFILE_FLIP_FLAG_DEFAULT)); //! call once per frame.
MICROPROFILE_API void MicroProfileFlip_CB(void* pGpuContext, MicroProfileOnFreeze FreezeCB, uint32_t FlipFlag IF_CPP(= MICROPROFILE_FLIP_FLAG_DEFAULT)); //! call once per frame.
MICROPROFILE_API void MicroProfileToggleFrozen();
MICROPROFILE_API int MicroProfileIsFrozen();
MICROPROFILE_API int MicroProfileEnabled();
MICROPROFILE_API void MicroProfileForceEnableGroup(const char* pGroup, MicroProfileTokenType Type);
MICROPROFILE_API void MicroProfileForceDisableGroup(const char* pGroup, MicroProfileTokenType Type);
MICROPROFILE_API float MicroProfileGetTime(const char* pGroup, const char* pName);
MICROPROFILE_API int MicroProfilePlatformMarkersGetEnabled(); // enable platform markers. disables microprofile markers
MICROPROFILE_API void MicroProfilePlatformMarkersSetEnabled(int bEnabled); // enable platform markers. disables microprofile markers