Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: bin/inference/print_summary.dart

Issue 1411523003: add a JsonInfoCodec class (Closed) Base URL: git@github.com:dart-lang/dart2js_info.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bin/inference/client.dart ('k') | bin/library_size_split.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Utility to display statistics about "sends" as a table on the command line. 5 /// Utility to display statistics about "sends" as a table on the command line.
6 library compiler.tool.stats.print_summary; 6 library compiler.tool.stats.print_summary;
7 7
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'package:dart2js_info/info.dart'; 10 import 'package:dart2js_info/info.dart';
11 import 'package:dart2js_info/src/table.dart'; 11 import 'package:dart2js_info/src/table.dart';
12 12
13 main(args) { 13 main(args) {
14 var file = args.length > 0 ? args[0] : 'out.js.info.json'; 14 var file = args.length > 0 ? args[0] : 'out.js.info.json';
15 var json = JSON.decode(new File(file).readAsStringSync()); 15 var json = JSON.decode(new File(file).readAsStringSync());
16 var results = new AllInfo.fromJson(json); 16 var results = new AllInfoJsonCodec().decode(json);
17 print(formatAsTable(results)); 17 print(formatAsTable(results));
18 } 18 }
19 19
20 /// Formats [results] as a table. 20 /// Formats [results] as a table.
21 String formatAsTable(AllInfo all) { 21 String formatAsTable(AllInfo all) {
22 var visitor = new _Counter(); 22 var visitor = new _Counter();
23 all.accept(visitor); 23 all.accept(visitor);
24 var table = new Table(); 24 var table = new Table();
25 table.declareColumn('bundle'); 25 table.declareColumn('bundle');
26 26
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 currentBundleTotals.addFrom(measurements); 87 currentBundleTotals.addFrom(measurements);
88 } 88 }
89 } 89 }
90 90
91 const _groupColors = const [_YELLOW_COLOR, _NO_COLOR]; 91 const _groupColors = const [_YELLOW_COLOR, _NO_COLOR];
92 92
93 const _NO_COLOR = "\x1b[0m"; 93 const _NO_COLOR = "\x1b[0m";
94 const _GREEN_COLOR = "\x1b[32m"; 94 const _GREEN_COLOR = "\x1b[32m";
95 const _YELLOW_COLOR = "\x1b[33m"; 95 const _YELLOW_COLOR = "\x1b[33m";
96 const _WHITE_COLOR = "\x1b[37m"; 96 const _WHITE_COLOR = "\x1b[37m";
OLDNEW
« no previous file with comments | « bin/inference/client.dart ('k') | bin/library_size_split.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698