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 2 commits
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
81 changes: 81 additions & 0 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
@@ -0,0 +1,81 @@
<script type="module">
// Get data
const rawData = [
{% for sample in measurement.samples %}
[{{ 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;
}

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('dateOrCommit');

// 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('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: "dateOrCommit",
columns: [dataX, dataY],
type: "line",
},
axis: axisFormat,
zoom: {
enabled: true,
},
bindto: {{chart_elem_id}}
});
</script>
10 changes: 4 additions & 6 deletions scripts/lib/build_perf/html/report.html
Copy link

Choose a reason for hiding this comment

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

also not a fix 🐫
Could you merge the style changes into the first commit and have this one only for descriptions?

Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
<head>
{# Scripts, for visualization#}
<!--START-OF-SCRIPTS-->
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
var chartsDrawing = 0;
</script>
<script src="https://cdn.jsdelivr.net/npm/d3@^6.1"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/billboard.css">
<script src="https://cdn.jsdelivr.net/npm/billboard.js"></script>

{# Render measurement result charts #}
{% for test in test_data %}
{% if test.status == 'SUCCESS' %}
{% for measurement in test.measurements %}
{% set chart_elem_id = test.name + '_' + measurement.name + '_chart' %}
{% include 'measurement_chart.html' %}
{% include 'measurement_chart_d3billboard.html' %}
{% endfor %}
{% endif %}
{% endfor %}
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