OLD | NEW |
1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 import 'dart:io'; | 5 import 'dart:io'; |
6 | 6 |
7 List<String> trimAll(List<String> list) { | 7 List<String> trimAll(List<String> list) { |
8 return list.map((s) => s.trim()).toList(); | 8 return list.map((s) => s.trim()).toList(); |
9 } | 9 } |
10 | 10 |
11 void main() { | 11 void main() { |
12 // Compute the binary size of Fletch when linked into an LK+Fletch | 12 // Compute the binary size of Dartino when linked into an LK+Dartino |
13 // image. The computation is based on two files containing output | 13 // image. The computation is based on two files containing output |
14 // from the 'size' program on Linux. | 14 // from the 'size' program on Linux. |
15 // | 15 // |
16 // The output from 'size' contains two lines of the form: | 16 // The output from 'size' contains two lines of the form: |
17 // | 17 // |
18 // text data bss dec hex filename | 18 // text data bss dec hex filename |
19 // 25695 537 8240 34472 86a8 out/DebugIA32/fletch | 19 // 25695 537 8240 34472 86a8 out/DebugIA32/dartino |
20 Uri executable = new Uri.file(Platform.resolvedExecutable); | 20 Uri executable = new Uri.file(Platform.resolvedExecutable); |
21 Uri lkBaselineSizeFile = executable.resolve('lk_sizes_baseline.txt'); | 21 Uri lkBaselineSizeFile = executable.resolve('lk_sizes_baseline.txt'); |
22 Uri lkFletchSizeFile = executable.resolve('lk_sizes_fletch.txt'); | 22 Uri lkDartinoSizeFile = executable.resolve('lk_sizes_dartino.txt'); |
23 List<String> baselineLines = | 23 List<String> baselineLines = |
24 new File(lkBaselineSizeFile.toFilePath()).readAsLinesSync(); | 24 new File(lkBaselineSizeFile.toFilePath()).readAsLinesSync(); |
25 List<String> fletchLines = | 25 List<String> dartinoLines = |
26 new File(lkFletchSizeFile.toFilePath()).readAsLinesSync(); | 26 new File(lkDartinoSizeFile.toFilePath()).readAsLinesSync(); |
27 List<String> baselineKeys = trimAll(baselineLines[0].split('\t')); | 27 List<String> baselineKeys = trimAll(baselineLines[0].split('\t')); |
28 List<String> baselineValues = trimAll(baselineLines[1].split('\t')); | 28 List<String> baselineValues = trimAll(baselineLines[1].split('\t')); |
29 List<String> fletchKeys = trimAll(fletchLines[0].split('\t')); | 29 List<String> dartinoKeys = trimAll(dartinoLines[0].split('\t')); |
30 List<String> fletchValues = trimAll(fletchLines[1].split('\t')); | 30 List<String> dartinoValues = trimAll(dartinoLines[1].split('\t')); |
31 List<String> interestingKeys = ['text', 'data', 'bss']; | 31 List<String> interestingKeys = ['text', 'data', 'bss']; |
32 for (int i = 0; i < baselineKeys.length; i++) { | 32 for (int i = 0; i < baselineKeys.length; i++) { |
33 for (var key in interestingKeys) { | 33 for (var key in interestingKeys) { |
34 if (baselineKeys[i] == key) { | 34 if (baselineKeys[i] == key) { |
35 int lkFletchValue = int.parse(fletchValues[i]); | 35 int lkDartinoValue = int.parse(dartinoValues[i]); |
36 int lkBaselineValue = int.parse(baselineValues[i]); | 36 int lkBaselineValue = int.parse(baselineValues[i]); |
37 int fletchSize = lkFletchValue - lkBaselineValue; | 37 int dartinoSize = lkDartinoValue - lkBaselineValue; |
38 print("FletchARMBinarySize_$key(CodeSize): ${fletchSize}"); | 38 print("DartinoARMBinarySize_$key(CodeSize): ${dartinoSize}"); |
39 } | 39 } |
40 } | 40 } |
41 } | 41 } |
42 } | 42 } |
OLD | NEW |