async function main(sql_conf){ let db_bytes = base64ToUint8Array(db64) const SQL = await initSqlJs(sql_conf) const db = new SQL.Database(db_bytes) let benches = db.exec("SELECT * FROM bench") window.gb = wrap(db) create_gui() make_selector(gb_conf.bench_name, gb_conf.task_name) } function create_gui() { $("body", $("<#infos", $(`Glassbench ${gb_conf.gb_version}`, { href: "https://github.com/Canop/glassbench", target: "_blank", }), ), $("<#selectors"), $("<#view", $("<.tabs"), $("<.pages"), ) ) function unselect() { $("#view .tabs .tab, #view .pages .page", e => { e.classList.remove("selected") }) } ;["Table", "Graph"].forEach(name => { unselect() let page = $("<.page.selected", { id: name }) let tab = $(" { unselect() tab.classList.add("selected") page.classList.add("selected") } }) $("#view .tabs", tab) $("#view .pages", page) }) $("#Table", $("<.table-wrapper", $("dataset"), $("bench id"), $("commit id"), $("date"), $("task name"), $("mean dur."), $("mean (ns)"), $("tag"), )), $(" ({ bench_id: row[0], commit_id: row[3], date: row[1] * 1000, duration_ns: row[5], tag: row[2], duration_str: fmt_nanos(row[5]) })) } function update_table(view_data) { let tbody = $("#tbody") while (tbody.firstChild) tbody.removeChild(tbody.lastChild) for (let g of view_data) { for (let row of g.rows) { $(tbody, $(`${g.group_id + 1}`), // counting from 1 $("row.date)) max_date = row.date items.push({ x: row.date, y: row.duration_ns, group: g.group_id, label: { content: row.duration_str } }) } } var options = { start: min_date - (max_date-min_date)/10, end: max_date + (max_date-min_date)/10, shaded: true, } window.graph = new vis.Graph2d($("#vis"), items, groups, options) graph.on('click', function (properties) { console.log("click", properties) }) } function make_selector(bench_name, task_name) { let bench_name_select = $(" $(`