@@ -51,27 +51,43 @@ function enc_report() {
51
51
enc_aggregate . all . sort ( ) ;
52
52
const len = enc_aggregate . all . length ;
53
53
const half = len >> 1 ;
54
+ const f = ( len + 1 ) >> 2 ;
55
+ const t = ( 3 * ( len + 1 ) ) >> 2 ;
56
+ const alpha1 = ( len + 1 ) / 4 - Math . trunc ( ( len + 1 ) / 4 ) ;
57
+ const alpha3 = ( 3 * ( len + 1 ) / 4 ) - Math . trunc ( 3 * ( len + 1 ) / 4 ) ;
58
+ const fquart = enc_aggregate . all [ f ] + alpha1 * ( enc_aggregate . all [ f + 1 ] - enc_aggregate . all [ f ] ) ;
59
+ const tquart = enc_aggregate . all [ t ] + alpha3 * ( enc_aggregate . all [ t + 1 ] - enc_aggregate . all [ t ] ) ;
54
60
const median = len % 2 === 1 ? enc_aggregate . all [ len >> 1 ] : ( enc_aggregate . all [ half - 1 ] + enc_aggregate . all [ half ] ) / 2 ;
55
61
return {
56
62
count : len ,
57
63
min : enc_aggregate . min ,
58
- max : enc_aggregate . max ,
64
+ fquart : fquart ,
59
65
avg : enc_aggregate . sum / len ,
60
- median,
66
+ median : median ,
67
+ tquart : tquart ,
68
+ max : enc_aggregate . max ,
61
69
} ;
62
70
}
63
71
64
72
function encqueue_report ( ) {
65
73
encqueue_aggregate . all . sort ( ) ;
66
74
const len = encqueue_aggregate . all . length ;
67
75
const half = len >> 1 ;
76
+ const f = ( len + 1 ) >> 2 ;
77
+ const t = ( 3 * ( len + 1 ) ) >> 2 ;
78
+ const alpha1 = ( len + 1 ) / 4 - Math . trunc ( ( len + 1 ) / 4 ) ;
79
+ const alpha3 = ( 3 * ( len + 1 ) / 4 ) - Math . trunc ( 3 * ( len + 1 ) / 4 ) ;
80
+ const fquart = encqueue_aggregate . all [ f ] + alpha1 * ( encqueue_aggregate . all [ f + 1 ] - encqueue_aggregate . all [ f ] ) ;
81
+ const tquart = encqueue_aggregate . all [ t ] + alpha3 * ( encqueue_aggregate . all [ t + 1 ] - encqueue_aggregate . all [ t ] ) ;
68
82
const median = len % 2 === 1 ? encqueue_aggregate . all [ len >> 1 ] : ( encqueue_aggregate . all [ half - 1 ] + encqueue_aggregate . all [ half ] ) / 2 ;
69
83
return {
70
84
count : len ,
71
85
min : encqueue_aggregate . min ,
72
- max : encqueue_aggregate . max ,
86
+ fquart : fquart ,
73
87
avg : encqueue_aggregate . sum / len ,
74
- median,
88
+ median : median ,
89
+ tquart : tquart ,
90
+ max : encqueue_aggregate . max ,
75
91
} ;
76
92
}
77
93
@@ -82,38 +98,54 @@ function dec_update(duration) {
82
98
dec_aggregate . sum += duration ;
83
99
}
84
100
101
+ function decqueue_update ( duration ) {
102
+ decqueue_aggregate . all . push ( duration ) ;
103
+ decqueue_aggregate . min = Math . min ( decqueue_aggregate . min , duration ) ;
104
+ decqueue_aggregate . max = Math . max ( decqueue_aggregate . max , duration ) ;
105
+ decqueue_aggregate . sum += duration ;
106
+ }
107
+
85
108
function dec_report ( ) {
86
109
dec_aggregate . all . sort ( ) ;
87
- const len = dec_aggregate . all . length ;
110
+ const len = dec_aggregate . all . length ;
88
111
const half = len >> 1 ;
112
+ const f = ( len + 1 ) >> 2 ;
113
+ const t = ( 3 * ( len + 1 ) ) >> 2 ;
114
+ const alpha1 = ( len + 1 ) / 4 - Math . trunc ( ( len + 1 ) / 4 ) ;
115
+ const alpha3 = ( 3 * ( len + 1 ) / 4 ) - Math . trunc ( 3 * ( len + 1 ) / 4 ) ;
116
+ const fquart = dec_aggregate . all [ f ] + alpha1 * ( dec_aggregate . all [ f + 1 ] - dec_aggregate . all [ f ] ) ;
117
+ const tquart = dec_aggregate . all [ t ] + alpha3 * ( dec_aggregate . all [ t + 1 ] - dec_aggregate . all [ t ] ) ;
89
118
const median = len % 2 === 1 ? dec_aggregate . all [ len >> 1 ] : ( dec_aggregate . all [ half - 1 ] + dec_aggregate . all [ half ] ) / 2 ;
90
119
return {
91
120
count : len ,
92
121
min : dec_aggregate . min ,
93
- max : dec_aggregate . max ,
122
+ fquart : fquart ,
94
123
avg : dec_aggregate . sum / len ,
95
- median,
124
+ median : median ,
125
+ tquart : tquart ,
126
+ max : dec_aggregate . max ,
96
127
} ;
97
128
}
98
129
99
- function decqueue_update ( duration ) {
100
- decqueue_aggregate . all . push ( duration ) ;
101
- decqueue_aggregate . min = Math . min ( decqueue_aggregate . min , duration ) ;
102
- decqueue_aggregate . max = Math . max ( decqueue_aggregate . max , duration ) ;
103
- decqueue_aggregate . sum += duration ;
104
- }
105
-
106
130
function decqueue_report ( ) {
107
131
decqueue_aggregate . all . sort ( ) ;
108
- const len = decqueue_aggregate . all . length ;
132
+ const len = decqueue_aggregate . all . length ;
109
133
const half = len >> 1 ;
134
+ const f = ( len + 1 ) >> 2 ;
135
+ const t = ( 3 * ( len + 1 ) ) >> 2 ;
136
+ const alpha1 = ( len + 1 ) / 4 - Math . trunc ( ( len + 1 ) / 4 ) ;
137
+ const alpha3 = ( 3 * ( len + 1 ) / 4 ) - Math . trunc ( 3 * ( len + 1 ) / 4 ) ;
138
+ const fquart = decqueue_aggregate . all [ f ] + alpha1 * ( decqueue_aggregate . all [ f + 1 ] - decqueue_aggregate . all [ f ] ) ;
139
+ const tquart = decqueue_aggregate . all [ t ] + alpha3 * ( decqueue_aggregate . all [ t + 1 ] - decqueue_aggregate . all [ t ] ) ;
110
140
const median = len % 2 === 1 ? decqueue_aggregate . all [ len >> 1 ] : ( decqueue_aggregate . all [ half - 1 ] + decqueue_aggregate . all [ half ] ) / 2 ;
111
141
return {
112
142
count : len ,
113
143
min : decqueue_aggregate . min ,
114
- max : decqueue_aggregate . max ,
144
+ fquart : fquart ,
115
145
avg : decqueue_aggregate . sum / len ,
116
- median,
146
+ median : median ,
147
+ tquart : tquart ,
148
+ max : decqueue_aggregate . max ,
117
149
} ;
118
150
}
119
151
0 commit comments