@@ -5,15 +5,15 @@ import {
5
5
CompileBenchmarkMetadata ,
6
6
CompileTestCase ,
7
7
} from " ../common" ;
8
- import {computed , onMounted , Ref , ref } from " vue" ;
8
+ import {capitalize , computed , onMounted , Ref , ref } from " vue" ;
9
9
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,68 @@ 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 " ] as GraphKind [] ,
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
+ // The server returns profiles capitalized, so we need to match that
125
+ // here, so that the graph code can find the expected profile.
126
+ [capitalize (selector .profile )]: {
127
+ [selector .scenario ]: detail .graphs [index ],
128
+ },
129
+ },
130
+ },
131
+ };
132
+ const graphSelector = {
133
+ benchmark: selector .benchmark ,
134
+ profile: selector .profile ,
135
+ scenario: selector .scenario ,
136
+ stat: selector .stat ,
137
+ start: selector .start ,
138
+ end: selector .end ,
139
+ kind ,
140
+ };
141
+
142
+ return [data , graphSelector ];
143
+ }
144
+
145
+ const [percentRelativeData, percentRelativeSelector] = buildGraph (
146
+ 0 ,
147
+ " percentrelative"
148
+ );
149
+ const [rawData, rawSelector] = buildGraph (1 , " raw" );
150
+
151
+ // We want to be able to see noise "blips" vs. a previous artifact.
152
+ // The "percent relative from previous commit" graph should be the best to
153
+ // see these kinds of changes.
154
+ renderGraph (
155
+ percentRelativeData ,
156
+ percentRelativeSelector ,
157
+ date ,
158
+ relativeChartElement
159
+ );
160
+ // We also want to see whether a change maintained its value or whether it was noise and has since
161
+ // returned to steady state. Here, an absolute graph ("raw") is best.
162
+ renderGraph (rawData , rawSelector , date , absoluteChartElement );
163
+ }
164
+
165
+ async function renderGraph(
166
+ graphData : GraphData ,
167
+ selector : GraphsSelector ,
168
+ date : Date | null ,
169
+ chartRef : Ref <HTMLElement | null >
170
+ ) {
122
171
const opts: GraphRenderOpts = {
123
172
width: Math .min (window .innerWidth - 40 , 465 ),
124
173
renderTitle: false ,
0 commit comments