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

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 951423002: Add more performance tags. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 15f57590a62aab1de4214dcdd0a2cf7ec19cab75..16970685a1d923135b34e6f28a22ff1a41ec479c 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -572,32 +572,38 @@ class AnalysisServer {
void handleRequest(Request request) {
_performance.logRequest(request);
runZoned(() {
- int count = handlers.length;
- for (int i = 0; i < count; i++) {
- try {
- Response response = handlers[i].handleRequest(request);
- if (response == Response.DELAYED_RESPONSE) {
+ PerformanceTag prevTag =
+ ServerPerformanceStatistics.serverRequests.makeCurrent();
+ try {
+ int count = handlers.length;
+ for (int i = 0; i < count; i++) {
+ try {
+ Response response = handlers[i].handleRequest(request);
+ if (response == Response.DELAYED_RESPONSE) {
+ return;
+ }
+ if (response != null) {
+ channel.sendResponse(response);
+ return;
+ }
+ } on RequestFailure catch (exception) {
+ channel.sendResponse(exception.response);
return;
- }
- if (response != null) {
+ } catch (exception, stackTrace) {
+ RequestError error =
+ new RequestError(RequestErrorCode.SERVER_ERROR, exception.toString());
+ if (stackTrace != null) {
+ error.stackTrace = stackTrace.toString();
+ }
+ Response response = new Response(request.id, error: error);
channel.sendResponse(response);
return;
}
- } on RequestFailure catch (exception) {
- channel.sendResponse(exception.response);
- return;
- } catch (exception, stackTrace) {
- RequestError error =
- new RequestError(RequestErrorCode.SERVER_ERROR, exception.toString());
- if (stackTrace != null) {
- error.stackTrace = stackTrace.toString();
- }
- Response response = new Response(request.id, error: error);
- channel.sendResponse(response);
- return;
}
+ channel.sendResponse(new Response.unknownRequest(request));
+ } finally {
+ prevTag.makeCurrent();
}
- channel.sendResponse(new Response.unknownRequest(request));
}, onError: (exception, stackTrace) {
sendServerErrorNotification(exception, stackTrace, fatal: true);
});
@@ -1359,4 +1365,14 @@ class ServerPerformanceStatistics {
* PerformAnalysisOperation._sendNotices.
*/
static PerformanceTag notices = new PerformanceTag('notices');
+
+ /**
+ * The [PerformanceTag] for time spent in server comminication channels.
+ */
+ static PerformanceTag serverChannel = new PerformanceTag('serverChannel');
+
+ /**
+ * The [PerformanceTag] for time spent in server request handlers.
+ */
+ static PerformanceTag serverRequests = new PerformanceTag('serverRequests');
}

Powered by Google App Engine
This is Rietveld 408576698