Display test graph
This commit is contained in:
parent
3c9fc1ce75
commit
476fd84d2d
6 changed files with 53 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"db_name": "SQLite",
|
"db_name": "SQLite",
|
||||||
"query": "WITH measurements AS ( SELECT hash, value, MAX(start) FROM runs JOIN run_measurements USING (id) WHERE name = ? GROUP BY hash ) SELECT value FROM commits LEFT JOIN measurements USING (hash) ORDER BY committer_date ASC, hash ASC ",
|
"query": "WITH measurements AS ( SELECT hash, value, MAX(start) FROM runs JOIN run_measurements USING (id) WHERE name = ? GROUP BY hash ) SELECT value FROM commits LEFT JOIN measurements USING (hash) ORDER BY unixepoch(committer_date) ASC, hash ASC ",
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
|
|
@ -16,5 +16,5 @@
|
||||||
true
|
true
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hash": "4e2f2b25a13b3728db01b7c218e7250441098c60725c081215489bd2ad944fe0"
|
"hash": "9f70a2d2932837e4fcd927bcc56d9bd72a8341511486d2c0e6612f4eed2b4b95"
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"db_name": "SQLite",
|
"db_name": "SQLite",
|
||||||
"query": "SELECT hash, committer_date AS \"committer_date: time::OffsetDateTime\" FROM commits ORDER BY committer_date ASC, hash ASC ",
|
"query": "SELECT hash, committer_date AS \"committer_date: time::OffsetDateTime\" FROM commits ORDER BY unixepoch(committer_date) ASC, hash ASC ",
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
|
|
@ -22,5 +22,5 @@
|
||||||
false
|
false
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hash": "039485fead98beb9d088c5bb35679f2ab0409e7e6b51607869ec30ef35240504"
|
"hash": "ac7a2e727b2ff96ae6d6be2c05e9991a7a27708a69fbf89b43231927fc85519f"
|
||||||
}
|
}
|
||||||
|
|
@ -27,7 +27,7 @@ CREATE TABLE refs (
|
||||||
) STRICT;
|
) STRICT;
|
||||||
|
|
||||||
CREATE INDEX idx_commits_committer_date_hash
|
CREATE INDEX idx_commits_committer_date_hash
|
||||||
ON commits (committer_date, hash);
|
ON commits (unixepoch(committer_date), hash);
|
||||||
|
|
||||||
CREATE INDEX idx_commit_links_parent_child
|
CREATE INDEX idx_commit_links_parent_child
|
||||||
ON commit_links (parent, child);
|
ON commit_links (parent, child);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,43 @@
|
||||||
import uPlot from "./uPlot";
|
import uPlot from "./uPlot.js";
|
||||||
|
|
||||||
let plot = new uPlot({
|
interface GraphData {
|
||||||
width: 300,
|
hashes: string[];
|
||||||
height: 200,
|
times: number[];
|
||||||
series: [],
|
metrics: { [key: string]: (number | null)[]; };
|
||||||
|
}
|
||||||
|
|
||||||
|
let opts = {
|
||||||
|
title: "HEHE",
|
||||||
|
width: 600,
|
||||||
|
height: 400,
|
||||||
|
series: [
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
label: "wall-clock/build",
|
||||||
|
spanGaps: true,
|
||||||
|
stroke: "blue",
|
||||||
|
width: 1,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
let plot = new uPlot(opts, [], document.body);
|
||||||
|
|
||||||
|
fetch("data?metric=wall-clock/build")
|
||||||
|
.then(r => r.json() as Promise<GraphData>)
|
||||||
|
.then(data => {
|
||||||
|
console.log(data);
|
||||||
|
plot.setData([
|
||||||
|
data.times,
|
||||||
|
data.metrics["wall-clock/build"]!,
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// function display(metrics: string[]) {
|
||||||
|
// let url = "data" + new URLSearchParams(metrics.map(m => ["metric", m]));
|
||||||
|
// fetch(url)
|
||||||
|
// .then(r => r.json() as Promise<GraphData>)
|
||||||
|
// .then(data => {
|
||||||
|
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use crate::{
|
||||||
server::web::{
|
server::web::{
|
||||||
base::{Base, Link, Tab},
|
base::{Base, Link, Tab},
|
||||||
paths::{PathGraph, PathGraphData},
|
paths::{PathGraph, PathGraphData},
|
||||||
r#static::GRAPH_JS,
|
r#static::{GRAPH_JS, UPLOT_CSS},
|
||||||
},
|
},
|
||||||
somehow,
|
somehow,
|
||||||
};
|
};
|
||||||
|
|
@ -19,6 +19,7 @@ use crate::{
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template(path = "pages/graph.html")]
|
#[template(path = "pages/graph.html")]
|
||||||
struct Page {
|
struct Page {
|
||||||
|
link_uplot_css: Link,
|
||||||
link_graph_js: Link,
|
link_graph_js: Link,
|
||||||
base: Base,
|
base: Base,
|
||||||
}
|
}
|
||||||
|
|
@ -29,6 +30,7 @@ pub async fn get_graph(
|
||||||
) -> somehow::Result<impl IntoResponse> {
|
) -> somehow::Result<impl IntoResponse> {
|
||||||
let base = Base::new(config, Tab::Graph);
|
let base = Base::new(config, Tab::Graph);
|
||||||
Ok(Page {
|
Ok(Page {
|
||||||
|
link_uplot_css: base.link(UPLOT_CSS),
|
||||||
link_graph_js: base.link(GRAPH_JS),
|
link_graph_js: base.link(GRAPH_JS),
|
||||||
base,
|
base,
|
||||||
})
|
})
|
||||||
|
|
@ -60,7 +62,7 @@ pub async fn get_graph_data(
|
||||||
hash, \
|
hash, \
|
||||||
committer_date AS \"committer_date: time::OffsetDateTime\" \
|
committer_date AS \"committer_date: time::OffsetDateTime\" \
|
||||||
FROM commits \
|
FROM commits \
|
||||||
ORDER BY committer_date ASC, hash ASC \
|
ORDER BY unixepoch(committer_date) ASC, hash ASC \
|
||||||
"
|
"
|
||||||
)
|
)
|
||||||
.fetch_all(&mut *conn)
|
.fetch_all(&mut *conn)
|
||||||
|
|
@ -88,7 +90,7 @@ pub async fn get_graph_data(
|
||||||
SELECT value \
|
SELECT value \
|
||||||
FROM commits \
|
FROM commits \
|
||||||
LEFT JOIN measurements USING (hash) \
|
LEFT JOIN measurements USING (hash) \
|
||||||
ORDER BY committer_date ASC, hash ASC \
|
ORDER BY unixepoch(committer_date) ASC, hash ASC \
|
||||||
",
|
",
|
||||||
metric,
|
metric,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
{% block title %}graph{% endblock %}
|
{% block title %}graph{% endblock %}
|
||||||
|
|
||||||
{% block head %}
|
{% block head %}
|
||||||
|
<link rel="stylesheet" href="{{ link_uplot_css }}" />
|
||||||
<script type="module" src="{{ link_graph_js }}"></script>
|
<script type="module" src="{{ link_graph_js }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue