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

Unified Diff: pkg/analysis_server/test/performance/operation.dart

Issue 1182933005: analysis server performance measurement - work in progress (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comments Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/test/performance/main.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/performance/operation.dart
diff --git a/pkg/analysis_server/test/performance/operation.dart b/pkg/analysis_server/test/performance/operation.dart
index 0e30aeac6022bb1fffccfbdee8798808179c4335..595225244b636982102ef20653b7c51a78d24838 100644
--- a/pkg/analysis_server/test/performance/operation.dart
+++ b/pkg/analysis_server/test/performance/operation.dart
@@ -1,3 +1,7 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
library server.operation;
import 'dart:async';
@@ -6,18 +10,7 @@ import 'package:analysis_server/src/protocol.dart';
import 'package:logging/logging.dart';
import 'driver.dart';
-
-class InfoOperation extends Operation {
- final String message;
-
- InfoOperation(this.message);
-
- @override
- Future perform(Driver driver) {
- driver.logger.log(Level.INFO, message);
- return null;
- }
-}
+import 'input_converter.dart';
/**
* An [Operation] represents an action such as sending a request to the server.
@@ -30,19 +23,29 @@ abstract class Operation {
* A [RequestOperation] sends a [JSON] request to the server.
*/
class RequestOperation extends Operation {
+ final CommonInputConverter converter;
final Map<String, dynamic> json;
- RequestOperation(this.json);
+ RequestOperation(this.converter, this.json);
@override
Future perform(Driver driver) {
+ Stopwatch stopwatch = new Stopwatch();
String method = json['method'];
driver.logger.log(Level.FINE, 'Sending request: $method\n $json');
+ stopwatch.start();
+ void recordResponse(bool success, response) {
+ stopwatch.stop();
+ Duration elapsed = stopwatch.elapsed;
+ driver.results.record(method, elapsed, success: success);
+ driver.logger.log(
+ Level.FINE, 'Response received: $method : $elapsed\n $response');
+ }
driver.send(method, json['params']).then((response) {
- driver.logger.log(Level.FINE, 'Response received: $method : $response');
+ recordResponse(true, response);
}).catchError((e, s) {
- driver.logger.log(Level.WARNING, 'Request failed: $method\n $e\n$s');
- throw 'Send request failed: $e';
+ recordResponse(false, e);
+ converter.recordErrorResponse(json, e);
});
return null;
}
« no previous file with comments | « pkg/analysis_server/test/performance/main.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698