Skip to content

Commit 75b9add

Browse files
Added "Total of Totals" for CPU time.
Fixed bug memory values
1 parent f49aa12 commit 75b9add

File tree

3 files changed

+89
-61
lines changed

3 files changed

+89
-61
lines changed

src/components/cylc/analysis/AnalysisTable.vue

Lines changed: 67 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5858
import { upperFirst } from 'lodash'
5959
import {
6060
formatDuration,
61-
formatHeader
61+
formatHeader,
62+
formatChartLabels,
6263
} from '@/utils/tasks'
6364
import {
6465
initialOptions,
@@ -131,61 +132,74 @@ export default {
131132
computed: {
132133
shownHeaders () {
133134
const times = upperFirst(this.timingOption)
134-
const timingHeaders = [
135-
{
136-
title: `Mean ${times}`,
137-
key: `${formatHeader('mean', times)}`,
138-
formatter: formatDuration,
139-
allowZeros: false,
140-
timingOption: this.timingOption
141-
},
142-
{
143-
title: `Min ${times}`,
144-
key: `${formatHeader('min', times)}`,
145-
formatter: formatDuration,
146-
allowZeros: false,
147-
timingOption: this.timingOption
148-
},
149-
{
150-
title: `Q1 ${times}`,
151-
key: `${formatHeader('quartiles', times)}Quartiles.0`,
152-
formatter: formatDuration,
153-
allowZeros: false,
154-
timingOption: this.timingOption
155-
},
156-
{
157-
title: `Median ${times}`,
158-
key: `${formatHeader('quartiles', times)}Quartiles.1`,
159-
formatter: formatDuration,
160-
allowZeros: false,
161-
timingOption: this.timingOption
162-
},
163-
{
164-
title: `Q3 ${times}`,
165-
key: `${formatHeader('quartiles', times)}Quartiles.2`,
166-
formatter: formatDuration,
167-
allowZeros: false,
168-
timingOption: this.timingOption
169-
},
170-
{
171-
title: `Max ${times}`,
172-
key: `${formatHeader('max', times)}`,
173-
formatter: formatDuration,
174-
allowZeros: false,
175-
timingOption: this.timingOption
135+
const timingHeaders = []
136+
// Check if there are any stats to show
137+
let stats = false
138+
for (let i = 0; i < this.tasks.length; i++) {
139+
if (this.tasks[i].count > 1) {
140+
stats = true
141+
break
176142
}
177-
]
178-
if (this.timingOption === 'cpuTime') {
179-
timingHeaders.push({
180-
title: 'Total CPU Time',
181-
key: 'totalCpuTime',
182-
formatter: formatDuration,
183-
allowZeros: false,
184-
timingOption: this.timingOption
185-
})
186143
}
144+
if (stats) {
145+
timingHeaders.push(
146+
{
147+
title: `Mean ${formatChartLabels(times)}`,
148+
key: `${formatHeader('mean', times)}`,
149+
formatter: formatDuration,
150+
allowZeros: false,
151+
timingOption: this.timingOption
152+
},
153+
{
154+
title: `Min ${formatChartLabels(times)}`,
155+
key: `${formatHeader('min', times)}`,
156+
formatter: formatDuration,
157+
allowZeros: false,
158+
timingOption: this.timingOption
159+
},
160+
{
161+
title: `Q1 ${formatChartLabels(times)}`,
162+
key: `${formatHeader('quartiles', times)}Quartiles.0`,
163+
formatter: formatDuration,
164+
allowZeros: false,
165+
timingOption: this.timingOption
166+
},
167+
{
168+
title: `Median ${formatChartLabels(times)}`,
169+
key: `${formatHeader('quartiles', times)}Quartiles.1`,
170+
formatter: formatDuration,
171+
allowZeros: false,
172+
timingOption: this.timingOption
173+
},
174+
{
175+
title: `Q3 ${formatChartLabels(times)}`,
176+
key: `${formatHeader('quartiles', times)}Quartiles.2`,
177+
formatter: formatDuration,
178+
allowZeros: false,
179+
timingOption: this.timingOption
180+
},
181+
{
182+
title: `Max ${formatChartLabels(times)}`,
183+
key: `${formatHeader('max', times)}`,
184+
formatter: formatDuration,
185+
allowZeros: false,
186+
timingOption: this.timingOption
187+
}
188+
)
189+
} else {
190+
timingHeaders.push(
191+
{
192+
title: `${formatChartLabels(times)}`,
193+
key: `${formatHeader('mean', times)}`,
194+
formatter: formatDuration,
195+
allowZeros: false,
196+
timingOption: this.timingOption
197+
}
198+
)
199+
}
200+
187201
// Don't show std dev for cpuTime or maxRss
188-
if (this.timingOption !== 'cpuTime' && this.timingOption !== 'maxRss') {
202+
if (this.timingOption !== 'cpuTime' && this.timingOption !== 'maxRss' && stats) {
189203
timingHeaders.push({
190204
title: `Std Dev ${times}`,
191205
key: `${formatHeader('stdDev', times)}`,

src/utils/tasks.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ export function formatDuration (value, allowZeros = false, timingOption = false)
123123
}
124124
// If memory value passed
125125
} else if (timingOption === 'maxRss') {
126-
if (value / 1024 < 5000) {
127-
const kilobytes = value / 1024
126+
if (value < 5000) {
127+
const kilobytes = value
128128
return kilobytes.toPrecision(3) + ' KB'
129-
} else if (value / 1048576 < 1000) {
130-
const megabytes = value / 1048576
129+
} else if (value / 1024 < 1000) {
130+
const megabytes = value / 1024
131131
return megabytes.toPrecision(3) + ' MB'
132132
} else {
133-
const gigabytes = value / 1073741824
133+
const gigabytes = value / 1048576
134134
return gigabytes.toPrecision(3) + ' GB'
135135
}
136136
}
@@ -141,9 +141,9 @@ export function formatDuration (value, allowZeros = false, timingOption = false)
141141

142142
export function formatChartLabels (timingOption) {
143143
// Create correct labels for the charts
144-
if (timingOption === 'maxRss') {
144+
if (timingOption === 'maxRss' || timingOption === 'MaxRss') {
145145
return 'Max RSS'
146-
} else if (timingOption === 'cpuTime') {
146+
} else if (timingOption === 'cpuTime' || timingOption === 'CpuTime') {
147147
return 'CPU Time'
148148
} else {
149149
return upperFirst(timingOption) + ' Time'

src/views/Analysis.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

1818
<template>
1919
<div class="c-analysis">
20+
<v-skeleton-loader
21+
v-if="!Object.keys(callback.tasks).length"
22+
type="table"
23+
class="align-content-start"
24+
/>
2025
<v-container
2126
fluid
2227
class="pa-2"
@@ -109,6 +114,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
109114
<v-icon :icon="$options.icons.mdiRefresh" />
110115
<v-tooltip>Refresh data</v-tooltip>
111116
</v-btn>
117+
<v-chip
118+
location="right"
119+
v-if="timingOption === 'cpuTime'"
120+
>
121+
Total CPU Time Of Suite {{ formatDuration(tasks[0].totalOfTotals, false, 'cpuTime') }}
122+
</v-chip>
112123
<!-- Box plot sort input teleports here -->
113124
</v-defaults-provider>
114125
</div>
@@ -144,6 +155,7 @@ import {
144155
pick,
145156
} from 'lodash'
146157
import gql from 'graphql-tag'
158+
import { formatDuration } from '@/utils/tasks'
147159
import graphqlMixin from '@/mixins/graphql'
148160
import {
149161
initialOptions,
@@ -196,6 +208,7 @@ const taskFields = [
196208
'minCpuTime',
197209
'totalCpuTime',
198210
'cpuTimeQuartiles',
211+
'totalOfTotals'
199212
]
200213
201214
/** The one-off query which retrieves historical task timing statistics */
@@ -356,7 +369,8 @@ export default {
356369
this.callback.onAdded(ret.data)
357370
},
358371
200 // only re-run this once every 0.2 seconds
359-
)
372+
),
373+
formatDuration
360374
},
361375
362376
icons: {

0 commit comments

Comments
 (0)