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

Side by Side Diff: pkg/analysis_server/benchmark/integration/log_file_input_converter.dart

Issue 1249793007: performance measurement mods: (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, PathMap srcPathMap)
27 {int diagnosticPort}) 27 : super(tmpSrcDirPath, srcPathMap);
28 : super(tmpSrcDirPath, srcPathMap, diagnosticPort: diagnosticPort);
29 28
30 @override 29 @override
31 Operation convert(String line) { 30 Operation convert(String line) {
32 try { 31 try {
33 String timeStampString = _parseTimeStamp(line); 32 String timeStampString = _parseTimeStamp(line);
34 String data = line.substring(timeStampString.length); 33 String data = line.substring(timeStampString.length);
35 if (data.startsWith(RECEIVED_FRAGMENT)) { 34 if (data.startsWith(RECEIVED_FRAGMENT)) {
36 Map<String, dynamic> json = JSON.decode(data.substring(4)); 35 Map<String, dynamic> json = JSON.decode(data.substring(4));
37 if (json.containsKey('event')) { 36 if (json.containsKey('event')) {
38 return convertNotification(json); 37 return convertNotification(json);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 while (index < line.length) { 75 while (index < line.length) {
77 int code = line.codeUnitAt(index); 76 int code = line.codeUnitAt(index);
78 if (code < ZERO || NINE < code) { 77 if (code < ZERO || NINE < code) {
79 return line.substring(0, index); 78 return line.substring(0, index);
80 } 79 }
81 ++index; 80 ++index;
82 } 81 }
83 return line; 82 return line;
84 } 83 }
85 } 84 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/benchmark/integration/local_runner.dart ('k') | pkg/analysis_server/benchmark/integration/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698