forked from jonasmr/microprofile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
microprofile_html.h
15291 lines (15276 loc) · 430 KB
/
microprofile_html.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:#343434; 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: #343434;\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;}\n"
"ul li ul li{ display:block;float:none;}\n"
"li li a{ display:block;float:none;text-align:left;word-break: keep-all;white-space: nowrap;}\n"
"#nav li:hover div {margin-left:0;}\n"
".help {position:absolute;z-index:5;text-align:left;padding:2px;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"
".filterinputsearchdiv{position:fixed; background-color: #313131;display:none;}\n"
".filterinputsearchdivmenu{position:absolute; background-color: #313131;display:none;}\n"
".filterinputsearch{width:100px;}\n"
"</style>\n"
"</head>\n"
"<body style=\"\">\n"
"<input type=\"file\" id=\"file-input\" style=\"display:none\"/>\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"
"<div class=\"filterinputsearchdiv\" id=\"FilterInputDiv\">Filter<br><input type=\"text\" id=\"FilterInput\" class=\"filterinputsearch\"></div>\n"
"<div class=\"filterinputsearchdivmenu\" id=\"FilterInputMenuDiv\">Filter<br><input type=\"text\" id=\"FilterInputMenu\" class=\"filterinputsearch\"></div>\n"
"<canvas id=\"History\" height=\"70\" style=\"background-color:#343434;margin:0px;padding:0px;\"></canvas>\n"
"<canvas id=\"DetailedView\" height=\"200\" style=\"background-color:#343434;margin:0px;padding:0px;\"></canvas>\n"
"<canvas id=\"CanvasMenu\" style=\"pointer-events:none;position:absolute;top:0;left:0;margin:0px;padding:0px;zIndex:1\" height=\"500\" width=\"500\"></canvas>\n"
"<div class=\"help\" id=\"divFrameInfo\" style=\"display:none;left:20px;top:300px;width:auto;\"></div>\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"
"hold alt: Show tooltip from timer view in detailed, detailed in timer<br>\n"
"x : Toggle View<br>\n"
"<hr>\n"
"Detailed View:<br>\n"
"Tab: Go To Worst Instance<br>\n"
"Left/Right Arror: Next/Prev Instance<br>\n"
"Enter: Search for timer in view<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"
"<script>\n"
"function ConvertRgbToHsl(hexTripletColor) //from https://gist.github.com/mjackson/5311256\n"
"{\n"
" var color = hexTripletColor;\n"
" color = color.substring(1);\n"
" color = parseInt(color, 16);\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 max = Math.max(r, g, b), min = Math.min(r, g, b);\n"
" var h, s, l = (max + min) / 2;\n"
" if (max == min) {\n"
" h = s = 0; // achromatic\n"
" }\n"
" else \n"
" {\n"
" var d = max - min;\n"
" s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n"
"\n"
" switch (max) \n"
" {\n"
" case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n"
" case g: h = (b - r) / d + 2; break;\n"
" case b: h = (r - g) / d + 4; break;\n"
" }\n"
" h /= 6;\n"
" }\n"
" return [ h, s, l ];\n"
"}\n"
"\n"
"function ConvertHslToColor(h, s, l) //from https://gist.github.com/mjackson/5311256\n"
"{\n"
" var r, g, b;\n"
" if (s == 0)\n"
" {\n"
" r = g = b = l; // achromatic\n"
" }\n"
" else\n"
" {\n"
" function hue2rgb(p, q, t)\n"
" {\n"
" if (t < 0) t += 1;\n"
" if (t > 1) t -= 1;\n"
" if (t < 1/6) return p + (q - p) * 6 * t;\n"
" if (t < 1/2) return q;\n"
" if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;\n"
" return p;\n"
" }\n"
" var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n"
" var p = 2 * l - q;\n"
" r = hue2rgb(p, q, h + 1/3);\n"
" g = hue2rgb(p, q, h);\n"
" b = hue2rgb(p, q, h - 1/3);\n"
" }\n"
" var color = ((r*255)<<16) | ((g*255)<<8) | (b*255);\n"
" return \'#\' + (\"000000\" + color.toString(16)).slice(-6);\n"
"}\n"
"\n"
"\n"
"function ConvertColorDark(hexTripletColor)\n"
"{\n"
" var color = hexTripletColor;\n"
" color = color.substring(1); // remove #\n"
" color = parseInt(color, 16); // convert to integer\n"
" // console.log(color.toString(16));\n"
" color = (color >> 1);\n"
" // console.log(color.toString(16));\n"
" color = color & 0x7f7f7f;\n"
" // console.log(color.toString(16));\n"
" return \'#\' + (\"000000\" + color.toString(16)).slice(-6);\n"
"}\n"
"function InvertColor(hexTripletColor) \n"
"{\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"
"\n"
"function MakeGroup(id, name, category, numtimers, isgpu, total, average, max, color)\n"
"{\n"
" if(color == \"\")\n"
" {\n"
" color = ColorFromString(name, 40, 50);\n"
" }\n"
" var cid = GetColorIndex(color);\n"
" var group = {\"id\":id, \"name\":name, \"category\":category, \"numtimers\":numtimers, \"isgpu\":isgpu, \"total\": total, \"average\" : average, \"max\" : max, \"cid\":cid};\n"
" return group;\n"
"}\n"
"\n"
"function MakeGroupCid(id, name, category, numtimers, isgpu, total, average, max, color, cid)\n"
"{\n"
" var group = {\"id\":id, \"name\":name, \"category\":category, \"numtimers\":numtimers, \"isgpu\":isgpu, \"total\": total, \"average\" : average, \"max\" : max, \"cid\":cid};\n"
" return group;\n"
"}\n"
"\n"
"function MakeTimer(id, name, group, color, colordark, average, max, min, exclaverage, exclmax, callaverage, callcount, total, meta, metaavg, metamax)\n"
"{\n"
" if(color == \"#000000\")\n"
" {\n"
" color = ColorFromString(name + \"x\" + group, 40, 50);\n"
" colordark = ColorFromString(name + \"x\" + group, 25, 50);\n"
" }\n"
" var spike = max <= 0 || average <= 0 ? 0 : (100 * max / average);\n"
" var cid = GetColorIndex(color);\n"
" var timer = {\"id\":id, \"name\":name, \"len\":name.length, \"cid\":cid, \"timercid\":cid, \"group\":group, \"average\":average, \"max\":max, \"min\":min, \"exclaverage\":exclaverage, \"exclmax\":exclmax, \"callaverage\":callaverage, \"callcount\":callcount, \"spike\":spike,\"total\":total, \"meta\":meta, \"metaavg\":metaavg, \"metamax\":metamax, \"worst\":0, \"worststart\":0, \"worstend\":0};\n"
" return timer;\n"
"}\n"
"\n"
"function MakeTimerCid(id, name, group, cid, average, max, min, exclaverage, exclmax, callaverage, callcount, total, meta, metaavg, metamax)\n"
"{\n"
" var spike = max <= 0 || average <= 0 ? 0 : (100 * max / average);\n"
" var timer = {\"id\":id, \"name\":name, \"len\":name.length, \"cid\":cid, \"timercid\":cid, \"group\":group, \"average\":average, \"max\":max, \"min\":min, \"exclaverage\":exclaverage, \"exclmax\":exclmax, \"callaverage\":callaverage, \"callcount\":callcount, \"spike\":spike,\"total\":total, \"meta\":meta, \"metaavg\":metaavg, \"metamax\":metamax, \"worst\":0, \"worststart\":0, \"worstend\":0};\n"
" return timer;\n"
"}\n"
"\n"
"function CloneTimer(T)\n"
"{\n"
" return MakeTimerCid(T.id, T.name, T.group, T.cid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n"
"}\n"
"function CloneGroup(G)\n"
"{\n"
" return MakeGroupCid(G.id, G.name, G.category, G.numtimers, G.isgpu, G.total, G.average, G.max, G.cid);\n"
"}\n"
"\n"
"function MakeFrame(id, framestart, frameend, framestartgpu, frameendgpu, ts, tt, ti)\n"
"{\n"
" var frame = {\"id\":id, \"framestart\":framestart, \"frameend\":frameend, \"framestartgpu\":framestartgpu, \"frameendgpu\":frameendgpu, \"ts\":ts, \"tt\":tt, \"ti\":ti};\n"
" return frame;\n"
"}\n"
"function MakeCounterHistory(id, history, prc)\n"
"{\n"
" var counterhistory = {\"id\":id, \"history\":history, \"prc\":prc};\n"
" return counterhistory;\n"
"}\n"
"function MakeCounter(id, parent, sibling, firstchild, level, name, value, minvalue, maxvalue, formatted, limit, formattedlimit, counterprc, boxprc, format, counterhistory)\n"
"{\n"
" var counter = { \"id\":id, \"parent\":parent, \"sibling\":sibling, \"firstchild\":firstchild, \"level\": level, \"name\":name, \"value\":value, \"formatted\":formatted, \"limit\":limit, \"formattedlimit\":formattedlimit, \"counterprc\":counterprc, \"boxprc\":boxprc, \"counterhistory\":counterhistory, \"format\":format, \"minvalue\":minvalue, \"maxvalue\":maxvalue};\n"
" return counter;\n"
"}\n"
"function Clamp(v, low, high)\n"
"{\n"
" return v < low ? low : (v > high ? high : v);\n"
"}\n"
"function FormatTime(Time)\n"
"{\n"
" return Time.toFixed(2);\n"
"}\n"
"\n"
"\n"
"\n"
"var g_ColorMap = {};\n"
"var g_Colors = new Array();\n"
"var g_ColorsDark = new Array();\n"
"var g_ColorsTextIndex = new Array();\n"
"var g_ColorH = new Array();\n"
"var g_ColorS = new Array();\n"
"var g_ColorL = new Array();\n"
"\n"
"function GetColorIndex(color)\n"
"{\n"
" if(g_ColorMap[color])\n"
" {\n"
" return g_ColorMap[color];\n"
" }\n"
" else\n"
" {\n"
" var idx = g_Colors.length;\n"
" g_ColorMap[color] = idx;\n"
" g_Colors.push(color);\n"
" g_ColorsDark.push(ConvertColorDark(color));\n"
" g_ColorsTextIndex.push(InvertColorIndex(color));\n"
" var hsl = ConvertRgbToHsl(color);\n"
" g_ColorH.push(hsl[0]);\n"
" g_ColorS.push(hsl[1]);\n"
" g_ColorL.push(hsl[2]);\n"
" return idx;\n"
" }\n"
"}\n"
"//color index 0 reserved for blinking\n"
"var cidhovercolor = 0;\n"
"g_Colors.push(\'#000000\');\n"
"g_ColorsDark.push(\'#000000\');\n"
"g_ColorsTextIndex.push(0);\n"
"g_ColorH.push(0);\n"
"g_ColorS.push(0);\n"
"g_ColorL.push(0);\n"
"\n"
"var S = {};\n"
"var S2 = {};\n"
"var Timeline = {};\n"
"S.TimelineArray = [];\n"
"S.TimelineIdArray = [];\n"
"S.TimelineNames = [];\n"
"S.TimelineColorArray = [];\n"
"\n"
"\n"
"\n"
"//EBEGIN\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"
"//EEND\n"
"\n"
"var G_DEBUG = 0;\n"
"\n"
"var CanvasDetailedView = document.getElementById(\'DetailedView\');\n"
"var CanvasHistory = document.getElementById(\'History\');\n"
"var CanvasMenu = document.getElementById(\'CanvasMenu\');\n"
"var CanvasDetailedOffscreen = document.createElement(\'canvas\');\n"
"var FilterInputGroup = document.getElementById(\'filtergroup\');\n"
"var FilterInputTimer = document.getElementById(\'filtertimer\');\n"
"\n"
"var FilterInput = document.getElementById(\'FilterInput\');\n"
"var FilterInputDiv = document.getElementById(\'FilterInputDiv\');\n"
"var FilterInputDivPos = {\"x\":-1,\"y\":-1,\"w\":-1,\"h\":-1};\n"
"var FilterInputMenu = document.getElementById(\'FilterInputMenu\');\n"
"var FilterInputMenuDiv = document.getElementById(\'FilterInputMenuDiv\');\n"
"var FilterInputMenuDivPos = {\"x\":-1,\"y\":-1,\"w\":-1,\"h\":-1};\n"
"var FilterInputMenuValueLast = \'\';\n"
"\n"
"\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 RedrawRequested = 0;\n"
"var InsideDraw = 0;\n"
"\n"
"\n"
"\n"
"var Initialized = 0;\n"
"var fDetailedOffset = S.Frames[0].framestart;\n"
"var fDetailedOffsetSecond = 0;\n"
"var fDetailedRange = S.Frames[S.Frames.length-1].frameend - fDetailedOffset;\n"
"var nWidth = CanvasDetailedView.width;\n"
"var nHeight = CanvasDetailedView.height;\n"
"var ReferenceTimeString = \'auto\';\n"
"var ReferenceTimeAutoString = \'auto\';\n"
"var ReferenceTime = 33;\n"
"var TargetTime = 16;\n"
"var TargetTimeString = \'16ms\';\n"
"var nHistoryHeight = 70;\n"
"var nOffsetY = 0;\n"
"var nOffsetBarsX = 0;\n"
"var nOffsetBarsY = 0;\n"
"var nOffsetCountersY = 0;\n"
"var nOffsetFilterSearch = 0;\n"
"var nOffsetMenuThreads = 0;\n"
"var nOffsetMenuGroups = 0;\n"
"var FilterInputSearchLast = \'\';\n"
"var nBarsWidth = 80;\n"
"var MouseButtonState = [0,0,0,0,0,0,0,0];\n"
"var KeyShiftDown = 0;\n"
"var KeyAltDown = 0;\n"
"var KeyCtrlDown = 0;\n"
"var MouseDragButton = 0;\n"
"var ToolTipFlip = 0; \n"
"var ToolTipCorner = 1;\n"
"var DetailedViewMouseX = 0;\n"
"var DetailedViewMouseY = 0;\n"
"var DetailedMouseOverButton = 0;\n"
"var DetailedMouseEvent = null;\n"
"var HistoryViewMouseX = -1;\n"
"var HistoryViewMouseY = -1;\n"
"var GlobalMouseX = -1;\n"
"var GlobalMouseY = -1;\n"
"var MouseReleased = false;\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 = {};\n"
"var GroupsDisabled = new Object();\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 DrawDetailedFlameMode = 0;\n"
"var DrawDetailedCompareReverse = 1;\n"
"var nModDown = 0;\n"
"var g_MSG = \'no\';\n"
"var nDrawCount = 0;\n"
"var nBackColors = [\'#292929\', \'#343434\' ];\n"
"var nBackColorsDark = [\'#292929\', \'#272727\' ];\n"
"var nBackColorOffset = \'#404040\';\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 HoverTokenOwner = null;\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 HoverTokenNextOwner = null;\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"
"var ColumnsWidth = [];\n"
"var ColumnsEnabled = [];\n"
"let ColumnNames =[\"Average\", \"Max\", \"Total\", \"Min\", \"Spike\", \"Call Average\", \"Call Count\", \"Excl Average\", \"Excl Max\"];\n"
"let NumColumns = ColumnNames.length;\n"
"while(ColumnsEnabled.length < NumColumns)\n"
"{\n"
" ColumnsEnabled.push(1);\n"
" ColumnsWidth.push(20);\n"
"}\n"
"var FilterSearchActive = 0;\n"
"var FilterSearchSelection = -1;\n"
"var FilterSearchSelectionMax = 0;\n"
"var FilterSearchPassIndex = -1;\n"
"FilterSearchReset();\n"
"var FilterSearchStartTime = new Date();\n"
"var IgnoreInput = 0;\n"
"function RangeInit()\n"
"{\n"
" return {\"Begin\":-1, \"End\":-1, \"YBegin\":-1, \"YEnd\":-1, \"Thread\": -1 , \"Index\": -1, \"Off\": 0, \"Second\":0};\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"
" Dst.Off = Src.Off;\n"
" Dst.Second = Src.Second;\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 ThreadYBegin;\n"
"var ThreadYEnd;\n"
"\n"
"var ModeDetailed = 0;\n"
"var ModeTimers = 1;\n"
"var ModeTimers_Threads = 2;\n"
"var ModeTimers_Groups = 3;\n"
"var ModeCounters = 4;\n"
"var ModeCount = 5;\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 ProfileData = {};\n"
"var ProfileStackTime = {};\n"
"var ProfileStackName = {};\n"
"var Debug = 1;\n"
"\n"
"var ThreadLogAutoHide = 0;\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 ThreadOrderNames = Array();\n"
"var ThreadOrderT = Array();\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 StrSpike = \"Spike%\";\n"
"var StrCallAverage = \"Call Average\";\n"
"var StrCount = \"Count\";\n"
"var StrExclAverage = \"Excl Average\";\n"
"var StrExclMax = \"Excl Max\";\n"
"\n"
"var GroupRemapReverse = [];\n"
"var TimerRemapReverse = [];\n"
"var ThreadRemapReverse = [];\n"
"\n"
"let SubMenuHelp = 0;\n"
"let SubMenuMode = 1;\n"
"let SubMenuReference = 2;\n"
"let SubMenuTarget = 3;\n"
"let SubMenuThreads = 4;\n"
"let SubMenuGroups = 5;\n"
"let SubMenuColumns = 6;\n"
"let SubMenuOptions = 7;\n"
"let SubMenuCompare = 8;\n"
"\n"
"let MenuRedraw = 0;\n"
"let SubMenuActive = -1;\n"
"let SubMenuTimeoutBase = 0.7;\n"
"let SubMenuMouseX = 0;\n"
"let SubMenuMouseY = 0;\n"
"let SubMenuTimeout = new Date();\n"
"let MenuItems = [];\n"
"let FilterInputMenuThreadsValue = \'\';\n"
"let FilterInputMenuGroupsValue = \'\';\n"
"let MouseMoveTime = new Date();\n"
"let ReferenceTimes = [-1, 5, 10, 15, 16, 20, 30, 33, 50, 100, 250, 500, 1000];\n"
"let TargetTimes = [5, 10, 15, 16, 20, 30, 33, 50, 100, 250, 500, 1000];\n"
"let ModeItems = [\"Detailed\", \"Timers\", \"Threads\", \"Groups\", \"Counters\"];\n"
"let HideModeCollapsed = 0;\n"
"let HideModeHidden = 1;\n"
"let HideMode = HideModeCollapsed;\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(S)\n"
"{\n"
" var Total = 0;\n"
" for(var i = 0; i < S.Frames.length; i++)\n"
" {\n"
" var frfr = S.Frames[i];\n"
" Total += frfr.frameend - frfr.framestart;\n"
" }\n"
" return Total;\n"
"}\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:\' + S.AggregateInfo.Frames +\'<br>\';\n"
" txt = txt + \'Time:\' + S.AggregateInfo.Time.toFixed(2) +\'ms<br>\';\n"
" txt = txt + \'<hr>\';\n"
" txt = txt + \'Detailed View\' + \'<br>\';\n"
" txt = txt + \'Frames:\' + S.Frames.length +\'<br>\';\n"
" txt = txt + \'Time:\' + DetailedTotal(S).toFixed(2) +\'ms<br>\';\n"
" div.innerHTML = txt;\n"
"}\n"
"function InitGroups()\n"
"{\n"
" for(groupid in S.GroupInfo)\n"
" {\n"
" var TimerArray = Array();\n"
" for(timerid in S.TimerInfo)\n"
" {\n"
" if(S.TimerInfo[timerid].group == groupid)\n"
" {\n"
" TimerArray.push(timerid);\n"
" }\n"
" }\n"
" S.GroupInfo[groupid].TimerArray = TimerArray;\n"
" }\n"
"}\n"
"\n"
"\n"
"function ThreadOrderMove(Name, Dir, Top)\n"
"{ \n"
" let idx = ThreadOrderNames.indexOf(Name);\n"
" let base = idx;\n"
" idx += Dir;\n"
" let found = -1;\n"
" while(idx >= 0 && idx <= ThreadOrderNames.length)\n"
" {\n"
" let n = S.ThreadNames.indexOf(ThreadOrderNames[idx]);\n"
" if(n != -1)\n"
" {\n"
" found = idx;\n"
" if(!Top)\n"
" break;\n"
" }\n"
" idx += Dir;\n"
" }\n"
" Dir = -Dir; \n"
" while(found >= 0 && found <= ThreadOrderNames.length && (Dir > 0 ? (found <= base) : (found >= base)))\n"
" {\n"
" let Tmp = ThreadOrderNames[found];\n"
" ThreadOrderNames[found] = Name;\n"
" Name = Tmp;\n"
" found += Dir;\n"
" }\n"
" ThreadOrderSort();\n"
"}\n"
"function ThreadOrderMoveUp(Name, Top)\n"
"{\n"
" ThreadOrderMove(Name, -1, Top);\n"
" WriteCookie();\n"
"}\n"
"function ThreadOrderMoveDown(Name, Top)\n"
"{\n"
" ThreadOrderMove(Name, 1, Top);\n"
" WriteCookie();\n"
"}\n"
"function ThreadOrderSort()\n"
"{\n"
" for(let i = 0; i < S.ThreadNames.length; ++i)\n"
" {\n"
" var name = S.ThreadNames[i];\n"
" var idx = ThreadOrderNames.indexOf(name);\n"
" if(idx == -1)\n"
" {\n"
" ThreadOrderNames.push(name);\n"
" }\n"
" }\n"
"\n"
" //clear all that are not present??\n"
" let ThreadOrderX = Array(S.ThreadNames.length);\n"
" for(let i = 0; i < S.ThreadNames.length; ++i)\n"
" {\n"
" var n = ThreadOrderNames.indexOf(S.ThreadNames[i]);\n"
" if(n == -1)\n"
" {\n"
" debugger;\n"
" }\n"
" ThreadOrderX[i] = {\"i\":i, \"n\": n};\n"
" }\n"
" ThreadOrderX.sort(function(l,r){return l.n-r.n;});\n"
" ThreadOrderT = Array(S.ThreadNames.length);\n"
" for(let i = 0; i < S.ThreadNames.length; ++i)\n"
" {\n"
" ThreadOrderT[i] = ThreadOrderX[i].i;\n"
" }\n"
"}\n"
"\n"
"function ToggleThread(ThreadName, All, FilterArray, State)\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"
" let Names = All ? S.ThreadNames : FilterArray;\n"
"\n"
" for(let i in Names)\n"
" {\n"
" switch(State)\n"
" {\n"
" case 2: if(!ThreadsActive[Names[i]]){ ThreadsActive[Names[i]] = 1;} break;\n"
" case 1: ThreadsActive[Names[i]] = ThreadsActive[Names[i]] ? 0 : 1; break;\n"
" case 0: if(ThreadsActive[Names[i]]){ ThreadsActive[Names[i]] = 0;} break;\n"
" }\n"
" }\n"
" }\n"
" RequestRedraw();\n"
" Invalidate = 0;\n"
" FilterSearchReset();\n"
" WriteCookie();\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"
"function InitOrderArrays()\n"
"{\n"
" ThreadOrder = [];\n"
" ThreadOrder = CreateOrderArray(S.ThreadNames, function(a){return a;});\n"
"\n"
"\n"
" let MaxLen = 7;\n"
" let MenuArray = Array();\n"
" for(let i = 0; i < S.GroupInfo.length; ++i)\n"
" {\n"
" let x = {};\n"
" x.IsCategory = 0;\n"
" x.category = S.GroupInfo[i].category;\n"
" x.name = S.GroupInfo[i].name;\n"
" x.index = i;\n"
" MenuArray.push(x);\n"
" }\n"
" for(let i = 0; i < S.CategoryInfo.length; ++i)\n"
" {\n"
" let x = {};\n"
" x.IsCategory = 1;\n"
" x.category = i;\n"
" x.name = S.CategoryInfo[i];\n"
" x.index = i;\n"
" MenuArray.push(x);\n"
" }\n"
" let OrderFunction = function(a){ return a.category + \"__\" + a.name; };\n"
" let OrderFunctionMenu = function(a){ return a.IsCategory ? (a.category + \'\') : (a.category + \"__\" + a.name); };\n"
" GroupOrder = CreateOrderArray(S.GroupInfo, OrderFunction);\n"
"}\n"
"\n"
"function CategoryIndex(CategoryName)\n"
"{\n"
" for(var i = 0; i < S.CategoryInfo.length; ++i)\n"
" {\n"
" if(S.CategoryInfo[i] == CategoryName)\n"
" {\n"
" return i;\n"
" }\n"
" }\n"
" return -1;\n"
"}\n"
"function IsCategoryActive(CategoryIdx)\n"
"{\n"
" for(var i = 0; i < S.GroupInfo.length; ++i)\n"
" {\n"
" if(S.GroupInfo[i].category == CategoryIdx)\n"
" {\n"
" var Name = S.GroupInfo[i].name;\n"
" if(!GroupsActive[Name])\n"
" {\n"
" return false;\n"
" }\n"
" }\n"
" }\n"
" return true;\n"
"\n"
"}\n"
"function ToggleCategory(CategoryName, WantRedraw)\n"
"{\n"
" var CategoryIdx = CategoryIndex(CategoryName);\n"
" if(CategoryIdx < 0)\n"
" return;\n"
" var CategoryActive = IsCategoryActive(CategoryIdx);\n"
" for(var i = 0; i < S.GroupInfo.length; ++i)\n"
" {\n"
" if(S.GroupInfo[i].category == CategoryIdx)\n"
" {\n"
" var Name = S.GroupInfo[i].name;\n"
" if(CategoryActive)\n"
" {\n"
" delete GroupsDisabled[Name];\n"
" }\n"
" else\n"
" {\n"
" GroupsDisabled[Name] = 1;\n"
" }\n"
" }\n"
" }\n"
" WriteCookie();\n"
" if(WantRedraw)\n"
" {\n"
" RequestRedraw();\n"
" }\n"
"}\n"
"\n"
"function ToggleGroup(GroupName, All, FilterArray, State)\n"
"{\n"
" if(GroupName)\n"
" {\n"
" if(GroupsDisabled[GroupName])\n"
" {\n"
" delete GroupsDisabled[GroupName];\n"
" }\n"
" else\n"
" {\n"
" GroupsDisabled[GroupName] = 1;\n"
" }\n"
" }\n"