-
Notifications
You must be signed in to change notification settings - Fork 32
/
microprofile.h
1615 lines (1532 loc) · 60.2 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
// This is free and unencumbered software released into the public domain.
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
// software to the public domain. We make this dedication for the benefit
// of the public at large and to the detriment of our heirs and
// successors. We intend this dedication to be an overt act of
// relinquishment in perpetuity of all present and future rights to this
// software under copyright law.
// 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 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.
// For more information, please refer to <http://unlicense.org/>
//
// ***********************************************************************
#ifdef MICROPROFILE_USE_CONFIG
#include "microprofile.config.h"
#endif
#ifndef MICROPROFILE_ENABLED
#define MICROPROFILE_ENABLED 1
#endif
#ifndef MICROPROFILE_ONCE
#define MICROPROFILE_ONCE
#include <stdint.h>
#if defined( _WIN32 ) && _MSC_VER == 1700
#define PRIx64 "llx"
#define PRIu64 "llu"
#define PRId64 "lld"
#else
#include <inttypes.h>
#endif
typedef uint64_t MicroProfileToken;
typedef uint16_t MicroProfileGroupId;
#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_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_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_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_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_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 MicroProfileGetTime( group, name ) 0.f
#define MicroProfileOnThreadCreate( foo ) \
do { \
} while ( 0 )
#define MicroProfileOnThreadExit() \
do { \
} while ( 0 )
#define MicroProfileFlip( pContext ) \
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( html, csv, spikecpu, spikegpu ) \
do { \
} while ( 0 )
#define MicroProfileDumpFileImmediately( html, csv, gfcontext ) \
do { \
} while ( 0 )
#define MicroProfileWebServerPort() ( ( uint32_t ) -1 )
#define MicroProfileStartContextSwitchTrace() \
do { \
} while ( 0 )
#define MicroProfileWebServerPort() ( ( uint32_t ) -1 )
#define MicroProfileGpuInsertTimeStamp( a ) 1
#define MicroProfileGpuGetTimeStamp( a ) 0
#define MicroProfileTicksPerSecondGpu() 1
#define MicroProfileGetGpuTickReference( a, b ) 0
#define MicroProfileGpuInitD3D12( pDevice, nNodeCount, pCommandQueue ) \
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
#else
#include <stdint.h>
#ifndef MICROPROFILE_API
#define MICROPROFILE_API
#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
#define MICROPROFILE_DECLARE( var ) extern MicroProfileToken g_mp_##var
#define MICROPROFILE_DEFINE( var, group, name, color ) \
MicroProfileToken g_mp_##var = \
MicroProfileGetToken( group, name, color, MicroProfileTokenTypeCpu )
#define MICROPROFILE_REGISTER_GROUP( group, category, color ) \
MicroProfileRegisterGroup( group, category, color )
#define MICROPROFILE_DECLARE_GPU( var ) extern MicroProfileToken g_mp_##var
#define MICROPROFILE_DEFINE_GPU( var, name, color ) \
MicroProfileToken g_mp_##var = \
MicroProfileGetToken( "GPU", name, color, MicroProfileTokenTypeGpu )
#define MICROPROFILE_TOKEN_PASTE0( a, b ) a##b
#define MICROPROFILE_TOKEN_PASTE( a, b ) MICROPROFILE_TOKEN_PASTE0( a, b )
#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 ); \
MicroProfileScopeHandler MICROPROFILE_TOKEN_PASTE( foo, __LINE__ )( \
MICROPROFILE_TOKEN_PASTE( g_mp, __LINE__ ) )
#define MICROPROFILE_SCOPEGPU_TOKEN( token ) \
MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE( foo, __LINE__ )( \
token, MicroProfileGetGlobalGpuThreadLog() )
#define MICROPROFILE_SCOPEGPU( var ) \
MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE( foo, __LINE__ )( \
g_mp_##var, MicroProfileGetGlobalGpuThreadLog() )
#define MICROPROFILE_SCOPEGPUI( name, color ) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE( g_mp, __LINE__ ) = \
MicroProfileGetToken( "GPU", name, color, MicroProfileTokenTypeGpu ); \
MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE( foo, __LINE__ )( \
MICROPROFILE_TOKEN_PASTE( g_mp, __LINE__ ), MicroProfileGetGlobalGpuThreadLog() )
#define MICROPROFILE_SCOPEGPU_TOKEN_L( Log, token ) \
MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE( foo, __LINE__ )( token, Log )
#define MICROPROFILE_SCOPEGPU_L( Log, var ) \
MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE( foo, __LINE__ )( g_mp_##var, Log )
#define MICROPROFILE_SCOPEGPUI_L( Log, name, color ) \
static MicroProfileToken MICROPROFILE_TOKEN_PASTE( g_mp, __LINE__ ) = \
MicroProfileGetToken( "GPU", name, color, MicroProfileTokenTypeGpu ); \
MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE( foo, __LINE__ )( \
MICROPROFILE_TOKEN_PASTE( g_mp, __LINE__ ), Log )
#define MICROPROFILE_ENTER( var ) MicroProfileEnter( g_mp_##var )
#define MICROPROFILE_ENTER_TOKEN( var ) 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 ); \
} \
MicroProfileEnter( MICROPROFILE_TOKEN_PASTE( g_mp, __LINE__ ) )
#define MICROPROFILE_LEAVE() MicroProfileLeave()
#define MICROPROFILE_GPU_ENTER( var ) \
MicroProfileEnterGpu( g_mp_##var, MicroProfileGetGlobalGpuThreadLog() )
#define MICROPROFILE_GPU_ENTER_TOKEN( token ) \
MicroProfileEnterGpu( token, MicroProfileGetGlobalGpuThreadLog() )
#define MICROPROFILE_GPU_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, \
MicroProfileTokenTypeGpu ); \
} \
MicroProfileEnterGpu( \
MICROPROFILE_TOKEN_PASTE( g_mp, __LINE__ ), MicroProfileGetGlobalGpuThreadLog() )
#define MICROPROFILE_GPU_LEAVE() MicroProfileLeaveGpu( MicroProfileGetGlobalGpuThreadLog() )
#define MICROPROFILE_GPU_ENTER_L( Log, var ) MicroProfileEnterGpu( g_mp_##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_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, \
MicroProfileTokenTypeGpu ); \
} \
MicroProfileEnterGpu( MICROPROFILE_TOKEN_PASTE( g_mp, __LINE__ ), Log )
#define MICROPROFILE_GPU_LEAVE_L( Log ) MicroProfileLeaveGpu( Log )
#define MICROPROFILE_GPU_INIT_QUEUE( QueueName ) MicroProfileInitGpuQueue( 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 ) uint32_t 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_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 ); \
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 ); \
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 ); \
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 ); \
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 )
#define MICROPROFILE_DECLARE_LOCAL_ATOMIC_COUNTER( var ) \
extern std::atomic< int64_t > g_mp_local_counter##var; \
extern MicroProfileToken g_mp_counter_token##var;
#define MICROPROFILE_DEFINE_LOCAL_ATOMIC_COUNTER( var, name ) \
std::atomic< int64_t > g_mp_local_counter##var; \
MicroProfileToken g_mp_counter_token##var = MicroProfileGetCounterToken( name )
#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_local_counter##var, ( count ) )
#define MICROPROFILE_COUNTER_LOCAL_SUB_ATOMIC( var, count ) \
MicroProfileLocalCounterAddAtomic( &g_mp_local_counter##var, -( int64_t )( count ) )
#define MICROPROFILE_COUNTER_LOCAL_SET_ATOMIC( var, count ) \
MicroProfileLocalCounterSetAtomic( &g_mp_local_counter##var, count )
#define MICROPROFILE_COUNTER_LOCAL_UPDATE_ADD_ATOMIC( var ) \
MicroProfileCounterAdd( g_mp_counter_token##var, \
MicroProfileLocalCounterSetAtomic( &g_mp_local_counter##var, 0 ) )
#define MICROPROFILE_COUNTER_LOCAL_UPDATE_SET_ATOMIC( var ) \
MicroProfileCounterSet( g_mp_counter_token##var, \
MicroProfileLocalCounterSetAtomic( &g_mp_local_counter##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
#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 ( 16 << 20 )
#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_MAXFRAMES
#define MICROPROFILE_WEBSERVER_MAXFRAMES 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 1
#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 ) ( ( c ) >> 16 )
#endif
#ifndef MICROPROFILE_UNPACK_GREEN
#define MICROPROFILE_UNPACK_GREEN( c ) ( ( c ) >> 8 )
#endif
#ifndef MICROPROFILE_UNPACK_BLUE
#define MICROPROFILE_UNPACK_BLUE( c ) ( ( 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_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
typedef enum MicroProfileTokenType_t {
MicroProfileTokenTypeCpu,
MicroProfileTokenTypeGpu,
} MicroProfileTokenType;
struct MicroProfile;
struct MicroProfileThreadLogGpu;
struct MicroProfileScopeStateC;
#ifdef __cplusplus
#include <atomic>
extern "C" {
#endif
#define MICROPROFILE_INVALID_TOKEN ( ( uint64_t ) -1 )
MICROPROFILE_API void MicroProfileInit();
MICROPROFILE_API void MicroProfileShutdown();
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 );
MICROPROFILE_API void MicroProfileGetTokenC( MicroProfileToken* pToken, const char* sGroup,
const char* sName, uint32_t nColor, MicroProfileTokenType Token );
// MICROPROFILE_API MicroProfileToken MicroProfileGetMetaToken(const char* pName);
MICROPROFILE_API MicroProfileToken MicroProfileGetCounterToken( const char* pName );
// MICROPROFILE_API void MicroProfileMetaUpdate(MicroProfileToken, int nCount, MicroProfileTokenType
// eTokenType);
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 void MicroProfileEnter( MicroProfileToken nToken );
MICROPROFILE_API void MicroProfileLeave();
MICROPROFILE_API void MicroProfileEnterGpu(
MicroProfileToken nToken, struct MicroProfileThreadLogGpu* pLog );
MICROPROFILE_API void MicroProfileLeaveGpu( struct MicroProfileThreadLogGpu* pLog );
MICROPROFILE_API uint32_t MicroProfileTimelineEnterInternal(
uint32_t nColor, const char* pStr, int nStrLen, int bIsStaticString );
MICROPROFILE_API uint32_t MicroProfileTimelineEnter( uint32_t nColor, const char* pStr );
MICROPROFILE_API uint32_t MicroProfileTimelineEnterf( uint32_t nColor, const char* pStr, ... );
MICROPROFILE_API void MicroProfileTimelineLeave( uint32_t 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 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 int MicroProfileGetGpuQueue( const char* pQueueName );
MICROPROFILE_API void MicroProfileFlip( void* pGpuContext ); //! 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
MICROPROFILE_API void MicroProfileContextSwitchSearch( uint32_t* pContextSwitchStart,
uint32_t* pContextSwitchEnd, uint64_t nBaseTicksCpu, uint64_t nBaseTicksEndCpu );
MICROPROFILE_API void MicroProfileOnThreadCreate(
const char* pThreadName ); // should be called from newly created threads
MICROPROFILE_API void MicroProfileOnThreadExit(); // call on exit to reuse log
MICROPROFILE_API void MicroProfileInitThreadLog();
MICROPROFILE_API void MicroProfileSetEnableAllGroups( int bEnable );
MICROPROFILE_API void MicroProfileEnableCategory( const char* pCategory );
MICROPROFILE_API void MicroProfileDisableCategory( const char* pCategory );
MICROPROFILE_API int MicroProfileGetEnableAllGroups();
MICROPROFILE_API void MicroProfileSetForceMetaCounters( int bEnable );
MICROPROFILE_API int MicroProfileGetForceMetaCounters();
MICROPROFILE_API void MicroProfileEnableMetaCounter( const char* pMet );
MICROPROFILE_API void MicroProfileDisableMetaCounter( const char* pMet );
MICROPROFILE_API void MicroProfileSetAggregateFrames( int frames );
MICROPROFILE_API int MicroProfileGetAggregateFrames();
MICROPROFILE_API int MicroProfileGetCurrentAggregateFrames();
MICROPROFILE_API struct MicroProfile* MicroProfileGet();
MICROPROFILE_API void MicroProfileGetRange( uint32_t nPut, uint32_t nGet, uint32_t nRange[2][2] );
MICROPROFILE_API void MicroProfileStartContextSwitchTrace();
MICROPROFILE_API void MicroProfileStopContextSwitchTrace();
MICROPROFILE_API int MicroProfileIsLocalThread( uint32_t nThreadId );
MICROPROFILE_API int MicroProfileFormatCounter(
int eFormat, int64_t nCounter, char* pOut, uint32_t nBufferSize );
MICROPROFILE_API struct MicroProfileThreadLogGpu* MicroProfileGetGlobalGpuThreadLog();
MICROPROFILE_API int MicroProfileGetGlobalGpuQueue();
MICROPROFILE_API void MicroProfileRegisterGroup(
const char* pGroup, const char* pCategory, uint32_t nColor );
#if MICROPROFILE_PLATFORM_MARKERS
MICROPROFILE_API void MicroProfilePlatformMarkerBegin(
uint32_t nColor, const char* pMarker ); // not implemented by microprofile.
MICROPROFILE_API void MicroProfilePlatformMarkerEnd(); // not implemented by microprofile.
#endif
MICROPROFILE_API float MicroProfileTickToMsMultiplierCpu();
MICROPROFILE_API float MicroProfileTickToMsMultiplierGpu();
MICROPROFILE_API int64_t MicroProfileTicksPerSecondCpu();
MICROPROFILE_API uint64_t MicroProfileTick();
#ifdef __cplusplus
MICROPROFILE_API void MicroProfileLocalCounterAddAtomic(
std::atomic< int64_t >* pCounter, int64_t nCount );
MICROPROFILE_API int64_t MicroProfileLocalCounterSetAtomic(
std::atomic< int64_t >* pCounter, int64_t nCount );
}
#endif
#ifdef __cplusplus
struct MicroProfileThreadInfo {
// 3 first members are used to sort. dont reorder
uint32_t nIsLocal;
MicroProfileThreadIdType pid;
MicroProfileThreadIdType tid;
// 3 first members are used to sort. dont reorder
const char* pThreadModule;
const char* pProcessModule;
MicroProfileThreadInfo()
: nIsLocal( 0 ), pid( 0 ), tid( 0 ), pThreadModule( "?" ), pProcessModule( "?" ) {}
MicroProfileThreadInfo( uint32_t ThreadId, uint32_t ProcessId, uint32_t nIsLocal )
: nIsLocal( nIsLocal ),
pid( ProcessId ),
tid( ThreadId ),
pThreadModule( "?" ),
pProcessModule( "?" ) {}
~MicroProfileThreadInfo() {}
};
MICROPROFILE_API MicroProfileThreadInfo MicroProfileGetThreadInfo(
MicroProfileThreadIdType nThreadId );
MICROPROFILE_API uint32_t MicroProfileGetThreadInfoArray( MicroProfileThreadInfo** pThreadArray );
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined( MICROPROFILE_GPU_TIMERS_D3D12 )
MICROPROFILE_API void MicroProfileGpuInitD3D12(
void* pDevice, uint32_t nNodeCount, void** pCommandQueues );
MICROPROFILE_API void MicroProfileGpuShutdown();
MICROPROFILE_API void MicroProfileSetCurrentNodeD3D12( uint32_t nNode );
#endif
#if defined( MICROPROFILE_GPU_TIMERS_VULKAN )
#include <vulkan/vulkan.h>
void MicroProfileGpuInitVulkan( VkDevice* pDevices, VkPhysicalDevice* pPhysicalDevices,
VkQueue* pQueues, uint32_t* QueueFamily, uint32_t nNodeCount );
MICROPROFILE_API void MicroProfileGpuShutdown();
MICROPROFILE_API void MicroProfileSetCurrentNodeVulkan( uint32_t nNode );
#endif
MICROPROFILE_API void MicroProfileDumpFile(
const char* pHtml, const char* pCsv, float fCpuSpike, float fGpuSpike );
MICROPROFILE_API void MicroProfileDumpFileImmediately(
const char* pHtml, const char* pCsv, void* pGpuContext );
MICROPROFILE_API uint32_t MicroProfileWebServerPort();
#if MICROPROFILE_GPU_TIMERS
MICROPROFILE_API uint32_t MicroProfileGpuInsertTimeStamp( void* pContext );
MICROPROFILE_API uint64_t MicroProfileGpuGetTimeStamp( uint32_t nKey );
MICROPROFILE_API uint64_t MicroProfileTicksPerSecondGpu();
MICROPROFILE_API int MicroProfileGetGpuTickReference( int64_t* pOutCPU, int64_t* pOutGpu );
MICROPROFILE_API uint32_t MicroProfileGpuFlip( void* );
MICROPROFILE_API void MicroProfileGpuShutdown();
#else
#define MicroProfileGpuInsertTimeStamp( a ) 1
#define MicroProfileGpuGetTimeStamp( a ) 0
#define MicroProfileTicksPerSecondGpu() 1
#define MicroProfileGetGpuTickReference( a, b ) 0
#define MicroProfileGpuFlip( a ) 0
#define MicroProfileGpuShutdown() \
do { \
} while ( 0 )
#endif
#if MICROPROFILE_GPU_TIMERS_D3D11
#define MICROPROFILE_D3D_MAX_QUERIES ( 8 << 10 )
MICROPROFILE_API void MicroProfileGpuInitD3D11( void* pDevice, void* pDeviceContext );
MICROPROFILE_API void MicroProfileGpuShutdown();
#endif
#if MICROPROFILE_GPU_TIMERS_GL
#define MICROPROFILE_GL_MAX_QUERIES ( 8 << 10 )
MICROPROFILE_API void MicroProfileGpuInitGL();
#endif
#if MICROPROFILE_USE_THREAD_NAME_CALLBACK
MICROPROFILE_API const char* MicroProfileGetThreadName( char* pzName );
#else
#define MicroProfileGetThreadName( a ) "<implement MicroProfileGetThreadName to get threadnames>"
#endif
#ifdef __cplusplus
}
#endif
struct MicroProfileScopeStateC {
MicroProfileToken Token;
int64_t nTick;
};
#ifdef __cplusplus
struct MicroProfileScopeHandler {
MicroProfileToken nToken;
uint64_t nTick;
MicroProfileScopeHandler( MicroProfileToken Token ) : nToken( Token ) {
nTick = MicroProfileEnterInternal( nToken );
}
~MicroProfileScopeHandler() { MicroProfileLeaveInternal( nToken, nTick ); }
};
struct MicroProfileScopeGpuHandler {
MicroProfileToken nToken;
MicroProfileThreadLogGpu* pLog;
uint64_t nTick;
MicroProfileScopeGpuHandler( MicroProfileToken Token, MicroProfileThreadLogGpu* pLog )
: nToken( Token ), pLog( pLog ) {
nTick = MicroProfileGpuEnterInternal( pLog, nToken );
}
~MicroProfileScopeGpuHandler() { MicroProfileGpuLeaveInternal( pLog, nToken, nTick ); }
};
#endif //__cplusplus
#endif // enabled
enum MicroProfileDrawMask {
MP_DRAW_OFF = 0x0,
MP_DRAW_BARS = 0x1,
MP_DRAW_DETAILED = 0x2,
MP_DRAW_COUNTERS = 0x3,
MP_DRAW_HIDDEN = 0x4,
MP_DRAW_SIZE = 0x5,
};
enum MicroProfileDrawBarsMask {
MP_DRAW_TIMERS = 0x1,
MP_DRAW_AVERAGE = 0x2,
MP_DRAW_MAX = 0x4,
MP_DRAW_MIN = 0x8,
MP_DRAW_CALL_COUNT = 0x10,
MP_DRAW_TIMERS_EXCLUSIVE = 0x20,
MP_DRAW_AVERAGE_EXCLUSIVE = 0x40,
MP_DRAW_MAX_EXCLUSIVE = 0x80,
MP_DRAW_META_FIRST = 0x100,
MP_DRAW_ALL = 0xffffffff,
};
enum MicroProfileCounterFormat {
MICROPROFILE_COUNTER_FORMAT_DEFAULT = 0,
MICROPROFILE_COUNTER_FORMAT_BYTES = 1,
};
enum MicroProfileCounterFlags {
MICROPROFILE_COUNTER_FLAG_NONE = 0,
MICROPROFILE_COUNTER_FLAG_DETAILED = 0x1,
MICROPROFILE_COUNTER_FLAG_DETAILED_GRAPH = 0x2,
// internal:
MICROPROFILE_COUNTER_FLAG_INTERNAL_MASK = ~0x3,
MICROPROFILE_COUNTER_FLAG_HAS_LIMIT = 0x4,
MICROPROFILE_COUNTER_FLAG_CLOSED = 0x8,
MICROPROFILE_COUNTER_FLAG_MANUAL_SWAP = 0x10,
MICROPROFILE_COUNTER_FLAG_LEAF = 0x20,
};
#endif // once
// from http://fugal.net/vim/rgbtxt.html
#define MP_SNOW 0xfffafa
#define MP_GHOSTWHITE 0xf8f8ff
#define MP_WHITESMOKE 0xf5f5f5
#define MP_GAINSBORO 0xdcdcdc
#define MP_FLORALWHITE 0xfffaf0
#define MP_OLDLACE 0xfdf5e6
#define MP_LINEN 0xfaf0e6
#define MP_ANTIQUEWHITE 0xfaebd7
#define MP_PAPAYAWHIP 0xffefd5
#define MP_BLANCHEDALMOND 0xffebcd
#define MP_BISQUE 0xffe4c4
#define MP_PEACHPUFF 0xffdab9
#define MP_NAVAJOWHITE 0xffdead
#define MP_MOCCASIN 0xffe4b5
#define MP_CORNSILK 0xfff8dc
#define MP_IVORY 0xfffff0
#define MP_LEMONCHIFFON 0xfffacd
#define MP_SEASHELL 0xfff5ee
#define MP_HONEYDEW 0xf0fff0
#define MP_MINTCREAM 0xf5fffa
#define MP_AZURE 0xf0ffff
#define MP_ALICEBLUE 0xf0f8ff
#define MP_LAVENDER 0xe6e6fa
#define MP_LAVENDERBLUSH 0xfff0f5
#define MP_MISTYROSE 0xffe4e1
#define MP_WHITE 0xffffff
#define MP_BLACK 0x000000
#define MP_DARKSLATEGRAY 0x2f4f4f
#define MP_DARKSLATEGREY 0x2f4f4f
#define MP_DIMGRAY 0x696969
#define MP_DIMGREY 0x696969
#define MP_SLATEGRAY 0x708090
#define MP_SLATEGREY 0x708090
#define MP_LIGHTSLATEGRAY 0x778899
#define MP_LIGHTSLATEGREY 0x778899
#define MP_GRAY 0xbebebe
#define MP_GREY 0xbebebe
#define MP_LIGHTGREY 0xd3d3d3
#define MP_LIGHTGRAY 0xd3d3d3
#define MP_MIDNIGHTBLUE 0x191970
#define MP_NAVY 0x000080
#define MP_NAVYBLUE 0x000080