-
Notifications
You must be signed in to change notification settings - Fork 1
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
Revised website codes to show all middleware results in one graph #20
Merged
CihatAltiparmak
merged 2 commits into
gh-pages
from
fix/revise_website_for_better_visualization
Aug 18, 2024
+272
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes" /> | ||
<style> | ||
html { | ||
font-family: BlinkMacSystemFont,-apple-system,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",Helvetica,Arial,sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
background-color: #fff; | ||
font-size: 16px; | ||
} | ||
body { | ||
color: #4a4a4a; | ||
margin: 8px; | ||
font-size: 1em; | ||
font-weight: 400; | ||
} | ||
header { | ||
margin-bottom: 8px; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
main { | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
a { | ||
color: #3273dc; | ||
cursor: pointer; | ||
text-decoration: none; | ||
} | ||
a:hover { | ||
color: #000; | ||
} | ||
button { | ||
color: #fff; | ||
background-color: #3298dc; | ||
border-color: transparent; | ||
cursor: pointer; | ||
text-align: center; | ||
} | ||
button:hover { | ||
background-color: #2793da; | ||
flex: none; | ||
} | ||
.spacer { | ||
flex: auto; | ||
} | ||
.small { | ||
font-size: 0.75rem; | ||
} | ||
footer { | ||
margin-top: 16px; | ||
display: flex; | ||
align-items: center; | ||
} | ||
.header-label { | ||
margin-right: 4px; | ||
} | ||
.benchmark-set { | ||
margin: 8px 0; | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.benchmark-title { | ||
font-size: 3rem; | ||
font-weight: 600; | ||
word-break: break-word; | ||
text-align: center; | ||
} | ||
.benchmark-graphs { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-around; | ||
align-items: center; | ||
flex-wrap: wrap; | ||
width: 100%; | ||
} | ||
.benchmark-chart { | ||
max-width: 1000px; | ||
} | ||
</style> | ||
<title>Benchmarks</title> | ||
</head> | ||
|
||
<body> | ||
<header id="header"> | ||
<div class="header-item"> | ||
<strong class="header-label">Last Update:</strong> | ||
<span id="last-update"></span> | ||
</div> | ||
<div class="header-item"> | ||
<strong class="header-label">Repository:</strong> | ||
<a id="repository-link" rel="noopener" link="https://github.com/CihatAltiparmak/moveit_middleware_benchmark">moveit_middleware_benchmark</a> | ||
</div> | ||
</header> | ||
<main id="main"></main> | ||
<footer> | ||
<button id="dl-button">Download data as JSON</button> | ||
<div class="spacer"></div> | ||
<div class="small">Powered by <a rel="noopener" href="https://github.com/marketplace/actions/continuous-benchmark">github-action-benchmark</a></div> | ||
</footer> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.2/dist/Chart.min.js"></script> | ||
<script type="module" src="index.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
import * as fastrtps_benchmark_data from './rmw_fastrtps/common.js'; | ||
import * as cyclonedds_benchmark_data from './rmw_cyclonedds/common.js'; | ||
// @TODO CihatAltiparmak when enable, add below line for zenoh bechmark dataset | ||
// import * as zenoh_benchmark_data from './rmw_zenoh/common.js'; | ||
|
||
'use strict'; | ||
|
||
const middlewareColors = { | ||
rmw_zenoh: '#dea584', | ||
rmw_cyclonedds: '#00add8', | ||
rmw_fastrtps: '#f34b7d', | ||
|
||
}; | ||
|
||
function reformat_dataset(middleware_data_list) { | ||
const map = new Map(); | ||
|
||
for (const [middleware_name, middleware] of middleware_data_list) { | ||
for (const scenario of Object.keys(middleware.entries)) { | ||
if (!map.has(scenario)) { | ||
map.set(scenario, new Map()); | ||
} | ||
map.get(scenario).set(middleware_name, new Array()); | ||
} | ||
} | ||
|
||
for (const scenario of map.keys()) { | ||
|
||
for (const middleware_name of map.get(scenario).keys()) { | ||
|
||
for (const commit of middleware_data_list.get(middleware_name).entries[scenario]) { | ||
|
||
map.get(scenario).get(middleware_name).push({ | ||
id: commit.commit.id, | ||
'value': commit.benches[0].value, | ||
'unit': commit.benches[0].unit | ||
}); | ||
} | ||
} | ||
} | ||
|
||
|
||
return map; | ||
} | ||
|
||
function init() { | ||
|
||
const fastrtps_data = fastrtps_benchmark_data.BENCHMARK_DATA; | ||
const cyclonedds_data = cyclonedds_benchmark_data.BENCHMARK_DATA; | ||
// @TODO CihatAltiparmak when enable, add below line for zenoh bechmark dataset | ||
// const data = zenoh_benchmark_data.BENCHMARK_DATA; | ||
|
||
|
||
const middleware_datasets = reformat_dataset( | ||
new Map([ | ||
["rmw_fastrtps", fastrtps_data], | ||
["rmw_cyclonedds", cyclonedds_data] | ||
// ["rmw_zenoh", data]] | ||
])); | ||
|
||
return middleware_datasets; | ||
} | ||
|
||
function renderGraph(parent, name, dataset, label) { | ||
const canvas = document.createElement('canvas'); | ||
canvas.className = 'benchmark-chart'; | ||
parent.appendChild(canvas); | ||
|
||
const data = { | ||
labels: label, | ||
datasets: dataset, | ||
}; | ||
const options = { | ||
scales: { | ||
xAxes: [{ | ||
scaleLabel: { | ||
display: true, | ||
labelString: 'commit', | ||
}, | ||
}], | ||
yAxes: [{ | ||
scaleLabel: { | ||
display: true, | ||
labelString: 'ns/iter', | ||
}, | ||
ticks: { | ||
beginAtZero: true, | ||
} | ||
}], | ||
}, | ||
}; | ||
|
||
new Chart(canvas, { | ||
type: 'line', | ||
data, | ||
options, | ||
}); | ||
} | ||
|
||
|
||
function create_plot_datasets(scenario_dataset) { | ||
|
||
var most_commit_number = 0; | ||
var longest_commit_array = new Array(); | ||
|
||
for (const [middleware_name, commit_array] of scenario_dataset.entries()) { | ||
if (commit_array.length > most_commit_number) { | ||
most_commit_number = commit_array.length; | ||
longest_commit_array = commit_array; | ||
} | ||
} | ||
|
||
const plot_dataset = new Array(); | ||
for (const [middleware_name, commit_array] of scenario_dataset.entries()) { | ||
plot_dataset.push({ | ||
id: commit_array.map(commit => commit.id), | ||
label: middleware_name, | ||
data: commit_array.map(commit => commit.value), | ||
borderColor: middlewareColors[middleware_name], | ||
backgroundColor: middlewareColors[middleware_name] + '60' | ||
}) | ||
} | ||
|
||
return { | ||
"plot_dataset": plot_dataset, | ||
"longest_commit_array": longest_commit_array.map(commit => commit.id.slice(0, 7)) | ||
}; | ||
} | ||
|
||
function renderBenchmark(scenario_name, scenarioDataset, main) { | ||
const setElem = document.createElement('div'); | ||
setElem.className = 'benchmark-set'; | ||
main.appendChild(setElem); | ||
|
||
const nameElem = document.createElement('h1'); | ||
nameElem.className = 'benchmark-title'; | ||
nameElem.textContent = scenario_name; | ||
setElem.appendChild(nameElem); | ||
|
||
const graphsElem = document.createElement('div'); | ||
graphsElem.className = 'benchmark-graphs'; | ||
setElem.appendChild(graphsElem); | ||
|
||
const plot_dataset_info = create_plot_datasets(scenarioDataset); | ||
renderGraph(graphsElem, scenario_name, plot_dataset_info["plot_dataset"], plot_dataset_info["longest_commit_array"]); | ||
} | ||
|
||
function renderAllChars(dataSet) { | ||
|
||
const main = document.getElementById('main'); | ||
for (const scenario_name of dataSet.keys()) { | ||
renderBenchmark(scenario_name, dataSet.get(scenario_name), main); | ||
} | ||
} | ||
|
||
renderAllChars(init()); // Start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import * as my_data from './data.js'; | ||
export var BENCHMARK_DATA = window.BENCHMARK_DATA; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import * as my_data from './data.js'; | ||
export var BENCHMARK_DATA = window.BENCHMARK_DATA; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import * as my_data from './data.js'; | ||
export var BENCHMARK_DATA = window.BENCHMARK_DATA; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit confused where the data is coming from. Aren't these supposed to be just json files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data will come from github-action-benchmark tool which will be triggered by our other CI's. It's absent due to the fact that our other CI's didn't pass updates here. For example: https://github.com/DarkusAlphaHydranoid/moveit_middleware_benchmark_experimental/tree/gh-pages/rmw_fastrtps