@@ -96,7 +96,7 @@ class CsvBuilder {
9696
9797 void writeHeaders ({required int averageOf}) {
9898 writeLines ([
99- 'Flutter DevTools performance benchmarks diff: dart2wasm diffed against dart2js .' ,
99+ 'Flutter DevTools performance benchmarks diff: dart2js (baseline) vs dart2wasm (test) .' ,
100100 'Benchmark results were averaged over $averageOf benchmark run(s).' ,
101101 '' ,
102102 'These results were auto-generated by a script:' ,
@@ -105,9 +105,8 @@ class CsvBuilder {
105105 ]);
106106
107107 // Write the Flutter and DevTools commit hash for the benchmark run.
108- // TODO(kenz): automatically detect these and write them to the CSV.
109- const flutter = '<enter manually by running \' flutter --version\' >' ;
110- const devtools = '<enter manually by running \' git log\' >' ;
108+ final flutter = _detectFlutterVersion ();
109+ final devtools = _detectDevToolsCommit ();
111110 writeLines ([
112111 'Version info:' ,
113112 'Flutter: $flutter ' ,
@@ -120,7 +119,8 @@ class CsvBuilder {
120119 writeLine ([
121120 'Benchmark Name' ,
122121 'Metric' ,
123- 'Value (micros)' ,
122+ 'Baseline (micros)' ,
123+ 'Test (micros)' ,
124124 'Delta (micros)' ,
125125 'Delta (%)' ,
126126 ]);
@@ -178,6 +178,49 @@ class CsvBuilder {
178178 '(Google Sheets, Excel, etc.) for viewing.' ,
179179 );
180180 }
181+
182+ String _detectFlutterVersion () {
183+ try {
184+ final result = Process .runSync ('flutter' , [
185+ '--version' ,
186+ '--machine' ,
187+ ], runInShell: true );
188+ if (result.exitCode == 0 ) {
189+ final json =
190+ jsonDecode (result.stdout.toString ()) as Map <String , Object ?>;
191+ final flutterVersion = json['flutterVersion' ];
192+ final frameworkRevision = json['frameworkRevision' ];
193+ if (flutterVersion != null && frameworkRevision != null ) {
194+ return '$flutterVersion (revision $frameworkRevision )' ;
195+ }
196+ return result.stdout.toString ().trim ();
197+ }
198+ } catch (_) {}
199+
200+ try {
201+ final result = Process .runSync ('flutter' , [
202+ '--version' ,
203+ ], runInShell: true );
204+ if (result.exitCode == 0 ) {
205+ return result.stdout.toString ().trim ().split ('\n ' ).first;
206+ }
207+ } catch (_) {}
208+
209+ return '<unknown>' ;
210+ }
211+
212+ String _detectDevToolsCommit () {
213+ try {
214+ final result = Process .runSync ('git' , [
215+ 'rev-parse' ,
216+ 'HEAD' ,
217+ ], runInShell: true );
218+ if (result.exitCode == 0 ) {
219+ return result.stdout.toString ().trim ();
220+ }
221+ } catch (_) {}
222+ return '<unknown>' ;
223+ }
181224}
182225
183226Future <BenchmarkResults > runBenchmarkOrUseExisting (
0 commit comments