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

Side by Side Diff: pkg/analysis_server/test/performance/log_file_input_converter.dart

Issue 1221893003: performance measurement improvements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years, 5 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
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 library input.transformer.log_file; 5 library input.transformer.log_file;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 8
9 import 'package:analyzer/src/generated/java_engine.dart'; 9 import 'package:analyzer/src/generated/java_engine.dart';
10 import 'package:logging/logging.dart'; 10 import 'package:logging/logging.dart';
11 11
12 import 'input_converter.dart'; 12 import 'input_converter.dart';
13 import 'operation.dart'; 13 import 'operation.dart';
14 14
15 const CONNECTED_MSG_FRAGMENT = ' <= {"event":"server.connected"'; 15 const CONNECTED_MSG_FRAGMENT = ' <= {"event":"server.connected"';
16 final int NINE = '9'.codeUnitAt(0); 16 final int NINE = '9'.codeUnitAt(0);
17 const RECEIVED_FRAGMENT = ' <= {'; 17 const RECEIVED_FRAGMENT = ' <= {';
18 const SENT_FRAGMENT = ' => {'; 18 const SENT_FRAGMENT = ' => {';
19 final int ZERO = '0'.codeUnitAt(0); 19 final int ZERO = '0'.codeUnitAt(0);
20 20
21 /** 21 /**
22 * [LogFileInputConverter] converts a log file stream 22 * [LogFileInputConverter] converts a log file stream
23 * into a series of operations to be sent to the analysis server. 23 * into a series of operations to be sent to the analysis server.
24 */ 24 */
25 class LogFileInputConverter extends CommonInputConverter { 25 class LogFileInputConverter extends CommonInputConverter {
26 LogFileInputConverter(String tmpSrcDirPath, Map<String, String> srcPathMap) 26 LogFileInputConverter(String tmpSrcDirPath, Map<String, String> srcPathMap,
27 : super(tmpSrcDirPath, srcPathMap); 27 {int diagnosticPort})
28 : super(tmpSrcDirPath, srcPathMap, diagnosticPort: diagnosticPort);
28 29
29 @override 30 @override
30 Operation convert(String line) { 31 Operation convert(String line) {
31 try { 32 try {
32 String timeStampString = _parseTimeStamp(line); 33 String timeStampString = _parseTimeStamp(line);
33 String data = line.substring(timeStampString.length); 34 String data = line.substring(timeStampString.length);
34 if (data.startsWith(RECEIVED_FRAGMENT)) { 35 if (data.startsWith(RECEIVED_FRAGMENT)) {
35 Map<String, dynamic> json = JSON.decode(data.substring(4)); 36 Map<String, dynamic> json = JSON.decode(data.substring(4));
36 if (json.containsKey('event')) { 37 if (json.containsKey('event')) {
37 return convertNotification(json); 38 return convertNotification(json);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 while (index < line.length) { 76 while (index < line.length) {
76 int code = line.codeUnitAt(index); 77 int code = line.codeUnitAt(index);
77 if (code < ZERO || NINE < code) { 78 if (code < ZERO || NINE < code) {
78 return line.substring(0, index); 79 return line.substring(0, index);
79 } 80 }
80 ++index; 81 ++index;
81 } 82 }
82 return line; 83 return line;
83 } 84 }
84 } 85 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/performance/local_runner.dart ('k') | pkg/analysis_server/test/performance/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698