| OLD | NEW |
| 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 import 'dart:io'; | 5 import 'dart:io'; |
| 6 import 'package:path/path.dart'; | 6 import 'package:path/path.dart'; |
| 7 import 'main.dart' as performance; | 7 import 'main.dart' as performance; |
| 8 | 8 |
| 9 // Local driver for performance measurement | 9 // Local driver for performance measurement |
| 10 | 10 |
| 11 main(List<String> args) { | 11 main(List<String> args) { |
| 12 /* | 12 /* |
| 13 * Parse arguments | 13 * Parse arguments |
| 14 */ | 14 */ |
| 15 if (args.length != 3) printHelp('Expected 3 arguments'); | 15 if (args.length < 3) printHelp('Expected 3 arguments'); |
| 16 var gitDir = new Directory(args[0]); | 16 var gitDir = new Directory(args[0]); |
| 17 if (!gitDir.existsSync()) printHelp('${gitDir.path} does not exist'); | 17 if (!gitDir.existsSync()) printHelp('${gitDir.path} does not exist'); |
| 18 if (!new Directory(join(gitDir.path, '.git')).existsSync()) printHelp( | 18 if (!new Directory(join(gitDir.path, '.git')).existsSync()) printHelp( |
| 19 '${gitDir.path} does not appear to be a local git repository'); | 19 '${gitDir.path} does not appear to be a local git repository'); |
| 20 var branch = args[1]; | 20 var branch = args[1]; |
| 21 var inputFile = new File(args[2]); | 21 var inputFile = new File(args[2]); |
| 22 if (!inputFile.existsSync()) printHelp('${inputFile.path} does not exist'); | 22 if (!inputFile.existsSync()) printHelp('${inputFile.path} does not exist'); |
| 23 /* | 23 /* |
| 24 * Create a new temp directory | 24 * Create a new temp directory |
| 25 */ | 25 */ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 51 if (!new Directory(join(gitDir.path, outDirName)).existsSync()) { | 51 if (!new Directory(join(gitDir.path, outDirName)).existsSync()) { |
| 52 throw 'failed to find out or xcodebuild directory'; | 52 throw 'failed to find out or xcodebuild directory'; |
| 53 } | 53 } |
| 54 result = Process.runSync('ln', [ | 54 result = Process.runSync('ln', [ |
| 55 '-s', | 55 '-s', |
| 56 join(gitDir.path, outDirName), | 56 join(gitDir.path, outDirName), |
| 57 join(tmpSrcDirPath, outDirName) | 57 join(tmpSrcDirPath, outDirName) |
| 58 ]); | 58 ]); |
| 59 if (result.exitCode != 0) throw 'failed to link out or xcodebuild: $result'; | 59 if (result.exitCode != 0) throw 'failed to link out or xcodebuild: $result'; |
| 60 /* | 60 /* |
| 61 * Collect arguments |
| 62 */ |
| 63 var perfArgs = ['-i${inputFile.path}', '-t$tmpSrcDirPath',]; |
| 64 for (int index = 3; index < args.length; ++index) { |
| 65 perfArgs.add(args[index].replaceAll('@tmpSrcDir@', tmpSrcDirPath)); |
| 66 } |
| 67 perfArgs.add('-m${gitDir.path},$tmpSrcDirPath'); |
| 68 /* |
| 61 * Launch the performance analysis tool | 69 * Launch the performance analysis tool |
| 62 */ | 70 */ |
| 63 performance.main([ | 71 performance.main(perfArgs); |
| 64 //'-vv', // very verbose | |
| 65 //'-d8081', // analysis server localhost diagnostic port | |
| 66 //'--newTaskModel', | |
| 67 '-i${inputFile.path}', | |
| 68 '-t$tmpSrcDirPath', | |
| 69 '-m${gitDir.path},$tmpSrcDirPath', | |
| 70 ]); | |
| 71 } | 72 } |
| 72 | 73 |
| 73 /// Print help and exit | 74 /// Print help and exit |
| 74 void printHelp([String errMsg]) { | 75 void printHelp([String errMsg]) { |
| 75 if (errMsg != null) { | 76 if (errMsg != null) { |
| 76 print(''); | 77 print(''); |
| 77 print('Error: $errMsg'); | 78 print('Error: $errMsg'); |
| 78 print(''); | 79 print(''); |
| 79 } | 80 } |
| 80 print('Arguments: <gitDir> <branch> <inputFile>'); | 81 print('''Required arguments: <gitDir> <branch> <inputFile> |
| 81 print('gitDir = git repository containing the initial target source'); | 82 gitDir = a path to the git repository containing the initial target source |
| 82 print('branch = the branch containing the initial target source'); | 83 branch = the branch containing the initial target source |
| 83 print('inputFile = the instrumentation or log file'); | 84 inputFile = the instrumentation or log file |
| 85 |
| 86 Optional arguments:'''); |
| 87 print(performance.argParser.usage); |
| 84 exit(1); | 88 exit(1); |
| 85 } | 89 } |
| OLD | NEW |