@@ -56,7 +56,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5656
5757<script >
5858import { upperFirst } from ' lodash'
59- import { formatDuration } from ' @/utils/tasks'
59+ import {
60+ formatDuration ,
61+ formatHeader ,
62+ formatChartLabels ,
63+ } from ' @/utils/tasks'
6064import {
6165 initialOptions ,
6266 updateInitialOptionsEvent ,
@@ -128,50 +132,76 @@ export default {
128132 computed: {
129133 shownHeaders () {
130134 const times = upperFirst (this .timingOption )
131- const timingHeaders = [
132- {
133- title: ` Mean T-${ times} ` ,
134- key: ` mean${ times} Time` ,
135- formatter: formatDuration,
136- allowZeros: false
137- },
138- {
139- title: ` Std Dev T-${ times} ` ,
140- key: ` stdDev${ times} Time` ,
141- formatter: formatDuration,
142- allowZeros: true
143- },
144- {
145- title: ` Min T-${ times} ` ,
146- key: ` min${ times} Time` ,
147- formatter: formatDuration,
148- allowZeros: false
149- },
150- {
151- title: ` Q1 T-${ times} ` ,
152- key: ` ${ times .toLowerCase ()} Quartiles.0` ,
153- formatter: formatDuration,
154- allowZeros: false
155- },
156- {
157- title: ` Median T-${ times} ` ,
158- key: ` ${ times .toLowerCase ()} Quartiles.1` ,
159- formatter: formatDuration,
160- allowZeros: false
161- },
162- {
163- title: ` Q3 T-${ times} ` ,
164- key: ` ${ times .toLowerCase ()} Quartiles.2` ,
165- formatter: formatDuration,
166- allowZeros: false
167- },
168- {
169- title: ` Max T-${ times} ` ,
170- key: ` max${ times} Time` ,
135+ const timingHeaders = []
136+ // Check if there are any stats to show
137+ const stats = this .tasks .some ((task ) => task .count > 1 )
138+ if (stats) {
139+ timingHeaders .push (
140+ {
141+ title: ` Mean ${ formatChartLabels (times)} ` ,
142+ key: ` ${ formatHeader (' mean' , times)} ` ,
143+ formatter: formatDuration,
144+ allowZeros: true ,
145+ timingOption: this .timingOption
146+ },
147+ {
148+ title: ` Min ${ formatChartLabels (times)} ` ,
149+ key: ` ${ formatHeader (' min' , times)} ` ,
150+ formatter: formatDuration,
151+ allowZeros: true ,
152+ timingOption: this .timingOption
153+ },
154+ {
155+ title: ` Q1 ${ formatChartLabels (times)} ` ,
156+ key: ` ${ formatHeader (' quartiles' , times)} Quartiles.0` ,
157+ formatter: formatDuration,
158+ allowZeros: true ,
159+ timingOption: this .timingOption
160+ },
161+ {
162+ title: ` Median ${ formatChartLabels (times)} ` ,
163+ key: ` ${ formatHeader (' quartiles' , times)} Quartiles.1` ,
164+ formatter: formatDuration,
165+ allowZeros: true ,
166+ timingOption: this .timingOption
167+ },
168+ {
169+ title: ` Q3 ${ formatChartLabels (times)} ` ,
170+ key: ` ${ formatHeader (' quartiles' , times)} Quartiles.2` ,
171+ formatter: formatDuration,
172+ allowZeros: true ,
173+ timingOption: this .timingOption
174+ },
175+ {
176+ title: ` Max ${ formatChartLabels (times)} ` ,
177+ key: ` ${ formatHeader (' max' , times)} ` ,
178+ formatter: formatDuration,
179+ allowZeros: true ,
180+ timingOption: this .timingOption
181+ }
182+ )
183+ } else {
184+ timingHeaders .push (
185+ {
186+ title: ` ${ formatChartLabels (times)} ` ,
187+ key: ` ${ formatHeader (' mean' , times)} ` ,
188+ formatter: formatDuration,
189+ allowZeros: true ,
190+ timingOption: this .timingOption
191+ }
192+ )
193+ }
194+
195+ // Don't show std dev for cpuTime or maxRss
196+ if (this .timingOption !== ' cpuTime' && this .timingOption !== ' maxRss' && stats) {
197+ timingHeaders .push ({
198+ title: ` Std Dev ${ times} ` ,
199+ key: ` ${ formatHeader (' stdDev' , times)} ` ,
171200 formatter: formatDuration,
172- allowZeros: false
173- }
174- ]
201+ allowZeros: true ,
202+ timingOption: this .timingOption
203+ })
204+ }
175205 return this .headers .concat (timingHeaders)
176206 }
177207 },
@@ -186,7 +216,7 @@ export default {
186216 value = value[index]
187217 }
188218 if (header .formatter ) {
189- return header .formatter (value, header)
219+ return header .formatter (value, header . allowZeros , this . timingOption )
190220 }
191221 return value
192222 }
0 commit comments