forked from zeux/microprofile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
microprofilehtml.h
4860 lines (4854 loc) · 142 KB
/
microprofilehtml.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
///start file generated from microprofile.html
#ifdef MICROPROFILE_EMBED_HTML
const char g_MicroProfileHtml_begin_0[] =
"<!DOCTYPE HTML>\n"
"<html>\n"
"<head>\n"
"<title>MicroProfile Capture</title>\n"
"<style>\n"
"/* about css: http://bit.ly/1eMQ42U */\n"
"body {margin: 0px;padding: 0px; font: 12px Courier New;background-color:#474747; color:white;overflow:hidden;}\n"
"ul {list-style-type: none;margin: 0;padding: 0;}\n"
"li{display: inline; float:left;border:5px; position:relative;text-align:center;}\n"
"a {\n"
" float:left;\n"
" text-decoration:none;\n"
" display: inline;\n"
" text-align: center;\n"
" padding:5px;\n"
" padding-bottom:0px;\n"
" padding-top:0px;\n"
" color: #FFFFFF;\n"
" background-color: #474747;\n"
"}\n"
"a:hover, a:active{\n"
" background-color: #000000;\n"
"}\n"
"\n"
"ul ul {\n"
" position:absolute;\n"
" left:0;\n"
" top:100%;\n"
" margin-left:-999em;\n"
"}\n"
"li:hover ul {\n"
" margin-left:0;\n"
" margin-right:0;\n"
"}\n"
"ul li ul{ display:block;float:none;width:100%;}\n"
"ul li ul li{ display:block;float:none;width:100%;}\n"
"li li a{ display:block;float:none;width:100%;text-align:left;}\n"
"#nav li:hover div {margin-left:0;}\n"
".help {position:absolute;z-index:5;text-align:left;padding:2px;margin-left:-999em;background-color: #313131;width:300px;}\n"
".helpstart {position:absolute;z-index:5;text-align:left;padding:2px;background-color: #313131;width:300px;display:none}\n"
".root {z-index:1;position:absolute;top:0px;left:0px;}\n"
".filterinput0{position:fixed;bottom:10px;left:25px;background-color: #313131}\n"
".filterinput1{position:fixed;bottom:10px;left:175px;background-color: #313131}\n"
"</style>\n"
"</head>\n"
"<body style=\"\">\n"
"<div id=\'filterinput\'>\n"
"<div class=\"filterinput0\">Group<br><input type=\"text\" id=\"filtergroup\"></div>\n"
"<div class=\"filterinput1\">Timer/Thread<br><input type=\"text\" id=\"filtertimer\"></div>\n"
"</div>\n"
"<canvas id=\"History\" height=\"70\" style=\"background-color:#474747;margin:0px;padding:0px;\"></canvas><canvas id=\"DetailedView\" height=\"200\" style=\"background-color:#474747;margin:0px;padding:0px;\"></canvas>\n"
"<div id=\"root\" class=\"root\">\n"
"<ul id=\"nav\">\n"
"<li><a href=\"javascript:void(0)\" onclick=\"ToggleDebugMode();\">?</a>\n"
"<div class=\"helpstart\" id=\"helpwindow\" style=\"left:20px;top:20px\">\n"
"History View:<br>\n"
"Click + Drag: Pan View<br>\n"
"Right Click + Drag : Zoom on region<br>\n"
"Click Frame : Center on frame<br>\n"
"<hr>\n"
"Main View:<br>\n"
"Ctrl + Mouse up/down: Zoom<br>\n"
"Mousewheel : Zoom<br>\n"
"Right Click + Drag: Select region<br>\n"
"Ctrl + Shift + Drag: Select region<br>\n"
"Space: Zoom to Selection<br>\n"
"Ctrl + Drag: Pan<br>\n"
"Click + Drag: Pan<br>\n"
"alt or z: Toggle ToolTip<br>\n"
"<hr>\n"
"Detailed View:<br>\n"
"Tab: Go To Worst Instance<br>\n"
"Left/Right Arrow: Next/Prev Instance<br>\n"
"<hr>\n"
"Timer Views:<br>\n"
"Tab: go to filtering<br>\n"
"Esc: Exit & Clear filter\n"
"<hr>\n"
"<table style=\"width:100%\">\n"
"<tr>\n"
"<td width=\"50%\" align=\"left\"><a href=\'javascript:void(0)\' onclick=\"ShowHelp(0, 0);\">Close</a></td>\n"
"<td width=\"50%\" align=\"right\"><a href=\'javascript:void(0)\' onclick=\"ShowHelp(0, 1);\">Close, Never Show</a></td>\n"
"</tr>\n"
"</table>\n"
"</div>\n"
"<div class=\"help\" id=\"divFrameInfo\" style=\"left:20px;top:300px;width:auto;\">\n"
"</div>\n"
"</li>\n"
"<li><a id=\'ModeSubMenuText\'>Mode</a>\n"
" <ul id=\'ModeSubMenu\'>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetMode(\'timers\', 0);\" id=\"buttonTimers\">Timers</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetMode(\'timers\', 1);\" id=\"buttonGroups\">Groups</a></li> \n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetMode(\'timers\', 2);\" id=\"buttonThreads\">Threads</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetMode(\'detailed\', 0);\" id=\"buttonDetailed\">Detailed</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetMode(\'counters\', 0);\" id=\"buttonCounters\">Counters</a></li>\n"
" </ul>\n"
"</li>\n"
"<li><a>Reference</a>\n"
" <ul id=\'ReferenceSubMenu\'>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetReferenceTime(\'5ms\');\">5ms</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetReferenceTime(\'10ms\');\">10ms</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetReferenceTime(\'15ms\');\">15ms</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetReferenceTime(\'20ms\');\">20ms</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetReferenceTime(\'33ms\');\">33ms</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetReferenceTime(\'50ms\');\">50ms</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetReferenceTime(\'100ms\');\">100ms</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetReferenceTime(\'250ms\');\">250ms</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetReferenceTime(\'500ms\');\">500ms</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"SetReferenceTime(\'1000ms\');\">1000ms</a></li>\n"
" </ul>\n"
"</li>\n"
"<li id=\"ilThreads\"><a>Threads</a>\n"
" <ul id=\"ThreadSubMenu\">\n"
" <li><a href=\"javascript:void(0)\" onclick=\"ToggleThread();\">All</a></li>\n"
" <li><a>---</a></li>\n"
" </ul>\n"
"</li>\n"
"<li id=\"ilGroups\"><a>Groups</a>\n"
" <ul id=\"GroupSubMenu\">\n"
" <li><a href=\"javascript:void(0)\" onclick=\"ToggleGroup();\">All</a></li>\n"
" <li><a>---</a></li>\n"
" </ul>\n"
"</li>\n"
"<li id=\"ilOptions\"><a>Options </a>\n"
" <ul id=\'OptionsMenu\'>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"ToggleContextSwitch();\">Context Switch</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"ToggleDisableMerge();\">MergeDisable</a></li>\n"
" <li><a href=\"javascript:void(0)\" onclick=\"ToggleDisableLod();\">LodDisable</a></li>\n"
" <li id=\'GroupColors\'><a href=\"javascript:void(0)\" onclick=\"ToggleGroupColors();\">Group Colors</a></li>\n"
" <li id=\'TimersMeta\'><a href=\"javascript:void(0)\" onclick=\"ToggleTimersMeta();\">Meta</a></li>\n"
" <li id=\'ShowHelp\'><a href=\"javascript:void(0)\" onclick=\"ShowHelp(1,1);\">Help</a></li>\n"
"<!-- <li><a href=\"javascript:void(0)\" onclick=\"ToggleDebug();\">DEBUG</a></li> -->\n"
" </ul>\n"
"</li>\n"
"</ul>\n"
"</div>\n"
"<script>\n"
"function InvertColor(hexTripletColor) {\n"
" var color = hexTripletColor;\n"
" color = color.substring(1); // remove #\n"
" color = parseInt(color, 16); // convert to integer\n"
" var R = ((color >> 16) % 256)/255.0;\n"
" var G = ((color >> 8) % 256)/255.0;\n"
" var B = ((color >> 0) % 256)/255.0;\n"
" var lum = (0.2126*R + 0.7152*G + 0.0722*B);\n"
" if(lum < 0.7)\n"
" {\n"
" return \'#ffffff\';\n"
" }\n"
" else\n"
" {\n"
" return \'#333333\';\n"
" }\n"
"}\n"
"function InvertColorIndex(hexTripletColor) {\n"
" var color = hexTripletColor;\n"
" color = color.substring(1); // remove #\n"
" color = parseInt(color, 16); // convert to integer\n"
" var R = ((color >> 16) % 256)/255.0;\n"
" var G = ((color >> 8) % 256)/255.0;\n"
" var B = ((color >> 0) % 256)/255.0;\n"
" var lum = (0.2126*R + 0.7152*G + 0.0722*B);\n"
" if(lum < 0.7)\n"
" {\n"
" return 0;\n"
" }\n"
" else\n"
" {\n"
" return 1;\n"
" }\n"
"}\n"
"function MakeGroup(id, name, category, numtimers, isgpu, total, average, max, color)\n"
"{\n"
" var group = {\"id\":id, \"name\":name, \"category\":category, \"numtimers\":numtimers, \"isgpu\":isgpu, \"total\": total, \"average\" : average, \"max\" : max, \"color\":color};\n"
" return group;\n"
"}\n"
"\n"
"function MakeTimer(id, name, group, color, colordark, average, max, min, exclaverage, exclmax, callaverage, callcount, total, meta, metaagg, metamax)\n"
"{\n"
" var timer = {\"id\":id, \"name\":name, \"namelabel\":name.startsWith(\"$\"), \"color\":color, \"colordark\":colordark,\"timercolor\":color, \"textcolor\":InvertColor(color), \"group\":group, \"average\":average, \"max\":max, \"min\":min, \"exclaverage\":exclaverage, \"exclmax\":exclmax, \"callaverage\":callaverage, \"callcount\":callcount, \"total\":total, \"meta\":meta, \"textcolorindex\":InvertColorIndex(color), \"metaagg\":metaagg, \"metamax\":metamax, \"worst\":0, \"worststart\":0, \"worstend\":0};\n"
" return timer;\n"
"}\n"
"\n"
"function MakeTimes(scale, ts)\n"
"{\n"
" for(var i = 0; i < ts.length; ++i)\n"
" {\n"
" ts[i] *= scale;\n"
" }\n"
" return ts;\n"
"}\n"
"\n"
"function MakeTimesExtra(scale, scaleextra, tt, ts)\n"
"{\n"
" for(var i = 0; i < ts.length; ++i)\n"
" {\n"
" ts[i] *= (tt[i] == 4) ? scaleextra : scale;\n"
" }\n"
" return ts;\n"
"}\n"
"\n"
"function MakeFrame(id, framestart, frameend, framestartgpu, frameendgpu, ts, tt, ti, tl)\n"
"{\n"
" var frame = {\"id\":id, \"framestart\":framestart, \"frameend\":frameend, \"framestartgpu\":framestartgpu, \"frameendgpu\":frameendgpu, \"ts\":ts, \"tt\":tt, \"ti\":ti, \"tl\":tl};\n"
" return frame;\n"
"}\n"
"\n"
"function MakeCounter(id, parent, sibling, firstchild, level, name, value, minvalue, maxvalue, formatted, limit, formattedlimit, format, counterprc, boxprc, historydata)\n"
"{\n"
" var historyprcoffset = (minvalue < 0) ? -minvalue : 0;\n"
" var historyprcscale = 1 / (maxvalue + historyprcoffset);\n"
"\n"
" var historyprc = new Array(historydata.length);\n"
" for(var i = 0; i < historydata.length; ++i)\n"
" {\n"
" historydata[i] += minvalue;\n"
" historyprc[i] = (historydata[i] + historyprcoffset) * historyprcscale;\n"
" }\n"
"\n"
" var counter = { \"id\":id, \"parent\":parent, \"sibling\":sibling, \"firstchild\":firstchild, \"level\": level, \"name\":name, \"value\":value, \"formatted\":formatted, \"limit\":limit, \"formattedlimit\":formattedlimit, \"format\":format, \"counterprc\":counterprc, \"boxprc\":boxprc, \"historyprc\": historyprc, \"historydata\":historydata, \"minvalue\":minvalue, \"maxvalue\":maxvalue};\n"
" return counter;\n"
"}\n"
"\n"
"\n"
"";
const size_t g_MicroProfileHtml_begin_0_size = sizeof(g_MicroProfileHtml_begin_0);
const char* g_MicroProfileHtml_begin[] = {
&g_MicroProfileHtml_begin_0[0],
};
size_t g_MicroProfileHtml_begin_sizes[] = {
sizeof(g_MicroProfileHtml_begin_0),
};
size_t g_MicroProfileHtml_begin_count = 1;
const char g_MicroProfileHtml_end_0[] =
"\n"
"\n"
"var CanvasDetailedView = document.getElementById(\'DetailedView\');\n"
"var CanvasHistory = document.getElementById(\'History\');\n"
"var CanvasDetailedOffscreen = document.createElement(\'canvas\');\n"
"var FilterInputGroup = document.getElementById(\'filtergroup\');\n"
"var FilterInputTimer = document.getElementById(\'filtertimer\');\n"
"var FilterInputGroupString = null;\n"
"var FilterInputTimerString = null;\n"
"var FilterInputArray = [FilterInputGroup, FilterInputTimer];\n"
"var FilterGroup = null;\n"
"var FilterTimer = null;\n"
"var g_Msg = \'0\';\n"
"\n"
"var Initialized = 0;\n"
"var fDetailedOffset = Frames[0].framestart;\n"
"var fDetailedRange = Frames[0].frameend - fDetailedOffset;\n"
"var nWidth = CanvasDetailedView.width;\n"
"var nHeight = CanvasDetailedView.height;\n"
"var ReferenceTime = 33;\n"
"var nHistoryHeight = 70;\n"
"var nOffsetY = 0;\n"
"var nOffsetBarsX = 0;\n"
"var nOffsetBarsY = 0;\n"
"var nOffsetCountersY = 0;\n"
"var nBarsWidth = 80;\n"
"var NameWidth = 200;\n"
"var MouseButtonState = [0,0,0,0,0,0,0,0];\n"
"var KeyShiftDown = 0;\n"
"var MouseDragButton = 0;\n"
"var KeyCtrlDown = 0;\n"
"var ToolTip = 1; //0: off, 1: default, 2: flipped\n"
"var DetailedViewMouseX = 0;\n"
"var DetailedViewMouseY = 0;\n"
"var HistoryViewMouseX = -1;\n"
"var HistoryViewMouseY = -1;\n"
"var MouseHistory = 0;\n"
"var MouseDetailed = 0;\n"
"var FontHeight = 10;\n"
"var FontWidth = 1;\n"
"var FontAscent = 3; //Set manually\n"
"var Font = \'Bold \' + FontHeight + \'px Courier New\';\n"
"var FontFlash = \'Bold \' + 35 + \'px Courier New\';\n"
"var BoxHeight = FontHeight + 2;\n"
"var ThreadsActive = new Object();\n"
"var ThreadsAllActive = 1;\n"
"var GroupsActive = new Object();\n"
"var GroupsAllActive = 1;\n"
"var nMinWidth = 0.01;//subpixel width\n"
"var nMinWidthPan = 1.0;//subpixel width when panning\n"
"var nContextSwitchEnabled = 1;\n"
"var DisableLod = 0;\n"
"var DisableMerge = 0;\n"
"var GroupColors = 0;\n"
"var nModDown = 0;\n"
"var g_MSG = \'no\';\n"
"var nDrawCount = 0;\n"
"var nBackColors = [\'#474747\', \'#313131\' ];\n"
"var nBackColorOffset = \'#606060\';\n"
"var CSwitchColors =[\"#9DD8AF\",\"#D7B6DA\",\"#EAAC76\",\"#DBDA61\",\"#8AD5E1\",\"#8CE48B\",\"#C4D688\",\"#57E5C4\"];//generated by http://tools.medialab.sciences-po.fr/iwanthue/index.php\n"
"var CSwitchHeight = 5;\n"
"var FRAME_HISTORY_COLOR_CPU = \'#ff7f27\';\n"
"var FRAME_HISTORY_COLOR_GPU = \'#ffffff\';\n"
"var ZOOM_TIME = 0.5;\n"
"var AnimationActive = false;\n"
"var nHoverCSCpu = -1;\n"
"var nHoverCSCpuNext = -1;\n"
"var nHoverCSToolTip = null;\n"
"var nHoverToken = -1;\n"
"var nHoverFrame = -1;\n"
"var nHoverTokenIndex = -1;\n"
"var nHoverTokenLogIndex = -1;\n"
"var nHoverCounter = 0;\n"
"var nHoverCounterDelta = 8;\n"
"var nHoverTokenNext = -1;\n"
"var nHoverTokenLogIndexNext = -1;\n"
"var nHoverTokenIndexNext = -1;\n"
"var nHoverCounter = -1;\n"
"var nHoverTokenDrawn = -1;\n"
"var nHideHelp = 0;\n"
"var fFrameScale = 33.33;\n"
"var SortColumn = 0;\n"
"var SortColumnOrderFlip = 0;\n"
"var SortColumnMouseOver = null;\n"
"var SortColumnMouseOverNext = null;\n"
"\n"
"function RangeInit()\n"
"{\n"
" return {\"Begin\":-1, \"End\":-1, \"YBegin\":-1, \"YEnd\":-1, \"Thread\": -1 , \"Index\": -1};\n"
"}\n"
"function RangeValid(Range)\n"
"{\n"
" return Range.Begin < Range.End;\n"
"}\n"
"function RangeCopy(Dst, Src)\n"
"{\n"
" Dst.Begin = Src.Begin;\n"
" Dst.End = Src.End;\n"
" Dst.YBegin = Src.YBegin;\n"
" Dst.YEnd = Src.YEnd;\n"
" Dst.Thread = Src.Thread;\n"
"}\n"
"var RangeCpu = RangeInit();\n"
"var RangeGpu = RangeInit();\n"
"var RangeSelect = RangeInit();\n"
"\n"
"var RangeCpuNext = RangeInit();\n"
"var RangeGpuNext = RangeInit();\n"
"\n"
"var RangeCpuHistory = RangeInit();\n"
"var RangeGpuHistory = RangeInit();\n"
"\n"
"var fRangeBegin = 0;\n"
"var fRangeEnd = -1;\n"
"var fRangeThreadId = -1;\n"
"var fRangeThreadIdNext = -1;\n"
"var fRangeBeginNext = 0;\n"
"var fRangeEndNext = 0;\n"
"var fRangeBeginGpuNext = 0;\n"
"var fRangeEndGpuNext = 0;\n"
"var fRangeBeginHistory = -1;\n"
"var fRangeEndHistory = -1;\n"
"var fRangeBeginHistoryGpu = -1;\n"
"var fRangeEndHistoryGpu = -1;\n"
"var fRangeBeginSelect = 0;\n"
"var fRangeEndSelect = -1;\n"
"var ThreadY;\n"
"\n"
"var ModeDetailed = 0;\n"
"var ModeTimers = 1;\n"
"var ModeCounters = 2;\n"
"var Mode = ModeDetailed;\n"
"\n"
"var DebugDrawQuadCount = 0;\n"
"var DebugDrawTextCount = 0;\n"
"var ProfileMode = 0;\n"
"var ProfileRedraw0 = 0;\n"
"var ProfileRedraw1 = 0;\n"
"var ProfileRedraw2 = 0;\n"
"var ProfileFps = 0;\n"
"var ProfileFpsAggr = 0;\n"
"var ProfileFpsCount = 0;\n"
"var ProfileLastTimeStamp = new Date();\n"
"\n"
"var CSwitchCache = {};\n"
"var CSwitchOnlyThreads = [];\n"
"var ProfileData = {};\n"
"var ProfileStackTime = {};\n"
"var ProfileStackName = {};\n"
"var Debug = 1;\n"
"\n"
"var g_MaxStack = Array();\n"
"var g_TypeArray;\n"
"var g_TimeArray;\n"
"var g_IndexArray;\n"
"var g_LabelArray;\n"
"var LodData = new Array();\n"
"var NumLodSplits = 10;\n"
"var SplitMin = 100;\n"
"var SPLIT_LIMIT = 1e20;\n"
"var DPR = 1;\n"
"var DetailedRedrawState = {};\n"
"var OffscreenData;\n"
"var DetailedFrameCounter = 0;\n"
"var Invalidate = 0;\n"
"var GroupOrder = Array();\n"
"var ThreadOrder = Array();\n"
"var TimersGroups = 0;\n"
"var TimersMeta = 1;\n"
"var MetaLengths = Array();\n"
"var MetaLengthsAvg = Array();\n"
"var MetaLengthsMax = Array();\n"
"\n"
"var ZoomActive = 0;\n"
"\n"
"var StrGroup = \"Group\";\n"
"var StrThread = \"Thread\";\n"
"var StrTimer = \"Timer\";\n"
"var StrAverage = \"Average\";\n"
"var StrMax = \"Max\";\n"
"var StrTotal = \"Total\";\n"
"var StrMin = \"Min\";\n"
"var StrCallAverage = \"Call Average\";\n"
"var StrCount = \"Count\";\n"
"var StrExclAverage = \"Excl Average\";\n"
"var StrExclMax = \"Excl Max\";\n"
"\n"
"\n"
"function ProfileModeClear()\n"
"{\n"
" if(ProfileMode)\n"
" {\n"
" ProfileData = new Object();\n"
" ProfileStackTime = new Array();\n"
" ProfileStackName = new Array();\n"
" }\n"
"}\n"
"function ProfileEnter(Name)\n"
"{\n"
" if(ProfileMode)\n"
" {\n"
" ProfileStackTime.push(new Date());\n"
" ProfileStackName.push(Name);\n"
" }\n"
"}\n"
"function ProfileLeave()\n"
"{\n"
" if(ProfileMode)\n"
" {\n"
" var Time = new Date();\n"
" var Delta = Time - ProfileStackTime.pop();\n"
" var Name = ProfileStackName.pop();\n"
" var Obj = ProfileData[Name];\n"
" if(!Obj)\n"
" {\n"
" Obj = new Object();\n"
" Obj.Count = 0;\n"
" Obj.Name = Name;\n"
" Obj.Time = 0;\n"
" ProfileData[Name] = Obj;\n"
" }\n"
" Obj.Time += Delta;\n"
" Obj.Count += 1;\n"
" }\n"
"}\n"
"\n"
"function ProfilePlot(s)\n"
"{\n"
" if(ProfileMode)\n"
" {\n"
" var A = ProfileData.Plot;\n"
" if(!A)\n"
" {\n"
" ProfileData.Plot = Array();\n"
" A = ProfileData.Plot;\n"
" }\n"
" if(A.length<10)\n"
" {\n"
" A.push(s);\n"
" }\n"
" }\n"
"}\n"
"function ProfileModeDump()\n"
"{\n"
" for(var idx in ProfileData)\n"
" {\n"
" var Timer = ProfileData[idx];\n"
" console.log(Timer.Name + \" \" + Timer.Time + \"ms \" + Timer.Count);\n"
" }\n"
"\n"
"}\n"
"function ProfileModeDraw(Canvas)\n"
"{\n"
" if(ProfileMode)\n"
" {\n"
" var StringArray = [];\n"
" for(var idx in ProfileData)\n"
" {\n"
" if(idx == \"Plot\")\n"
" continue;\n"
" var Timer = ProfileData[idx];\n"
" StringArray.push(Timer.Name);\n"
" StringArray.push(Timer.Time + \"ms\");\n"
" StringArray.push(\"#\");\n"
" StringArray.push(\"\" + Timer.Count);\n"
" }\n"
" StringArray.push(\"debug\");\n"
" StringArray.push(Debug);\n"
" var Time = new Date();\n"
" var Delta = Time - ProfileLastTimeStamp;\n"
" ProfileLastTimeStamp = Time;\n"
" StringArray.push(\"Frame Delta\");\n"
" StringArray.push(Delta + \"ms\");\n"
" if(ProfileMode == 2)\n"
" {\n"
" ProfileFpsAggr += Delta;\n"
" ProfileFpsCount ++ ;\n"
" var AggrFrames = 10;\n"
" if(ProfileFpsCount == AggrFrames)\n"
" {\n"
" ProfileFps = 1000 / (ProfileFpsAggr / AggrFrames);\n"
" ProfileFpsAggr = 0;\n"
" ProfileFpsCount = 0;\n"
" }\n"
" StringArray.push(\"FPS\");\n"
" StringArray.push(\"\" + ProfileFps.toFixed(2));\n"
" }\n"
" StringArray.push(\"ProfileRedraw0\");\n"
" StringArray.push(\"\" + ProfileRedraw0);\n"
" StringArray.push(\"ProfileRedraw1\");\n"
" StringArray.push(\"\" + ProfileRedraw1);\n"
" StringArray.push(\"ProfileRedraw2\");\n"
" StringArray.push(\"\" + ProfileRedraw2);\n"
" ProfileRedraw0 = 0;\n"
" ProfileRedraw1 = 0;\n"
" ProfileRedraw2 = 0;\n"
"\n"
"\n"
" for(var i = 0; i < ProfileData.Plot; ++i)\n"
" {\n"
" StringArray.push(\"\");\n"
" StringArray.push(ProfileData.Plot[i]);\n"
" }\n"
" ProfileData.Plot = Array();\n"
" DrawToolTip(StringArray, Canvas, 0, 200);\n"
" }\n"
"}\n"
"\n"
"function ToggleDebugMode()\n"
"{\n"
" ProfileMode = (ProfileMode+1)%4;\n"
" console.log(\'Toggle Debug Mode \' + ProfileMode);\n"
"}\n"
"\n"
"function DetailedTotal()\n"
"{\n"
" var Total = 0;\n"
" for(var i = 0; i < Frames.length; i++)\n"
" {\n"
" var frfr = Frames[i];\n"
" Total += frfr.frameend - frfr.framestart;\n"
" }\n"
" return Total;\n"
"}\n"
"\n"
"function InitFrameInfo()\n"
"{\n"
"\n"
" var div = document.getElementById(\'divFrameInfo\');\n"
" var txt = \'\';\n"
" txt = txt + \'Timers View\' + \'<br>\';\n"
" txt = txt + \'Frames:\' + AggregateInfo.Frames +\'<br>\';\n"
" txt = txt + \'Time:\' + AggregateInfo.Time.toFixed(2) +\'ms<br>\';\n"
" txt = txt + \'<hr>\';\n"
" txt = txt + \'Detailed View\' + \'<br>\';\n"
" txt = txt + \'Frames:\' + Frames.length +\'<br>\';\n"
" txt = txt + \'Time:\' + DetailedTotal().toFixed(2) +\'ms<br>\';\n"
" div.innerHTML = txt;\n"
"}\n"
"function InitGroups()\n"
"{\n"
" for(groupid in GroupInfo)\n"
" {\n"
" var TimerArray = Array();\n"
" for(timerid in TimerInfo)\n"
" {\n"
" if(TimerInfo[timerid].group == groupid)\n"
" {\n"
" TimerArray.push(timerid);\n"
" }\n"
" }\n"
" GroupInfo[groupid].TimerArray = TimerArray;\n"
" }\n"
"}\n"
"\n"
"function InitThreadMenu()\n"
"{\n"
" var ulThreadMenu = document.getElementById(\'ThreadSubMenu\');\n"
" var MaxLen = 7;\n"
" ThreadOrder = CreateOrderArray(ThreadNames, function(a){return a;});\n"
" for(var idx in ThreadOrder)\n"
" {\n"
" var name = ThreadNames[ThreadOrder[idx]];\n"
" var li = document.createElement(\'li\');\n"
" if(name.length > MaxLen)\n"
" {\n"
" MaxLen = name.length;\n"
" }\n"
" li.innerText = name;\n"
" var asText = li.innerHTML;\n"
" var html = \'<a href=\"javascript:void(0)\" onclick=\"ToggleThread(\\'\' + name + \'\\');\">\' + asText + \'</a>\';\n"
" li.innerHTML = html;\n"
" ulThreadMenu.appendChild(li);\n"
" }\n"
" var LenStr = (5+(1+MaxLen) * (1+FontWidth)) + \'px\';\n"
" var Lis = ulThreadMenu.getElementsByTagName(\'li\');\n"
" for(var i = 0; i < Lis.length; ++i)\n"
" {\n"
" Lis[i].style[\'width\'] = LenStr;\n"
" }\n"
"}\n"
"\n"
"function UpdateThreadMenu()\n"
"{\n"
" var ulThreadMenu = document.getElementById(\'ThreadSubMenu\');\n"
" var as = ulThreadMenu.getElementsByTagName(\'a\');\n"
" for(var i = 0; i < as.length; ++i)\n"
" {\n"
" var elem = as[i];\n"
" var inner = elem.innerText;\n"
" var bActive = false;\n"
" if(i < 2)\n"
" {\n"
" if(inner == \'All\')\n"
" {\n"
" bActive = ThreadsAllActive;\n"
" }\n"
" }\n"
" else\n"
" {\n"
" bActive = ThreadsActive[inner];\n"
" }\n"
" if(bActive)\n"
" {\n"
" elem.style[\'text-decoration\'] = \'underline\';\n"
" }\n"
" else\n"
" {\n"
" elem.style[\'text-decoration\'] = \'none\';\n"
" }\n"
" }\n"
"}\n"
"\n"
"function ToggleThread(ThreadName)\n"
"{\n"
" if(ThreadName)\n"
" {\n"
" if(ThreadsActive[ThreadName])\n"
" {\n"
" ThreadsActive[ThreadName] = false;\n"
" }\n"
" else\n"
" {\n"
" ThreadsActive[ThreadName] = true;\n"
" }\n"
" }\n"
" else\n"
" {\n"
" if(ThreadsAllActive)\n"
" {\n"
" ThreadsAllActive = 0;\n"
" }\n"
" else\n"
" {\n"
" ThreadsAllActive = 1;\n"
" }\n"
" }\n"
" Invalidate = 0;\n"
" UpdateThreadMenu();\n"
" WriteCookie();\n"
" Draw(1);\n"
"\n"
"}\n"
"\n"
"function CreateOrderArray(Source, NameFunc)\n"
"{\n"
" var Temp = Array(Source.length);\n"
" for(var i = 0; i < Source.length; ++i)\n"
" {\n"
" Temp[i] = {};\n"
" Temp[i].index = i;\n"
" Temp[i].namezz = NameFunc(Source[i]).toLowerCase();\n"
" }\n"
" Temp.sort(function(l, r)\n"
" { \n"
" if(r.namezz<l.namezz)\n"
" {return 1;}\n"
" if(l.namezz<r.namezz)\n"
" {return -1;} \n"
" return 0;\n"
" } );\n"
" var OrderArray = Array(Source.length);\n"
" for(var i = 0; i < Source.length; ++i)\n"
" {\n"
" OrderArray[i] = Temp[i].index;\n"
" }\n"
" return OrderArray;\n"
"}\n"
"\n"
"\n"
"function InitGroupMenu()\n"
"{\n"
" var ulGroupMenu = document.getElementById(\'GroupSubMenu\');\n"
" var MaxLen = 7;\n"
" var MenuArray = Array();\n"
" for(var i = 0; i < GroupInfo.length; ++i)\n"
" {\n"
" var x = {};\n"
" x.IsCategory = 0;\n"
" x.category = GroupInfo[i].category;\n"
" x.name = GroupInfo[i].name;\n"
" x.index = i;\n"
" MenuArray.push(x);\n"
" }\n"
" for(var i = 0; i < CategoryInfo.length; ++i)\n"
" {\n"
" var x = {};\n"
" x.IsCategory = 1;\n"
" x.category = i;\n"
" x.name = CategoryInfo[i];\n"
" x.index = i;\n"
" MenuArray.push(x);\n"
" }\n"
" var OrderFunction = function(a){ return a.category + \"__\" + a.name; };\n"
" var OrderFunctionMenu = function(a){ return a.IsCategory ? (a.category + \'\') : (a.category + \"__\" + a.name); };\n"
" GroupOrder = CreateOrderArray(GroupInfo, OrderFunction);\n"
" var MenuOrder = CreateOrderArray(MenuArray, OrderFunctionMenu);\n"
"\n"
" for(var idx in MenuOrder)\n"
" {\n"
" var MenuItem = MenuArray[MenuOrder[idx]];\n"
" var name = MenuItem.name;\n"
" var li = document.createElement(\'li\');\n"
" if(name.length > MaxLen)\n"
" {\n"
" MaxLen = name.length;\n"
" }\n"
" var jsfunc = \'\';\n"
" if(MenuItem.IsCategory)\n"
" { \n"
" li.innerText = \'[\' + name + \']\';\n"
" jsfunc = \"ToggleCategory\";\n"
" }\n"
" else\n"
" {\n"
" li.innerText = name;\n"
" jsfunc = \"ToggleGroup\";\n"
" }\n"
" var asText = li.innerHTML;\n"
" var html = \'<a href=\"javascript:void(0)\" onclick=\"\' + jsfunc + \'(\\'\' + name + \'\\');\">\' + asText + \'</a>\';\n"
" li.innerHTML = html;\n"
" ulGroupMenu.appendChild(li);\n"
" }\n"
" var LenStr = (5+(1+MaxLen) * FontWidth) + \'px\';\n"
" var Lis = ulGroupMenu.getElementsByTagName(\'li\');\n"
" for(var i = 0; i < Lis.length; ++i)\n"
" {\n"
" Lis[i].style[\'width\'] = LenStr;\n"
" }\n"
" UpdateGroupMenu();\n"
"}\n"
"\n"
"function UpdateGroupMenu()\n"
"{\n"
" var ulThreadMenu = document.getElementById(\'GroupSubMenu\');\n"
" var as = ulThreadMenu.getElementsByTagName(\'a\');\n"
" for(var i = 0; i < as.length; ++i)\n"
" {\n"
" var elem = as[i];\n"
" var inner = elem.innerText;\n"
" var bActive = false;\n"
" if(i < 2)\n"
" {\n"
" if(inner == \'All\')\n"
" {\n"
" bActive = GroupsAllActive;\n"
" }\n"
" }\n"
" else\n"
" {\n"
" var CategoryString = inner.length>2 ? inner.substring(1, inner.length-2) : \"\";\n"
" var CategoryIdx = CategoryIndex(CategoryString);\n"
" if(inner[0] == \'[\' && inner[inner.length-1] == \']\' && CategoryIdx >= 0)\n"
" {\n"
" bActive = IsCategoryActive(CategoryIdx);\n"
" }\n"
" else\n"
" {\n"
" bActive = GroupsActive[inner];\n"
" }\n"
" }\n"
" if(bActive)\n"
" {\n"
" elem.style[\'text-decoration\'] = \'underline\';\n"
" }\n"
" else\n"
" {\n"
" elem.style[\'text-decoration\'] = \'none\';\n"
" }\n"
" }\n"
"}\n"
"function CategoryIndex(CategoryName)\n"
"{\n"
" for(var i = 0; i < CategoryInfo.length; ++i)\n"
" {\n"
" if(CategoryInfo[i] == CategoryName)\n"
" {\n"
" return i;\n"
" }\n"
" }\n"
" return -1;\n"
"}\n"
"function IsCategoryActive(CategoryIdx)\n"
"{\n"
" for(var i = 0; i < GroupInfo.length; ++i)\n"
" {\n"
" if(GroupInfo[i].category == CategoryIdx)\n"
" {\n"
" var Name = GroupInfo[i].name;\n"
" if(!GroupsActive[Name])\n"
" {\n"
" return false;\n"
" }\n"
" }\n"
" }\n"
" return true;\n"
"\n"
"}\n"
"function ToggleCategory(CategoryName)\n"
"{\n"
" var CategoryIdx = CategoryIndex(CategoryName);\n"
" if(CategoryIdx < 0)\n"
" return;\n"
" var CategoryActive = IsCategoryActive(CategoryIdx);\n"
" for(var i = 0; i < GroupInfo.length; ++i)\n"
" {\n"
" if(GroupInfo[i].category == CategoryIdx)\n"
" {\n"
" var Name = GroupInfo[i].name;\n"
" if(CategoryActive)\n"
" {\n"
" GroupsActive[Name] = false;\n"
" }\n"
" else\n"
" {\n"
" GroupsActive[Name] = true;\n"
" }\n"
" }\n"
" }\n"
" UpdateGroupMenu();\n"
" WriteCookie();\n"
" RequestRedraw();\n"
"}\n"
"\n"
"function ToggleGroup(GroupName)\n"
"{\n"
" if(GroupName)\n"
" {\n"
" if(GroupsActive[GroupName])\n"
" {\n"
" GroupsActive[GroupName] = false;\n"
" }\n"
" else\n"
" {\n"
" GroupsActive[GroupName] = true;\n"
" }\n"
" }\n"
" else\n"
" {\n"
" if(GroupsAllActive)\n"
" {\n"
" GroupsAllActive = 0;\n"
" }\n"
" else\n"
" {\n"
" GroupsAllActive = 1;\n"
" }\n"
" }\n"
" UpdateGroupMenu();\n"
" WriteCookie();\n"
" RequestRedraw();\n"
"}\n"
"function UpdateGroupColors()\n"
"{\n"
" for(var i = 0; i < TimerInfo.length; ++i)\n"
" {\n"
" if(GroupColors)\n"
" {\n"
" TimerInfo[i].color = GroupInfo[TimerInfo[i].group].color;\n"
" }\n"
" else\n"
" {\n"
" TimerInfo[i].color = TimerInfo[i].timercolor;\n"
" }\n"
" TimerInfo[i].textcolorindex = InvertColorIndex(TimerInfo[i].color);\n"
" }\n"
"}\n"
"\n"
"function ToggleGroupColors()\n"
"{\n"
" GroupColors = !GroupColors;\n"
" UpdateGroupColors();\n"
" UpdateOptionsMenu();\n"
" WriteCookie();\n"
" RequestRedraw();\n"
"}\n"
"\n"
"function UpdateOptionsMenu()\n"
"{\n"
" var ulTimersMeta = document.getElementById(\'TimersMeta\');\n"
" ulTimersMeta.style[\'text-decoration\'] = TimersMeta ? \'underline\' : \'none\';\n"
" var ulGroupColors = document.getElementById(\'GroupColors\');\n"
" ulGroupColors.style[\'text-decoration\'] = GroupColors ? \'underline\' : \'none\';\n"
"}\n"
"\n"
"function ToggleTimersMeta()\n"
"{\n"
" TimersMeta = TimersMeta ? 0 : 1;\n"
" WriteCookie();\n"
" UpdateOptionsMenu();\n"
" RequestRedraw();\n"
"}\n"
"\n"
"function ShowHelp(Show, Forever)\n"
"{\n"
" var HelpWindow = document.getElementById(\'helpwindow\');\n"
" if(Show)\n"
" {\n"
" HelpWindow.style[\'display\'] = \'block\';\n"
" }\n"
" else\n"
" {\n"
" HelpWindow.style[\'display\'] = \'none\';\n"
" }\n"
" if(Forever)\n"
" {\n"
" nHideHelp = Show ? 0 : 1;\n"
" WriteCookie();\n"
" }\n"
"}\n"
"function SetMode(NewMode, Groups)\n"
"{\n"
" var buttonTimers = document.getElementById(\'buttonTimers\');\n"
" var buttonDetailed = document.getElementById(\'buttonDetailed\');\n"
" var buttonGroups = document.getElementById(\'buttonGroups\');\n"
" var buttonThreads = document.getElementById(\'buttonThreads\');\n"
" var buttonCounters = document.getElementById(\'buttonCounters\');\n"
" var ilThreads = document.getElementById(\'ilThreads\');\n"
" var ilGroups = document.getElementById(\'ilGroups\');\n"
" var ModeElement = null;\n"
" buttonTimers.style[\'text-decoration\'] = \'none\';\n"
" buttonGroups.style[\'text-decoration\'] = \'none\';\n"
" buttonThreads.style[\'text-decoration\'] = \'none\';\n"
" buttonDetailed.style[\'text-decoration\'] = \'none\';\n"
" buttonCounters.style[\'text-decoration\'] = \'none\';\n"
"\n"
"\n"
" if(NewMode == \'counters\' || NewMode == ModeCounters)\n"
" {\n"
" buttonCounters.style[\'text-decoration\'] = \'underline\';\n"
" ilThreads.style[\'display\'] = \'none\';\n"
" ilGroups.style[\'display\'] = \'none\';\n"
" Mode = ModeCounters;\n"
" ModeElement = buttonCounters;\n"
"\n"
" }\n"
" else if(NewMode == \'timers\' || NewMode == ModeTimers)\n"
" {\n"
" TimersGroups = Groups;\n"
" buttonTimers.style[\'text-decoration\'] = TimersGroups ? \'none\' : \'underline\';\n"
" buttonGroups.style[\'text-decoration\'] = TimersGroups == 1 ? \'underline\' : \'none\';\n"
" buttonThreads.style[\'text-decoration\'] = TimersGroups == 2 ? \'underline\' : \'none\';\n"
" buttonDetailed.style[\'text-decoration\'] = \'none\';\n"
" if(TimersGroups == 0)\n"
" {\n"
" ilThreads.style[\'display\'] = \'none\';\n"
" }\n"
" else\n"
" {\n"
" ilThreads.style[\'display\'] = \'block\';\n"
" }\n"
" ilGroups.style[\'display\'] = \'block\';\n"
" Mode = ModeTimers;\n"
" ModeElement = TimersGroups == 2 ? buttonThreads : TimersGroups == 1 ? buttonGroups : buttonTimers;\n"
"\n"
" }\n"
" else if(NewMode == \'detailed\' || NewMode == ModeDetailed)\n"
" {\n"
" buttonDetailed.style[\'text-decoration\'] = \'underline\';\n"
" \n"
" ilThreads.style[\'display\'] = \'block\';\n"
" ilGroups.style[\'display\'] = \'none\';\n"