Skip to content
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

M9: Build performance test report view #9

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 53 additions & 8 deletions scripts/lib/build_perf/html/measurement_chart_d3billboard.html
Copy link

Choose a reason for hiding this comment

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

This is not a fix :) And can be part of the first commit

Copy link
Member Author

Choose a reason for hiding this comment

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

yea sorry about this 🙈 I need to update all the commit messages to remove 'fix' and combine some of them

Copy link

Choose a reason for hiding this comment

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

What happened here? same commit twice?

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm must have happened when I rebased it.. will clean up ☝️

Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,77 @@
// Get data
const rawData = [
{% for sample in measurement.samples %}
[{{ sample.commit_num }}, {{ sample.mean.gv_value() }}],
[{{ sample.commit_num }}, {{ sample.mean.gv_value() }}, {{ sample.start_time }}],
{% endfor %}
];

const convertToMinute = (time) => {
return time[0]*60 + time[1] + time[2]/60 + time[3]/3600;
}

// Assuming the array quantities are durations in the format [hours, minutes, seconds, milliseconds]
const dataX = rawData.map(([commit, quantity]) => {
const dataX = rawData.map(([commit, value, time]) => {
// Time 0 means no date information is available and commit number is used instead
if (time > 0) {
// The Date object takes value in milliseconds rather than seconds. So to use a Unix timestamp we multiply it by 1000.
const date = new Date(time * 1000)
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() // Adding an extra 1 for month as January starts from 0
}
return commit
});
dataX.unshift('commit');
dataX.unshift('dateOrCommit');

const dataY = rawData.map(([commit, quantity]) => {
return Array.isArray(quantity) ? convertToMinute(quantity) : quantity
// Assuming the array values are durations in the format [hours, minutes, seconds, milliseconds]
const dataY = rawData.map(([commit, value]) => {
return Array.isArray(value) ? convertToMinute(value) : value
});
dataY.unshift('quantity');
dataY.unshift('value');

let axisFormat
// Date is saved as string in the data
Copy link

Choose a reason for hiding this comment

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

Comments are important, but I think some of them can be removed. :)

if (typeof dataX[1] === 'string') {
axisFormat = {
x: {
label: {
text: "Date",
position: "outer-center"
},
type: "timeseries",
tick: {
format: "%Y-%m-%d"
}
},
y: {
label: {
text: "Duration (minutes)",
position: "outer-middle"
}
}
}
} else {
axisFormat = {
x: {
label: {
text: "Commit number",
position: "outer-center"
}
},
y: {
label: {
text: "Disk size (MB)",
position: "outer-middle"
}
}
}
}

// Example: https://naver.github.io/billboard.js/demo/#Chart.SimpleXYLineChart
Copy link

Choose a reason for hiding this comment

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

mhh

Copy link
Member Author

Choose a reason for hiding this comment

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

removed as I added apache echarts

const chart = bb.generate({
data: {
x: "commit",
x: "dateOrCommit",
columns: [dataX, dataY],
type: "line",
},
axis: axisFormat,
zoom: {
enabled: true,
},
Expand Down
6 changes: 5 additions & 1 deletion scripts/lib/build_perf/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,18 @@ def measurement_stats(meas, prefix=''):
prefix + 'min': MeasurementVal('nan'),
prefix + 'max': MeasurementVal('nan'),
prefix + 'minus': MeasurementVal('nan'),
prefix + 'plus': MeasurementVal('nan')}
prefix + 'plus': MeasurementVal('nan'),
prefix + 'start_time': MeasurementVal('nan')}

stats = {'name': meas['name']}
if meas['type'] == 'sysres':
val_cls = TimeVal
values = meas['values']['elapsed_time']
start_time = meas['values']['start_time'][0]
elif meas['type'] == 'diskusage':
val_cls = SizeVal
values = meas['values']['size']
start_time = 0 # No time data is available
else:
raise Exception("Unknown measurement type '{}'".format(meas['type']))
stats['val_cls'] = val_cls
Expand All @@ -334,6 +337,7 @@ def measurement_stats(meas, prefix=''):
stats[prefix + 'max'] = max_val
stats[prefix + 'minus'] = val_cls(mean_val - min_val)
stats[prefix + 'plus'] = val_cls(max_val - mean_val)
stats[prefix + 'start_time'] = start_time

return stats