diff --git a/site/frontend/src/pages/compare/compile/table/benchmark-detail.vue b/site/frontend/src/pages/compare/compile/table/benchmark-detail.vue index 8e6286080..d0a2b9dcf 100644 --- a/site/frontend/src/pages/compare/compile/table/benchmark-detail.vue +++ b/site/frontend/src/pages/compare/compile/table/benchmark-detail.vue @@ -13,7 +13,15 @@ import {GraphRenderOpts, renderPlots} from "../../../../graph/render"; import {GraphData, GraphKind, GraphsSelector} from "../../../../graph/data"; import uPlot from "uplot"; import CachegrindCmd from "../../../../components/cachegrind-cmd.vue"; -import {COMPILE_DETAIL_GRAPHS_RESOLVER} from "./detail-resolver"; +import { + COMPILE_DETAIL_GRAPHS_RESOLVER, + COMPILE_DETAIL_SECTIONS_RESOLVER, + CompileDetailGraphs, + CompileDetailGraphsSelector, + CompileDetailSections, + CompileDetailSectionsSelector, +} from "./detail-resolver"; +import CompileSectionsChart from "./sections-chart.vue"; import PerfettoLink from "../../../../components/perfetto-link.vue"; const props = defineProps<{ @@ -97,10 +105,9 @@ function drawCurrentDate(opts: GraphRenderOpts, date: Date) { }; } -// Render both relative and absolute graphs -async function renderGraphs() { - const {start, end, date} = graphRange.value; - const selector = { +function createGraphsSelector(): CompileDetailGraphsSelector { + const {start, end} = graphRange.value; + return { benchmark: props.testCase.benchmark, profile: props.testCase.profile, scenario: props.testCase.scenario, @@ -109,8 +116,31 @@ async function renderGraphs() { end, kinds: ["percentrelative", "raw"] as GraphKind[], }; - const graphsDetail = await COMPILE_DETAIL_GRAPHS_RESOLVER.load(selector); - if (graphsDetail.commits.length === 0) { +} + +async function loadGraphs(): Promise { + return await COMPILE_DETAIL_GRAPHS_RESOLVER.load(createGraphsSelector()); +} + +function createSectionsSelector(): CompileDetailSectionsSelector { + return { + benchmark: props.testCase.benchmark, + profile: props.testCase.profile, + scenario: props.testCase.scenario, + start: props.baseArtifact.commit, + end: props.artifact.commit, + }; +} + +async function loadSections(): Promise { + return await COMPILE_DETAIL_SECTIONS_RESOLVER.load(createSectionsSelector()); +} + +// Render both relative and absolute graphs +async function renderGraphs(detail: CompileDetailGraphs) { + const selector = createGraphsSelector(); + const date = graphRange.value.date; + if (detail.commits.length === 0) { return; } @@ -119,13 +149,13 @@ async function renderGraphs() { kind: GraphKind ): [GraphData, GraphsSelector] { const data = { - commits: graphsDetail.commits, + commits: detail.commits, benchmarks: { [selector.benchmark]: { // The server returns profiles capitalized, so we need to match that // here, so that the graph code can find the expected profile. [capitalize(selector.profile)]: { - [selector.scenario]: graphsDetail.graphs[index], + [selector.scenario]: detail.graphs[index], }, }, }, @@ -264,7 +294,15 @@ function changeProfileCommand(event: Event) { profileCommand.value = target.value as ProfileCommand; } -onMounted(() => renderGraphs()); +const sectionsDetail: Ref = ref(null); +onMounted(() => { + loadGraphs().then((d) => { + renderGraphs(d); + }); + loadSections().then((d) => { + sectionsDetail.value = d; + }); +});