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

Side by Side Diff: bin/live_code_size_analysis.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/library_size_split.dart ('k') | bin/verify_deps.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 /// Command-line tool presenting combined information from dump-info and 5 /// Command-line tool presenting combined information from dump-info and
6 /// coverage data. 6 /// coverage data.
7 /// 7 ///
8 /// This tool requires two input files an `.info.json` and a 8 /// This tool requires two input files an `.info.json` and a
9 /// `.coverage.json` file. To produce these files you need to follow these 9 /// `.coverage.json` file. To produce these files you need to follow these
10 /// steps: 10 /// steps:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 import 'function_size_analysis.dart'; 42 import 'function_size_analysis.dart';
43 43
44 main(args) { 44 main(args) {
45 if (args.length < 2) { 45 if (args.length < 2) {
46 print('usage: dart tool/live_code_size_analysis.dart path-to-info.json ' 46 print('usage: dart tool/live_code_size_analysis.dart path-to-info.json '
47 'path-to-coverage.json [-v]'); 47 'path-to-coverage.json [-v]');
48 exit(1); 48 exit(1);
49 } 49 }
50 50
51 var json = JSON.decode(new File(args[0]).readAsStringSync()); 51 var json = JSON.decode(new File(args[0]).readAsStringSync());
52 var info = new AllInfo.fromJson(json); 52 var info = new AllInfoJsonCodec().decode(json);
53 var coverage = JSON.decode(new File(args[1]).readAsStringSync()); 53 var coverage = JSON.decode(new File(args[1]).readAsStringSync());
54 var verbose = args.length > 2 && args[2] == '-v'; 54 var verbose = args.length > 2 && args[2] == '-v';
55 55
56 int realTotal = info.program.size; 56 int realTotal = info.program.size;
57 int totalLib = info.libraries.fold(0, (n, lib) => n + lib.size); 57 int totalLib = info.libraries.fold(0, (n, lib) => n + lib.size);
58 58
59 int totalCode = 0; 59 int totalCode = 0;
60 int reachableCode = 0; 60 int reachableCode = 0;
61 List<Info> unused = []; 61 List<Info> unused = [];
62 62
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 _showHeader(String msg, String header1, String header2) { 112 _showHeader(String msg, String header1, String header2) {
113 print(' ${pad(msg, 30, right: true)} ${pad(header1, 8)} ${pad(header2, 6)}'); 113 print(' ${pad(msg, 30, right: true)} ${pad(header1, 8)} ${pad(header2, 6)}');
114 } 114 }
115 115
116 _show(String msg, int size, int total) { 116 _show(String msg, int size, int total) {
117 var percent = (size * 100 / total).toStringAsFixed(2); 117 var percent = (size * 100 / total).toStringAsFixed(2);
118 print(' ${pad(msg, 30, right: true)} ${pad(size, 8)} ${pad(percent, 6)}%'); 118 print(' ${pad(msg, 30, right: true)} ${pad(size, 8)} ${pad(percent, 6)}%');
119 } 119 }
OLDNEW
« no previous file with comments | « bin/library_size_split.dart ('k') | bin/verify_deps.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698