-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathdoctor.html
11158 lines (9560 loc) · 442 KB
/
doctor.html
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
<!DOCTYPE html>
<html lang="en">
<meta charset="utf8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Clinic Doctor</title>
<style>
/* Define colors */
html {
--main-bg-color: rgb(27, 30, 39);
--banner-logo-color: rgba(255, 255, 255, 0.94);
--banner-bg-color: rgb(41, 45, 57);
--alert-border-color: rgb(68, 75, 96);
--alert-bg-color: rgb(55, 61, 79);
--alert-text-color: rgb(255, 255, 255);
--alert-button-color: rgb(200, 201, 203);
--alert-indicator-color: rgb(233, 67, 100);
--menu-button-color: rgb(200, 201, 203);
--graph-text-color: rgb(255, 255, 255);
--graph-bg-color: rgb(27, 30, 39);
--graph-interval-color: rgba(255, 255, 255, 0.05);
--graph-axis-color: rgb(89, 90, 95);
--graph-tick-color: rgb(151, 151, 151);
--graph-good-line-color: rgb(74, 144, 226);
--graph-bad-line-color: rgb(233, 67, 100);
--graph-alert-color: rgb(233, 67, 100);
--hover-text-color: rgb(255, 255, 255);
--hover-bg-color: rgba(82, 87, 111, 0.92);
--hover-line-color: rgb(100, 107, 127);
--recommendbar-text-color: rgb(255, 255, 255);
--recommendbar-arrow-color: rgb(231, 239, 248);
--recommendbar-top-line-color: rgb(96, 147, 208);
--recommendbar-bg-color: rgb(63, 125, 198);
--recommend-text-color: rgb(255, 255, 255);
--recommend-title-bg-color: rgba(0, 0, 0, 0.15);
--recommend-link-color: rgb(62, 167, 244);
--recommend-close-color: rgb(62, 167, 244);
--recommend-menu-selected-color: rgb(63, 125, 198);
--recommend-menu-alert-color: rgb(233, 67, 100);
--recommend-bg-color: rgba(55, 61, 79, 0.99);
--special-scrollbar-bg: rgba(255, 255, 255, .5);
--special-scrollbar-shadow: rgba(0, 0, 0, .5);
}
html.light-theme {
--main-bg-color: rgb(239, 239, 239);
--banner-bg-color: rgb(65, 69, 85);
--alert-bg-color: rgb(227, 227, 227);
--alert-border-color: rgb(189, 189, 189);
--alert-text-color: rgb(101, 101, 101);
--alert-button-color: rgb(123, 128, 146);
--menu-button-color: rgb(123, 128, 146);
--graph-text-color: rgb(101, 101, 101);
--graph-bg-color: rgb(227, 227, 227);
--graph-interval-color: rgba(0, 0, 0, 0.1);
--graph-axis-color: rgb(189, 189, 189);
--recommend-text-color: rgb(20, 20, 20);
--recommend-link-color: rgb(31, 91, 162);
--recommend-close-color: rgb(63, 125, 198);
--recommend-bg-color: rgb(209, 211, 218);
--special-scrollbar-bg: rgba(0, 0, 0, .5);
--special-scrollbar-shadow: rgba(255, 255, 255, .5);
}
/* Main layout */
/* z-index: 1; is the hover boxes */
/* z-index: 2; is the recommendation view */
html, body {
border: 0;
margin: 0;
padding: 0;
}
body {
background: var(--main-bg-color);
}
#front-matter {
display: flex;
align-items: flex-start;
margin: 22px 45px 24px 49px;
overflow: hidden;
}
#front-matter #alert {
flex: 1 1 0px;
min-width: 0; /* don't consider children for min-width calcultion */
}
#front-matter #menu {
flex: 0 0 auto;
height: 24px;
width: 80px;
margin-top: 5px;
}
#graph {
display: grid;
grid-template-columns: 100%;
grid-template-rows: 200px 200px 200px 200px;
grid-template-areas:
"cpu"
"memory"
"delay"
"handles";
grid-column-gap: 20px;
grid-row-gap: 50px;
margin-right: 20px;
}
html.grid-layout #graph {
grid-template-columns: 1fr 1fr;
grid-template-rows: 200px 200px;
grid-template-areas:
"cpu memory"
"delay handles";
}
#graph .sub-graph.cpu {
grid-area: cpu;
}
#graph .sub-graph.memory {
grid-area: memory;
}
#graph .sub-graph.delay {
grid-area: delay;
}
#graph .sub-graph.handles {
grid-area: handles;
}
/* Global Typography */
html {
font-family: sans-serif;
}
html #banner, html #front-matter, html #graph, html #graph .hover text, html #recommendation .details {
/* light text on dark background doesn't look so good in the browser compared
to graphical design tools. This is because graphical design tools uses
antialiasing, where browsers uses subpixel rendering. To make it look
like in the design tool, use antialiased font rendering. More details,
especially on why this is a bad idea:
http://usabilitypost.com/2012/11/05/stop-fixing-font-smoothing/
*/
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
html.light-theme #front-matter, html.light-theme #graph, html.light-theme #recommendation .details {
-webkit-font-smoothing: unset;
-moz-osx-font-smoothing: unset;
}
/* Banner layout */
#banner {
display: flex;
align-items: center;
height: 65px;
background: var(--banner-bg-color);
position: relative;
}
#banner svg {
fill: var(--banner-logo-color);
margin-left: 28px;
}
/* Menu layout */
#alert {
border: 1px solid var(--alert-border-color);
border-radius: 4px;
background: var(--alert-bg-color);
color: var(--alert-text-color);
padding: 5px 13px;
min-height: 22px; /* just for reducing the initial draw blink */
max-height: 22px;
transition: max-height 0.15s;
}
#alert.open {
max-height: 10em;
}
#alert .summary {
display: flex;
height: 22px;
align-items: center;
}
#alert .summary svg.alert {
display: none;
flex: 0 0 auto;
height: 18px;
width: 18px;
fill: var(--alert-indicator-color);
}
#alert.has-issue .summary svg.alert {
display: block;
}
#alert .summary .title {
flex: 1 1 0px;
padding: 0 8px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
#alert .summary .toggle {
display: none;
flex: 0 0 auto;
/* crop empty space in the svg icon */
position: relative;
width: 22px;
height: 22px;
overflow: hidden;
cursor: pointer;
}
#alert.has-issue .summary .toggle {
display: block;
}
#alert .summary .toggle svg {
/* crop empty space in the svg icon */
position: absolute;
top: -8px;
left: -8px;
width: 38px;
height: 38px;
fill: var(--alert-button-color);
}
#alert .summary .toggle svg.arrow-down {
top: -6px;
}
#alert:not(.open) .summary .toggle svg.arrow-up { display: none; }
#alert.open .summary .toggle svg.arrow-down { display: none; }
#alert ul.details {
margin: 8px 0 0 0;
padding: 0;
list-style: none;
}
#alert ul.details li {
padding: 5px 0px;
cursor: pointer;
}
#alert ul.details li::before {
display: inline-block;
width: 18px;
content: '•';
padding: 0 2px 0 6px;
}
#menu .toggle {
float: right;
cursor: pointer;
height: 16px;
padding: 4px;
margin-left: 10px;
}
#menu svg {
fill: var(--menu-button-color);
}
#toggle-grid svg {
height: 16px;
width: 16px;
}
html:not(.grid-layout) #toggle-grid svg.grid-1x4 { display: none; }
html.grid-layout #toggle-grid svg.grid-2x2 { display: none; }
svg#toggle-theme {
height: 16px;
width: 20px;
}
/* recommendation layout */
/* structual: the recommendation structual layout is rather complex, thus
is is seperated here. The styleing layout follows bellow. */
#recommendation {
display: flex;
position: fixed;
bottom: 0;
z-index: 2;
max-height: calc(100vh - 65px); /* 100% - #banner[height] */
width: 100%;
flex-direction: column;
justify-content: flex-end;
align-items: stretch;
}
#recommendation .details {
flex: 0 1 auto;
box-sizing: border-box;
min-height: 255px; /* prevent jumps for no-issue and unknow-issue */
display: none;
overflow: hidden;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
}
#recommendation.open.read-more-open .details {
min-height: calc(100vh - 65px - 65px); /* 100% - #banner[height] .bar[height] */
}
/* change the scroll area to be the entire content if the screen-size is
very small */
@media (max-height: 385px) {
#recommendation .details {
min-height: unset;
}
}
#recommendation.open .details {
display: flex;
}
#recommendation .details .menu {
flex: 0 0 auto;
display: flex;
min-height: 48px;
overflow: hidden;
box-sizing: border-box;
}
#recommendation .details .menu ul {
flex: 1 1 0px;
align-self: flex-end;
}
#recommendation .details .menu .close {
flex: 0 0 24px;
height: 24px;
width: 24px;
align-self: flex-start;
}
#recommendation .details .content {
flex: 0 1 auto;
/* in firefox `flex: 0 1 auto` takes up the content space instead of the
available space. Set min-height to indicate that the auto height can
be less than the content. */
min-height: 0px;
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: stretch;
}
#recommendation .details .content .summary-title {
flex: 0 0 auto;
}
#recommendation .details .content .summary {
flex: 0 0 auto;
}
#recommendation .details .content .read-more-button {
flex: 0 0 auto;
}
#recommendation .details .content .read-more {
display: none;
flex: 0 1 auto;
overflow-y: scroll;
min-height: 0px; /* make auto be the available space instead of content space */
padding-right: 7px;
}
#recommendation.read-more-open .details .content .read-more {
display: block;
}
/* change the scroll area to be the entire content if the screen-size is
very small */
@media (max-height: 700px) {
#recommendation .details .content {
display: block; /* disable flexbox layout for .content content */
overflow-y: scroll;
padding-right: 7px;
}
#recommendation .details .content .read-more {
overflow-y: unset;
padding-right: 0px;
}
}
#recommendation .bar {
flex: 0 0 65px;
box-sizing: border-box;
height: 65px;
width: 100%;
}
/* recommendation styleing */
#recommendation-space {
margin-bottom: 75px; /* #recommendation.bar[height] + 10px */
}
#recommendation .details {
background: var(--recommend-bg-color);
color: var(--recommend-text-color);
padding: 18px 28px;
font-size: 12pt;
line-height: 1.5em;
overscroll-behavior-y: contain; /* prevent scolling the main window */
}
#recommendation .content a {
color: var(--recommend-link-color);
text-decoration: none;
}
#recommendation ::-webkit-scrollbar {
-webkit-appearance: none;
width: 7px;
}
#recommendation ::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: var(--special-scrollbar-bg);
-webkit-box-shadow: 0 0 1px var(--special-shadow-bg);
}
#recommendation .content .summary-title {
display: none;
padding-top: 16px;
}
#recommendation .content .summary-title::after {
content: ':'
}
#recommendation.detected .content .summary-title {
display: block;
}
#recommendation .content .read-more-button {
display: none;
color: var(--recommend-link-color);
cursor: pointer;
}
#recommendation .content .read-more-button::before {
content: 'Read more';
}
#recommendation.read-more-open .content .read-more-button {
margin-bottom: 10px;
}
#recommendation.read-more-open .content .read-more-button::before {
content: 'Read less';
}
#recommendation.has-read-more .content .read-more-button {
display: block;
}
#recommendation .content .read-more .columns {
columns: 400px 4;
text-align: justify;
hyphens: auto;
}
#recommendation .content .read-more h2 {
background: var(--recommend-title-bg-color);
font-size: 12pt;
padding: 12px;
break-after: avoid;
break-before: auto;
margin: 0; /* let p and ul tags dominate margin collapse */
}
#recommendation .content .read-more li {
orphans: 4;
}
#recommendation .menu {
border-bottom: 1px solid var(--recommend-menu-selected-color);
}
#recommendation .menu ul {
list-style-type: none;
padding: 0;
margin: 0;
}
#recommendation .menu ul li {
display: flex;
float: left;
height: 35px;
box-sizing: border-box;
padding: 0px 4px 0 4px;
border-bottom: 4px solid transparent;
margin-right: 30px;
cursor: pointer;
}
#recommendation .menu ul li.selected {
border-bottom: 4px solid var(--recommend-menu-selected-color);
font-weight: bold;
}
#recommendation .menu ul li .menu-text {
flex: 0 0 auto;
align-self: center;
display: block;
line-height: 31px;
}
#recommendation .menu ul li .menu-text::before {
display: block;
width: 100%;
content: attr(data-content);
text-align: center;
}
/* Create a hidden element with the attr(data-content) content, but bold.
This will make the element attain the size as if it had font-weight: bold;.
This prevents jumping of the surrounding menu items when selected. */
#recommendation .menu ul li .menu-text::after {
content: attr(data-content);
display: block;
font-weight: bold;
height: 0;
overflow: hidden;
visibility: hidden;
}
#recommendation .menu ul li .warning-icon {
flex: 0 0 auto;
align-self: center;
margin-left: 10px;
height: 18px;
width: 18px;
display: none;
fill: var(--recommend-menu-alert-color);
}
#recommendation .menu ul li.detected .warning-icon {
display: block;
}
#recommendation .menu svg.close {
fill: var(--recommend-close-color);
cursor: pointer;
}
#recommendation .bar {
border-top: 1px solid var(--recommendbar-top-line-color);
background: var(--recommendbar-bg-color);
overflow: hidden;
cursor: pointer;
}
#recommendation .bar .text::after {
display: block;
margin-left: 37px;
float: left;
content: 'recommendations';
font-variant: small-caps;
font-size: 14pt;
line-height: 64px;
color: var(--recommendbar-text-color);
}
#recommendation .bar .arrow {
float: left;
margin: 14px 0px 12px 10px;
height: 38px;
width: 38px;
}
#recommendation .bar .arrow svg {
fill: var(--recommendbar-text-color);
width: 38px;
height: 38px;
}
#recommendation:not(.open) .bar .arrow svg.arrow-down { display: none; }
#recommendation.open .bar .arrow svg.arrow-up { display: none; }
/* Graph layout */
#graph .sub-graph {
position: relative;
}
#graph .sub-graph .header {
/* margin-left: is the `graph g[margin-left] - .domain[stroke-width]` */
margin: 0 20px 0 48px;
height: 18px;
color: var(--graph-text-color);
font-size: 12pt;
overflow: hidden;
}
#graph .sub-graph .header .title {
float: left;
height: 18px;
margin-right: 20px;
}
#graph .sub-graph .header .title svg.alert {
float: right;
margin-left: 10px;
height: 18px;
width: 18px;
visibility: hidden;
cursor: pointer;
fill: var(--graph-alert-color)
}
#graph .sub-graph .header .title .alert.visible {
visibility: visible;
}
#graph .sub-graph .header .title .name::after {
content: ' ';
}
#graph .sub-graph .header .legend {
float: left;
height: 18px;
overflow: hidden;
}
#graph .sub-graph .header .legend .legend-item {
float: left;
height: 18px;
margin-left: 20px;
overflow: hidden;
}
#graph .sub-graph .header .legend .legend-item svg {
float: left;
margin-right: 6px;
}
#graph .sub-graph .header .legend .legend-item svg line {
stroke-width: 2px;
stroke: var(--graph-good-line-color);
}
#graph .sub-graph .header .legend .legend-item.bad svg line {
stroke: var(--graph-bad-line-color);
}
#graph .sub-graph .header .legend .legend-item span {
float: left;
font-size: 10pt;
line-height: 18px;
}
#graph .sub-graph .header .legend .legend-item .short-legend {
display: none;
}
@media (max-width: 670px) {
#graph .sub-graph .header .legend .legend-item .long-legend {
display: none;
}
#graph .sub-graph .header .legend .legend-item .short-legend {
display: unset;
}
}
#graph .sub-graph .hover-area {
position: absolute;
z-index: 1;
}
#graph .sub-graph .hover {
position: absolute;
display: none;
}
#graph .sub-graph .hover.visible {
display: block;
}
#graph .sub-graph .hover .background, #graph .sub-graph .hover .pointer {
fill: var(--hover-bg-color);
}
#graph .sub-graph .hover .line {
fill: var(--hover-line-color);
}
#graph .sub-graph .hover text {
alignment-baseline: central;
fill: var(--hover-text-color);
font-size: 10pt;
}
#graph .sub-graph .hover .title {
font-weight: bold;
text-anchor: middle;
}
#graph .sub-graph .hover .legend {
font-weight: bold;
}
#graph .sub-graph .hover.above-curve .pointer.below-curve, #graph .sub-graph .hover.below-curve .pointer.above-curve {
display: none;
}
#graph .sub-graph svg.chart {
width: 100%;
height: 180px;
}
#graph .sub-graph .chart .line {
fill: none;
stroke: var(--graph-good-line-color);
stroke-width: 2px;
}
#graph .sub-graph .chart .line.bad {
stroke: var(--graph-bad-line-color);
}
#graph .sub-graph .chart .tick line {
stroke: var(--graph-tick-color);
shape-rendering: crispEdges;
}
#graph .sub-graph .chart .tick text {
fill: var(--graph-text-color);
font-size: 10pt;
}
#graph .sub-graph .chart .domain {
stroke: var(--graph-axis-color);
stroke-width: 2px;
shape-rendering: crispEdges;
}
#graph .sub-graph .chart .background {
fill: var(--graph-bg-color);
}
#graph .sub-graph .chart .interval {
fill: var(--graph-interval-color);
display: none;
}
html.recommendation-open #graph .sub-graph .chart .interval {
display: block;
}
</style>
<div id="banner">
<svg stroke="none" fill="#000" width="155" height="40" viewBox="0 0 115 40" xmlns="http://www.w3.org/2000/svg">
<path d="m4.79 6.8l11.6-6.71c.31-.18.693-.18 1 0l10.8 6.24c.0473.959.0926 1.89.134 2.74.0445.938.0853 1.8.119 2.52.0324.681.0582 1.24.0764 1.63-.0138.00266-.0273.00544-.0407.00834-.0168.00334-.365.245-.333.44.075.465.061 1.15.061 1.15-.416.104-1.16.593-1.75 1.18-.972.967-.00702 5.16.365 6.11.013.0331.0958.0294.206.00765l1.76 5.75c-.341.661-.633.838-.798.881l-.00309-.0159s.0375-.125-.314-.114c-.352.01-1.53.0245-1.26.84.268.652 1.6.262 1.6.262s.143-.0658.129-.168l-.00382-.0197c.508-.115.899-.605 1.1-.92.302.262.747.645.982.833.092.178.335.337.877.39.473.0461 1.12-.0902.889-.774-.184-.553-1.13-.411-1.51-.308-.0408-.0178-.532-.242-.929-.902l2.05-6.48c.0529.0155.0859.0253.0859.0253.495-2.05.633-3.09.59-3.94-.0335-.668-.265-1.2-.59-1.64-.491-.673-2.06-1.05-2.06-1.05l-.115-1.17c-.01-.114-.303-.341-.37-.361-.0256-.00763-.0513-.0142-.077-.0197.00166-.0195.00207-.04.00109-.0615-.0188-.404-.0406-.964-.0659-1.64-.0338-.911-.073-2.03-.116-3.25-.0182-.516-.0364-1.04-.0546-1.57l4.47 2.59c.309.179.499.509.499.865v18.4c0 .357-.19.686-.499.865l-16.4 9.49-16.4-9.49c-.309-.179-.499-.509-.499-.865l-1.02e-14-18.4h4.44e-16c0-.357.19-.686.499-.865l3.54-2.05c.101 2.43.599 9.75.851 13.4-.761.12-1.46.461-2.02.977-.868.799-1.34 1.95-1.25 3.16.151 2.16 2.01 3.78 4.15 3.63 1.78-.124 3.23-1.44 3.55-3.19.0588-.323.0774-.654.0542-.986-.139-1.99-1.74-3.54-3.7-3.64-.257-3.76-.776-11.4-.887-13.8zm.144 14.5c.0234.34.0436.632.0596.866-1.11.217-1.94 1.18-1.94 2.34 0 1.32 1.08 2.39 2.41 2.39 1.33 0 2.41-1.07 2.41-2.39 0-1.21-.912-2.21-2.09-2.37-.016-.234-.0363-.532-.0602-.882 1.62.108 2.93 1.39 3.04 3.02.0192.274.00384.547-.0446.814-.266 1.45-1.49 2.56-2.99 2.66-1.81.126-3.37-1.23-3.49-3.02-.0697-.997.32-1.95 1.05-2.62.456-.42 1.02-.704 1.66-.817zm22.6.648c.0741-.0255.122-.0433.122-.0433s-.0577-.231-.143-.59c-.237-1-.731-2.19-.684-3.73s1.54-1.93 2.2-1.95c.951-.0279 2.64.597 2.3 2.59-.146.868-.33 1.85-.55 2.94.00624-.003.0376.00232.0848.013-.216.696-1.32 4.27-1.76 5.69-.385-1.19-1.25-3.87-1.57-4.92zm-15.7-14.9c-2.66 0-4.82 2.14-4.82 4.77 0 2.64 2.16 4.78 4.82 4.78 2.66 0 4.82-2.14 4.82-4.78 0-2.64-2.16-4.77-4.82-4.77zm9.87 0c-2.66 0-4.82 2.14-4.82 4.78 0 2.64 2.16 4.78 4.82 4.78s4.82-2.14 4.82-4.78c0-2.64-2.16-4.78-4.82-4.78zm-10.5 14.3c.0075.00227 2.37.843 6.26.863 3.89.0199 5.66-.676 6.35-.944.314-.122.146-.55-.246-.378-.605.265-2.64.827-6.1.827-3.46 0-6.12-.825-6.13-.827-.477-.206-.695.287-.128.459zm10.3 1.28c-.00584.00509-.57.523-1.33.753-.653.198-5.63.0847-6.3-.126-.484-.152-.752-.324-1.15-.827-.229-.288-.431-.072-.252.192.378.557.765.984 1.31 1.15.726.229 5.63.327 6.47.133.315-.0731 1.45-1.03 1.48-1.06.155-.155 0-.418-.229-.218zm-10.4-2.65c-.0265.004-.283.108-.361.162-.505.356-.522.968.156 1.96.132.194.393 0 .26-.181-.335-.458-.472-.826-.464-1.1.0141-.486.462-.537.473-.539.315-.0492.198-.347-.0651-.307zm12.4.405c.00349.00121.657.0956.573.737-.0406.312-.407.722-.409.723-.238.158.0538.404.21.236.0114-.0123.402-.48.496-.845.107-.421-.0218-.686-.367-.932-.0849-.0605-.363-.204-.389-.211-.231-.0653-.348.211-.114.293zm-11.7-4.18c-2.44 0-4.42-1.96-4.42-4.38 0-2.42 1.98-4.38 4.42-4.38 2.44 0 4.42 1.96 4.42 4.38 0 2.42-1.98 4.38-4.42 4.38zm-1.36-4.27c.872 0 1.58-.688 1.58-1.54 0-.849-.707-1.54-1.58-1.54-.872 0-1.58.688-1.58 1.54 0 .849.707 1.54 1.58 1.54zm11.2 4.27c-2.44 0-4.42-1.96-4.42-4.38 0-2.42 1.98-4.38 4.42-4.38 2.44 0 4.42 1.96 4.42 4.38 0 2.42-1.98 4.38-4.42 4.38zm-1.4-4.11c.872 0 1.58-.688 1.58-1.54 0-.849-.707-1.54-1.58-1.54-.872 0-1.58.688-1.58 1.54 0 .849.707 1.54 1.58 1.54z"/>
<path d="m48.1 24.7v-11.7h2.46c1.18 0 2.11.117 2.8.35.735.228 1.4.616 2 1.16 1.21 1.11 1.82 2.56 1.82 4.36 0 1.81-.631 3.27-1.89 4.38-.634.558-1.3.946-1.99 1.16-.649.218-1.57.327-2.76.327h-2.43zm1.77-1.67h.799c.796 0 1.46-.0837 1.99-.251.527-.178 1-.459 1.43-.844.872-.796 1.31-1.83 1.31-3.11 0-1.29-.431-2.33-1.29-3.13-.776-.715-1.92-1.07-3.43-1.07h-.799v8.41zm9.24-4.26c0-1.65.606-3.07 1.82-4.26 1.21-1.19 2.66-1.78 4.35-1.78 1.67 0 3.11.598 4.31 1.8 1.2 1.2 1.8 2.63 1.8 4.31 0 1.69-.604 3.12-1.81 4.3-1.21 1.18-2.68 1.77-4.39 1.77-1.52 0-2.88-.525-4.09-1.57-1.33-1.16-1.99-2.68-1.99-4.56zm1.79.0228c0 1.3.436 2.37 1.31 3.2.867.837 1.87 1.26 3.01 1.26 1.23 0 2.27-.426 3.12-1.28.847-.862 1.27-1.91 1.27-3.15 0-1.25-.418-2.3-1.26-3.15-.832-.852-1.86-1.28-3.09-1.28-1.22 0-2.25.426-3.1 1.28-.842.842-1.26 1.88-1.26 3.12zm21.7-5.21v2.1c-1.02-.857-2.08-1.29-3.18-1.29-1.21 0-2.22.434-3.05 1.3-.832.862-1.25 1.92-1.25 3.16 0 1.23.416 2.27 1.25 3.12.832.847 1.85 1.27 3.06 1.27.624 0 1.15-.101 1.59-.304.243-.101.496-.238.757-.411.261-.172.536-.38.825-.624v2.14c-1.01.573-2.08.86-3.2.86-1.68 0-3.11-.586-4.3-1.76-1.18-1.18-1.77-2.61-1.77-4.28 0-1.5.494-2.83 1.48-4 1.22-1.44 2.79-2.15 4.72-2.15 1.05 0 2.07.287 3.06.86zm5.76 1.03v10.1h-1.77v-10.1h-2.7v-1.67h7.17v1.67h-2.69zm3.6 4.15c0-1.65.606-3.07 1.82-4.26 1.21-1.19 2.66-1.78 4.35-1.78 1.67 0 3.11.598 4.31 1.8 1.2 1.2 1.8 2.63 1.8 4.31 0 1.69-.604 3.12-1.81 4.3-1.21 1.18-2.68 1.77-4.39 1.77-1.52 0-2.88-.525-4.09-1.57-1.33-1.16-1.99-2.68-1.99-4.56zm1.79.0228c0 1.3.436 2.37 1.31 3.2.867.837 1.87 1.26 3.01 1.26 1.23 0 2.27-.426 3.12-1.28.847-.862 1.27-1.91 1.27-3.15 0-1.25-.418-2.3-1.26-3.15-.832-.852-1.86-1.28-3.09-1.28-1.22 0-2.25.426-3.1 1.28-.842.842-1.26 1.88-1.26 3.12zm17 .898l3.64 5.01h-2.17l-3.35-4.81h-.32v4.81h-1.77v-11.7h2.08c1.55 0 2.67.292 3.36.875.761.649 1.14 1.51 1.14 2.57 0 .832-.238 1.55-.715 2.15-.477.598-1.11.981-1.89 1.15zm-2.21-1.35h.563c1.68 0 2.52-.642 2.52-1.92 0-1.2-.817-1.8-2.45-1.8h-.631v3.73z"/>
</svg>
</div>
<div id="front-matter">
<div id="alert"></div>
<div id="menu"></div>
</div>
<div id="graph"></div>
<div id="recommendation-space"></div>
<div id="recommendation"></div>
<template class="recommendation-text" data-issue="yes" data-type="summary" data-category="gc" data-menu="Garabage Collection" data-title="Potential Garabage Collection issue detected" data-order="1">
<ul>
<li>The process may have a memory management issue</li>
<li>Run the process with Node's <code>--inspect</code> flag (see <a href="https://nodejs.org/en/docs/inspector">Inspector Docs</a>)</li>
<li>Remotely profile the process with Chrome Devtools <em>Memory</em> tab</li>
</ul>
</template>
<template class="recommendation-text" data-issue="yes" data-type="read-more" data-category="gc" data-menu="Garabage Collection" data-title="Potential Garabage Collection issue detected" data-order="1">
<h2>Understanding the analysis</h2>
<p>JavaScript is Garbage Collected language. Rather than manually freeing objects, they
are simply "cleaned away" at some point after all references to an object have been removed.</p>
<p>At a basic level, the Garbage Collector traverses the JavaScript objects at various intervals to find any
"orphaned" objects (objects which no longer have any references). If there are too many
objects, and/or too many orphaned objects this can cause performance issues – because the Garbage
Collector uses the same thread as the JavaScript event loop. In other words, JavaScript execution
pauses while the Garbage Collector clears away de-referenced objects.</p>
<p>At a more detailed level, GC collection is triggered by memory activity, rather than time and
objects are classified by the GC into young and old. "Young" objects are
traversed (scavenged) more frequently, while "old" objects will stay in memory for longer. So there
are actually two GC types, a frequent scavenge of new space (short lived objects) and a less regular traversal of
old space (objects that survived enough new space scavenges).</p>
<p>Several heuristics may trigger detection of a GC issue, but they all center around high
memory usage.</p>
<p>One possible cause of a detected GC issue is a memory leak, where objects are being accidentally
allocated. However there are other (more common) cases where the is no leak but the memory strategy
needs to be adapted.</p>
<p>One such common case is when large objects (such as may be generated for big JSON payloads), are
created during periods of high activity (e.g. under request load). This can cause the objects
to be moved into old space – if they survive two (by default) GC scavenges – where they will live
for longer due to the less frequent scavenges. Objects can then build up in "old space" and
cause intermittent process stalling during Garbage Collection.</p>
<p>Depending on the use case this may be solved in different ways. For instance if the goal is to write
out serialized objects, then the output could be written to the response as strings (or buffers) directly
instead of creating the intermediate objects (or a combined strategy where part of the object is written out
from available state). It may just be a case that a functional approach (which is usually recommended) is
leading to the repeated creation of very similar objects, in which case the logical flow between functions
in a hot path could be adapted to reuse objects instead of create new objects. </p>
<p>Another possibility is that a very high amount of short lived objects are created, filling up the
"young" space and triggering frequent GC sweeps – if this case <em>isn't</em> an unintended memory leak,
then then an object pooling strategy may be necessary.</p>
<p>To solve Garbage Collection issues we have to analyse the state of our process in order to track down the
root cause behind the high memory consumption.</p>
<h2>Next Steps</h2>
<ul>
<li>If the system is already deployed, mitigate the issue immediately by implementing
HTTP 503 Service Unavailable functionality (see <em>Load Shedding</em> in <strong>Reference</strong>)</li>
<li>Run <code>node --inspect <FILENAME></code></li>
<li>Open Chrome and navigate to <a href="chrome://inspect">chrome://inspect</a></li>
<li>Under the <strong>Remote Target</strong> heading, there should be a target with the official Node.js icon</li>
<li>Click the <code>inspect</code> link for that target – this will connect Chrome Devtools to the Node processes remote debug interface</li>
<li>In Devtools, select the <em>Memory</em> tab</li>
<li>Select the <em>Take heap snapshot</em> radio box, and then click <em>Take snapshot</em></li>
<li>Put the process under load (in the same way that the process was load tested for Node Clinic)</li>
<li>Click <em>Profiles</em> in the left panel, then click <em>Take snapshot</em> again</li>
<li>Under the <em>HEAP SNAPSHOTS</em> left panel, select the second Snapshot (it will be called <em>Snapshot 2</em>)</li>
<li>Locate the dropdown box just above the "Constructor" column (most likely the dropdown box says <em>Summary</em>)</li>
<li>Click the dropdown, and select <em>Comparison</em> – this compares the before and after snapshots of the heap</li>
<li>Click the <em># Delta</em> and/or <em>Size Delta</em> columns to sort by the difference in object counts
or object size, categorized by constructor type</li>
<li>Use the interactive trees in the Constructor column to drill down into the specifics</li>
<li>Use the <em>Retainers</em> panel to understand the chain of object references</li>
<li>This can lead to useful clues about the origins of an object</li>
<li>Retained size (the aggregate total space used due to references <em>from</em> an object) may be important where a reference to a large amount of objects is relevant</li>
<li>Shallow size (the actual space used by the object itself) will be pertinent when there are particularly large objects in play</li>
</ul>
<p><strong>Advanced</strong>: Other Devtools memory profiling functionality, Record allocation profile and Record allocation timeline may also be very helpful</p>
<p><strong>Advanced</strong>: An alternative approach is to use a generate a core dump and use
a core dump analysis tool to list all JS objects in a core dump file (this approach isn't viable on macOS)</p>
<h2>Reference</h2>
<ul>
<li>Load Shedding</li>
<li>Express, Koa, Restify, <code>http</code>: <a href="https://www.npmjs.com/package/overload-protection">overload-protection</a></li>
<li>Hapi: <a href="https://hapijs.com/api#new-serveroptions">Server load sampleInterval option</a> & <a href="https://hapijs.com/api#new-serveroptions">Server connections load maxEventLoopDelay</a></li>
<li>Fastify: <a href="https://www.npmjs.com/package/under-pressure">under-pressure</a></li>
<li>General: <a href="https://www.npmjs.com/package/loopbench">loopbench</a></li>
<li><a href="https://developers.google.com/web/tools/chrome-devtools/memory-problems/">Chrome Devtools Docs: Fix Memory Problems</a></li>
<li><a href="https://developers.google.com/web/tools/chrome-devtools/memory-problems/memory-101">Chrome Devtools Docs: Memory Terminology</a></li>
<li><a href="https://developers.google.com/web/tools/chrome-devtools/memory-problems/heap-snapshots">Chrome Devtools Docs: How to record heap snapshots</a></li>
<li><a href="https://nodejs.org/en/docs/inspector/">Node Docs: Inspector</a></li>
<li><strong>Advanced</strong>: <a href="https://github.com/nodejs/llnode">Core dump analysis tool for Linux: llnode</a></li>
<li><strong>Advanced</strong>: <a href="https://github.com/joyent/mdb_v8">Core dump analysis tool for SmartOS: mdb_v8</a></li>
<li><strong>Advanced</strong>: <a href="https://www.npmjs.com/package/autopsy">Core dump analysis tool for Linux which wraps SmartOS mdb</a></li>
</ul>
</template>
<template class="recommendation-text" data-issue="yes" data-type="summary" data-category="event-loop" data-menu="Event Loop" data-title="Potential Event Loop issue detected" data-order="2">
<ul>
<li>There may be one or more long running synchronous operations blocking the thread</li>
<li>Mitigate: Implement HTTP 503 event-loop protection</li>
<li>Diagnose: Use <a href="https://www.npmjs.com/package/0x">0x</a> to discover CPU intensive function calls</li>
</ul>
</template>
<template class="recommendation-text" data-issue="yes" data-type="read-more" data-category="event-loop" data-menu="Event Loop" data-title="Potential Event Loop issue detected" data-order="2">
<h2>Understanding the analysis</h2>
<p>JavaScript is a single-threaded event-driven non-blocking language.</p>
<p>In Node.js I/O tasks are delegated to the Operating System, JavaScript functions (callbacks)
are invoked once a related I/O operation is complete. At a rudimentary level, the process of
queueing events and later handling results in-thread is conceptually achieved with the
"Event Loop" abstraction.</p>
<p>At a (very) basic level the following pseudo-code demonstrates the Event Loop:
<code>while (event) handle(event)</code></p>
<p>The Event Loop paradigm leads to an ergonomic development experience for high concurrency programming
(relative to the multi-threaded paradigm).</p>
<p>However, since the Event Loop operates on a single thread this is essentially a shared
execution environment for every potentially concurrent action. This means that if the
execution time of any line of code exceeds an acceptable threshold it interferes with
processing of future events (for instance, an incoming HTTP request); new events cannot
be processed because the same thread that would be processing the event is currently
blocked by a long-running synchronous operation.</p>
<p>Asynchronous operations are those which queue an event for later handling, they tend to be
identified by an API that requires a callback, or uses promises (or async/await).</p>
<p>Whereas synchronous operations simply return a value. Long running synchronous operations are either
functions that perform blocking I/O (such as <code>fs.readFileSync</code>) or potentially resource intensive
algorithms (such as <code>JSON.stringify</code> or <code>react.renderToString</code>).</p>
<p>To solve the Event Loop issue, we need to find out where the synchronous bottleneck is.
This may (commonly) be identified as a single long-running synchronous function, or
the bottleneck may be distributed which would take rather more detective work.</p>
<h2>Next Steps</h2>
<ul>
<li>If the system is already deployed, mitigate the issue immediately by implementing
HTTP 503 Service Unavailable functionality (see <em>Load Shedding</em> in <strong>Reference</strong>)</li>
<li>This should allow the deployments Load Balance to route traffic to a different service instance</li>
<li>In the worse case the user receives the 503 in which case they must retry (this is still preferable to waiting for a timeout)</li>
<li>Use the <a href="https://www.npmjs.com/package/0x">0x</a> tool to generate a flamegraph (see <a href="#reference">Reference</a>).</li>
<li>Look for "hot" blocks, these are functions that are observed (at a higher relative frequency) to be at the top the stack per CPU sample – in other words, such functions are blocking the event loop</li>
<li>(In the case of a distributed bottleneck, start by looking for lots of wide tips at the top of the Flamegraph)</li>
</ul>
<h2>Reference</h2>
<ul>
<li>Load Shedding</li>
<li>Express, Koa, Restify, <code>http</code>: <a href="https://www.npmjs.com/package/overload-protection">overload-protection</a></li>
<li>Hapi: <a href="https://hapijs.com/api#new-serveroptions">Server load sampleInterval option</a> & <a href="https://hapijs.com/api#new-serveroptions">Server connections load maxEventLoopDelay</a></li>
<li>Fastify: <a href="https://www.npmjs.com/package/under-pressure">under-pressure</a></li>
<li>General: <a href="https://www.npmjs.com/package/loopbench">loopbench</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop">Concurrency model and Event Loop
</a></li>
<li><a href="https://nodejs.org/en/docs/guides/blocking-vs-non-blocking/">Overview of Blocking vs Non-Blocking</a></li>
<li>Understanding Flamegraphs and how to use 0x: <a href="https://www.nearform.com/blog/tuning-node-js-app-performance-with-autocannon-and-0x/">Tuning Node.js app performance with autocannon and 0x</a></li>
</ul>
</template>
<template class="recommendation-text" data-issue="yes" data-type="summary" data-category="io" data-menu="I/O" data-title="Potential I/O issue detected" data-order="3">
<ul>
<li>There may be long-running asynchronous activities</li>
<li>This can mean that the bottleneck is not the Node process at all, but rather an I/O operation</li>
<li>The simplest current approach to solving this problem is by reasoning about external infrastructure</li>
</ul>
</template>
<template class="recommendation-text" data-issue="yes" data-type="read-more" data-category="io" data-menu="I/O" data-title="Potential I/O issue detected" data-order="3">
<h2>Understanding the analysis</h2>
<p>Node.js provides a platform for non-blocking I/O.
Unlike languages that typically block for IO (e.g. Java, PHP), Node.js passes I/O operations
to an accompanying C++ library (libuv) which delegates these operations to the Operating System.</p>
<p>Once an operation is complete, the notification bubbles up from the OS, through libuv, which can then
trigger any registered JavaScript functions (callbacks) for that operation. This is the typical
flow for any asynchronous I/O (where as <em>Sync API</em>'s will block, but should never be used in a
server/service request handling context).</p>
<p>The profiled process has been observed is unusually idle under load, typically this means
it's waiting for external I/O because there's nothing else to do until the I/O completes.</p>
<p>To solve I/O issues we have to track down the asynchronous call(s) which are taking an
abnormally long time to complete.</p>
<p>I/O root cause analysis is mostly a reasoning exercises, or requires advanced knowledge and
expertise with specialist Node.js logging flags and (very new) asynchronous tracking API's.</p>
<p>At nearForm we care a lot about this problem and we are developing a new tool to make
I/O debugging easier… stay tuned!</p>
<h2>Next Steps</h2>
<ul>
<li>Use (or create) an external architecture diagram (logical, hardware, whatever is available) to
understand all I/O "touch points", that is all I/O to/from the Node.js process (e.g. databases, network requests, filesystem…)</li>
<li>Measure the response times of each of the I/O touch points</li>
<li>One approach is to instrument the Node.js process with <code>console.time</code> before an asynchronous call
and <code>console.timeEnd</code> at the top of the callback (or promise <code>then</code> handler, or after an <code>await</code> or whatever the asynchronous abstraction)</li>
<li>Another approach is write benchmarks specifically for the I/O touch points<ul>
<li>Be sure to duplicate the exact conditions as generated in the Node.js process</li></ul></li>
<li>Run these measurements multiple times, look for unreasonably high response times</li>
<li>Once slow I/O touch points have been discovered a strategy for speeding up the I/O is required </li>
</ul>
<p><strong>Advanced</strong>: For more advanced, lower overhead, timing functionality, check out the experimental <code>perf_hooks</code> API </p>
<p><strong>Advanced:</strong> An alternative to the approach outlined above is to make use of the experimental
Node.js <code>async_hooks</code> API, in combination with a timer and stack trace generation.</p>
<h2>Reference</h2>
<ul>
<li><a href="https://nodejs.org/en/docs/guides/blocking-vs-non-blocking/">Overview of blocking vs non-blocking</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Console/time"><code>console.time</code></a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Console/timeEnd"><code>console.timeEnd</code></a></li>
<li><strong>Advanced</strong>: <a href="https://nodejs.org/api/perf_hooks.html">Node Docs: Perf Hooks</a></li>
<li><strong>Advanced</strong>: <a href="https://nodejs.org/dist/latest-v8.x/docs/api/async_hooks.html">Node Docs: Async Hooks</a></li>
<li><strong>Advanced</strong>: <a href="https://github.com/v8/v8/wiki/Stack-Trace-API">V8 Stack Trace API</a></li>
</ul>
</template>
<template class="recommendation-text" data-issue="yes" data-type="summary" data-category="unknown" data-menu="Unknown issue" data-title="Unknown issue detected" data-order="4">
<ul>
<li>We could not provide a recommendation for this issue.</li>
<li>Something else might be running in the system causing interference.</li>
</ul>
</template>
<template class="recommendation-text" data-issue="no" data-type="summary" data-category="none" data-menu="No issue" data-title="No issue detected" data-order="5">
<ul>
<li>Everything looks good!</li>
</ul>
</template>
<script>require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict'
const d3 = require('./d3.js')
const icons = require('./icons.js')
const categories = require('./categories.js')