Skip to content

CPU and Max RSS Analysis tools #2100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions changes.d/2100.feat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adding CPU time and Max RSS to Analysis Tools
126 changes: 81 additions & 45 deletions src/components/cylc/analysis/AnalysisTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

<script>
import { upperFirst } from 'lodash'
import { formatDuration } from '@/utils/tasks'
import {
formatDuration,
formatHeader,
formatChartLabels,
} from '@/utils/tasks'
import {
initialOptions,
updateInitialOptionsEvent,
Expand Down Expand Up @@ -128,50 +132,82 @@ export default {
computed: {
shownHeaders () {
const times = upperFirst(this.timingOption)
const timingHeaders = [
{
title: `Mean T-${times}`,
key: `mean${times}Time`,
formatter: formatDuration,
allowZeros: false
},
{
title: `Std Dev T-${times}`,
key: `stdDev${times}Time`,
formatter: formatDuration,
allowZeros: true
},
{
title: `Min T-${times}`,
key: `min${times}Time`,
formatter: formatDuration,
allowZeros: false
},
{
title: `Q1 T-${times}`,
key: `${times.toLowerCase()}Quartiles.0`,
formatter: formatDuration,
allowZeros: false
},
{
title: `Median T-${times}`,
key: `${times.toLowerCase()}Quartiles.1`,
formatter: formatDuration,
allowZeros: false
},
{
title: `Q3 T-${times}`,
key: `${times.toLowerCase()}Quartiles.2`,
formatter: formatDuration,
allowZeros: false
},
{
title: `Max T-${times}`,
key: `max${times}Time`,
formatter: formatDuration,
allowZeros: false
const timingHeaders = []
// Check if there are any stats to show
let stats = false
for (let i = 0; i < this.tasks.length; i++) {
if (this.tasks[i].count > 1) {
stats = true
break
}
]
}
Comment on lines +137 to +143
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let stats = false
for (let i = 0; i < this.tasks.length; i++) {
if (this.tasks[i].count > 1) {
stats = true
break
}
]
}
const stats = this.tasks.some((task) => task.count > 1)

if (stats) {
timingHeaders.push(
{
title: `Mean ${formatChartLabels(times)}`,
key: `${formatHeader('mean', times)}`,
formatter: formatDuration,
allowZeros: false,
timingOption: this.timingOption
},
{
title: `Min ${formatChartLabels(times)}`,
key: `${formatHeader('min', times)}`,
formatter: formatDuration,
allowZeros: false,
timingOption: this.timingOption
},
{
title: `Q1 ${formatChartLabels(times)}`,
key: `${formatHeader('quartiles', times)}Quartiles.0`,
formatter: formatDuration,
allowZeros: false,
timingOption: this.timingOption
},
{
title: `Median ${formatChartLabels(times)}`,
key: `${formatHeader('quartiles', times)}Quartiles.1`,
formatter: formatDuration,
allowZeros: false,
timingOption: this.timingOption
},
{
title: `Q3 ${formatChartLabels(times)}`,
key: `${formatHeader('quartiles', times)}Quartiles.2`,
formatter: formatDuration,
allowZeros: false,
timingOption: this.timingOption
},
{
title: `Max ${formatChartLabels(times)}`,
key: `${formatHeader('max', times)}`,
formatter: formatDuration,
allowZeros: false,
timingOption: this.timingOption
}
)
} else {
timingHeaders.push(
{
title: `${formatChartLabels(times)}`,
key: `${formatHeader('mean', times)}`,
formatter: formatDuration,
allowZeros: false,
timingOption: this.timingOption
}
)
}

// Don't show std dev for cpuTime or maxRss
if (this.timingOption !== 'cpuTime' && this.timingOption !== 'maxRss' && stats) {
timingHeaders.push({
title: `Std Dev ${times}`,
key: `${formatHeader('stdDev', times)}`,
formatter: formatDuration,
allowZeros: true,
timingOption: this.timingOption
})
}
return this.headers.concat(timingHeaders)
}
},
Expand All @@ -186,7 +222,7 @@ export default {
value = value[index]
}
if (header.formatter) {
return header.formatter(value, header.allowZeros)
return header.formatter(value, header.allowZeros, this.timingOption)
}
return value
}
Expand Down
32 changes: 18 additions & 14 deletions src/components/cylc/analysis/BoxPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@
mdiSortVariant,
} from '@mdi/js'
import { upperFirst } from 'lodash'
import { formatDuration } from '@/utils/tasks'
import {
formatDuration,
getTimingOption,
formatChartLabels
} from '@/utils/tasks'
import { useReducedAnimation } from '@/composables/localStorage'
import {
initialOptions,
Expand Down Expand Up @@ -165,11 +169,11 @@
},
tooltip: {
custom ({ seriesIndex, dataPointIndex, w }) {
const max = formatDuration(w.globals.seriesCandleC[seriesIndex][dataPointIndex], true)
const q3 = formatDuration(w.globals.seriesCandleL[seriesIndex][dataPointIndex], true)
const med = formatDuration(w.globals.seriesCandleM[seriesIndex][dataPointIndex], true)
const q1 = formatDuration(w.globals.seriesCandleH[seriesIndex][dataPointIndex], true)
const min = formatDuration(w.globals.seriesCandleO[seriesIndex][dataPointIndex], true)
const max = formatDuration(w.globals.seriesCandleC[seriesIndex][dataPointIndex], true, props.timingOption)
const q3 = formatDuration(w.globals.seriesCandleL[seriesIndex][dataPointIndex], true, props.timingOption)
const med = formatDuration(w.globals.seriesCandleM[seriesIndex][dataPointIndex], true, props.timingOption)
const q1 = formatDuration(w.globals.seriesCandleH[seriesIndex][dataPointIndex], true, props.timingOption)
const min = formatDuration(w.globals.seriesCandleO[seriesIndex][dataPointIndex], true, props.timingOption)

Check warning on line 176 in src/components/cylc/analysis/BoxPlot.vue

View check run for this annotation

Codecov / codecov/patch

src/components/cylc/analysis/BoxPlot.vue#L172-L176

Added lines #L172 - L176 were not covered by tests
return `
<div class="pa-2">
<div>Maximum: ${max}</div>
Expand All @@ -194,10 +198,10 @@
},
xaxis: {
title: {
text: `${upperFirst(props.timingOption)} time`,
text: `${formatChartLabels(props.timingOption)}`,
},
labels: {
formatter: (value) => formatDuration(value, true)
formatter: (value) => formatDuration(value, true, props.timingOption)
},
},
}))
Expand All @@ -221,11 +225,11 @@
data.push({
x: sortedTasks[i].name,
y: [
sortedTasks[i][`min${upperFirst(this.timingOption)}Time`],
sortedTasks[i][`min${upperFirst(getTimingOption(this.timingOption))}`],
sortedTasks[i][`${this.timingOption}Quartiles`][0],
sortedTasks[i][`${this.timingOption}Quartiles`][1],
sortedTasks[i][`${this.timingOption}Quartiles`][2],
sortedTasks[i][`max${upperFirst(this.timingOption)}Time`],
sortedTasks[i][`max${upperFirst(getTimingOption(this.timingOption))}`],
],
})
}
Expand All @@ -241,10 +245,10 @@
{ title: 'Task name', value: 'name' },
{ title: 'Platform', value: 'platform' },
{ title: 'Count', value: 'count' },
{ title: `Mean ${this.timingOption} time`, value: `mean${upperFirst(this.timingOption)}Time` },
{ title: `Median ${this.timingOption} time`, value: `median${upperFirst(this.timingOption)}Time` },
{ title: `Min ${this.timingOption} time`, value: `min${upperFirst(this.timingOption)}Time` },
{ title: `Max ${this.timingOption} time`, value: `max${upperFirst(this.timingOption)}Time` },
{ title: `Mean ${formatChartLabels(this.timingOption)}`, value: `mean${upperFirst(getTimingOption(this.timingOption))}` },
{ title: `Median ${formatChartLabels(this.timingOption)}`, value: `median${upperFirst(getTimingOption(this.timingOption))}` },
{ title: `Min ${formatChartLabels(this.timingOption)}`, value: `min${upperFirst(getTimingOption(this.timingOption))}` },
{ title: `Max ${formatChartLabels(this.timingOption)}`, value: `max${upperFirst(getTimingOption(this.timingOption))}` },
]
},
},
Expand Down
29 changes: 15 additions & 14 deletions src/components/cylc/analysis/TimeSeries.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@
difference,
pick,
union,
uniq,
upperFirst
uniq
} from 'lodash'
import gql from 'graphql-tag'
import { formatDuration } from '@/utils/tasks'
import {
getTimingOption,
formatDuration,
formatChartLabels
} from '@/utils/tasks'
import {
mdiDownload,
mdiRefresh,
Expand All @@ -119,7 +122,9 @@
'totalTime',
'queueTime',
'runTime',
'startedTime'
'startedTime',
'maxRss',
'cpuTime'
]

/** The one-off query which retrieves historical job timing statistics */
Expand Down Expand Up @@ -284,7 +289,7 @@
const currentStartedTime = seriesData[job.name].data[job.cyclePoint].startedTime
// Only add data if this job was run more recently than any existing data
if (currentStartedTime === undefined || job.startedTime.localeCompare(currentStartedTime) === 1) {
time = job[`${this.timingOption}Time`]
time = job[getTimingOption(this.timingOption)]
Object.assign(seriesData[job.name].data[job.cyclePoint], {
x: job.cyclePoint,
y: time,
Expand Down Expand Up @@ -366,7 +371,7 @@
if (!value) {
return null
}
const y = formatDuration(value, true)
const y = formatDuration(value, true, this.timingOption)

Check warning on line 374 in src/components/cylc/analysis/TimeSeries.vue

View check run for this annotation

Codecov / codecov/patch

src/components/cylc/analysis/TimeSeries.vue#L374

Added line #L374 was not covered by tests
const platform = this.series[seriesIndex].data[dataPointIndex].platform
return `${y} (${platform})`
}
Expand All @@ -384,12 +389,10 @@
forceNiceScale: true,
min: this.showOrigin ? 0 : undefined,
title: {
text: upperFirst(this.timingOption) + ' time',
text: formatChartLabels(this.timingOption),
},
labels: {
formatter: function (value) {
return formatDuration(value, true)
}
formatter: (value) => formatDuration(value, true, this.timingOption)
},
},
}
Expand Down Expand Up @@ -445,12 +448,10 @@
yaxis: {
tickAmount: 3,
title: {
text: upperFirst(this.timingOption) + ' time',
text: formatChartLabels(this.timingOption),
},
labels: {
formatter: function (value) {
return formatDuration(value, true)
}
formatter: (value) => formatDuration(value, true, this.timingOption)
},
min: this.showOrigin ? 0 : undefined
},
Expand Down
Loading