@@ -10,10 +10,10 @@ import Tooltip from "../../tooltip.vue";
10
10
import {ArtifactDescription } from " ../../types" ;
11
11
import {daysBetweenDates , getFutureDate , getPastDate } from " ./utils" ;
12
12
import {GraphRenderOpts , renderPlots } from " ../../../../graph/render" ;
13
- import {GRAPH_RESOLVER } from " ../../../../graph/resolver" ;
14
- import {GraphKind } from " ../../../../graph/data" ;
13
+ import {GraphData , GraphKind , GraphsSelector } from " ../../../../graph/data" ;
15
14
import uPlot from " uplot" ;
16
15
import CachegrindCmd from " ../../../../components/cachegrind-cmd.vue" ;
16
+ import {COMPILE_DETAIL_RESOLVER } from " ./detail-resolver" ;
17
17
18
18
const props = defineProps <{
19
19
testCase: CompileTestCase ;
@@ -98,16 +98,6 @@ function drawCurrentDate(opts: GraphRenderOpts, date: Date) {
98
98
99
99
// Render both relative and absolute graphs
100
100
async function renderGraphs() {
101
- // We want to be able to see noise "blips" vs. a previous artifact.
102
- // The "percent relative from previous commit" graph should be the best to
103
- // see these kinds of changes.
104
- renderGraph (" percentrelative" as GraphKind , relativeChartElement );
105
- // We also want to see whether a change maintained its value or whether it was noise and has since
106
- // returned to steady state. Here, an absolute graph ("raw") is best.
107
- renderGraph (" raw" as GraphKind , absoluteChartElement );
108
- }
109
-
110
- async function renderGraph(kind : GraphKind , chartRef : Ref <HTMLElement | null >) {
111
101
const {start, end, date} = graphRange .value ;
112
102
const selector = {
113
103
benchmark: props .testCase .benchmark ,
@@ -116,9 +106,66 @@ async function renderGraph(kind: GraphKind, chartRef: Ref<HTMLElement | null>) {
116
106
stat: props .metric ,
117
107
start ,
118
108
end ,
119
- kind ,
109
+ kinds: [ " percentrelative " , " raw " ] ,
120
110
};
121
- const graphData = await GRAPH_RESOLVER .loadGraph (selector );
111
+ const detail = await COMPILE_DETAIL_RESOLVER .loadDetail (selector );
112
+ if (detail .commits .length === 0 ) {
113
+ return ;
114
+ }
115
+
116
+ function buildGraph(
117
+ index : number ,
118
+ kind : GraphKind
119
+ ): [GraphData , GraphsSelector ] {
120
+ const data = {
121
+ commits: detail .commits ,
122
+ benchmarks: {
123
+ [selector .benchmark ]: {
124
+ [selector .profile ]: {
125
+ [selector .scenario ]: detail .graphs [index ],
126
+ },
127
+ },
128
+ },
129
+ };
130
+ const graphSelector = {
131
+ benchmark: selector .benchmark ,
132
+ profile: selector .profile ,
133
+ scenario: selector .scenario ,
134
+ stat: selector .stat ,
135
+ start: selector .start ,
136
+ end: selector .end ,
137
+ kind ,
138
+ };
139
+
140
+ return [data , graphSelector ];
141
+ }
142
+
143
+ const [percentRelativeData, percentRelativeSelector] = buildGraph (
144
+ 0 ,
145
+ " percentrelative"
146
+ );
147
+ const [rawData, rawSelector] = buildGraph (0 , " raw" );
148
+
149
+ // We want to be able to see noise "blips" vs. a previous artifact.
150
+ // The "percent relative from previous commit" graph should be the best to
151
+ // see these kinds of changes.
152
+ renderGraph (
153
+ percentRelativeData ,
154
+ percentRelativeSelector ,
155
+ date ,
156
+ relativeChartElement
157
+ );
158
+ // We also want to see whether a change maintained its value or whether it was noise and has since
159
+ // returned to steady state. Here, an absolute graph ("raw") is best.
160
+ renderGraph (rawData , rawSelector , date , absoluteChartElement );
161
+ }
162
+
163
+ async function renderGraph(
164
+ graphData : GraphData ,
165
+ selector : GraphsSelector ,
166
+ date : Date | null ,
167
+ chartRef : Ref <HTMLElement | null >
168
+ ) {
122
169
const opts: GraphRenderOpts = {
123
170
width: Math .min (window .innerWidth - 40 , 465 ),
124
171
renderTitle: false ,
0 commit comments