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

Unified Diff: pkg/analyzer/lib/instrumentation/instrumentation.dart

Issue 1079673002: Log details of calls to "pub list" to instrumentation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | « no previous file | pkg/analyzer/lib/source/pub_package_map_provider.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/instrumentation/instrumentation.dart
diff --git a/pkg/analyzer/lib/instrumentation/instrumentation.dart b/pkg/analyzer/lib/instrumentation/instrumentation.dart
index 83b863594997cce5cf1ec2cae1b77f018ae0435d..ccb21491e2e00c674f6f671ff0b03b16a82683a4 100644
--- a/pkg/analyzer/lib/instrumentation/instrumentation.dart
+++ b/pkg/analyzer/lib/instrumentation/instrumentation.dart
@@ -4,6 +4,8 @@
library instrumentation;
+import 'dart:convert';
+
/**
* A container with analysis performance constants.
*/
@@ -62,6 +64,8 @@ class InstrumentationService {
static const String TAG_PERFORMANCE = 'Perf';
static const String TAG_REQUEST = 'Req';
static const String TAG_RESPONSE = 'Res';
+ static const String TAG_SUBPROCESS_START = 'SPStart';
+ static const String TAG_SUBPROCESS_RESULT = 'SPResult';
static const String TAG_VERSION = 'Ver';
static const String TAG_WATCH_EVENT = 'Watch';
@@ -72,6 +76,11 @@ class InstrumentationService {
InstrumentationServer _instrumentationServer;
/**
+ * Counter used to generate unique ID's for [logSubprocessStart].
+ */
+ int _subprocessCounter = 0;
+
+ /**
* Initialize a newly created instrumentation service to comunicate with the
* given [instrumentationServer].
*/
@@ -191,6 +200,43 @@ class InstrumentationService {
}
/**
+ * Log the result of executing a subprocess. [subprocessId] should be the
+ * unique IDreturned by [logSubprocessStart].
+ */
+ void logSubprocessResult(
+ int subprocessId, int exitCode, String stdout, String stderr) {
+ if (_instrumentationServer != null) {
+ _instrumentationServer.log(_join([
+ TAG_SUBPROCESS_RESULT,
+ subprocessId.toString(),
+ exitCode.toString(),
+ JSON.encode(stdout),
+ JSON.encode(stderr)
+ ]));
+ }
+ }
+
+ /**
+ * Log that the given subprocess is about to be executed. Returns a unique
+ * identifier that can be used to identify the subprocess for later log
+ * entries.
+ */
+ int logSubprocessStart(
+ String executablePath, List<String> arguments, String workingDirectory) {
+ int subprocessId = _subprocessCounter++;
+ if (_instrumentationServer != null) {
+ _instrumentationServer.log(_join([
+ TAG_SUBPROCESS_START,
+ subprocessId.toString(),
+ executablePath,
+ workingDirectory,
+ JSON.encode(arguments)
+ ]));
+ }
+ return subprocessId;
+ }
+
+ /**
* Signal that the client has started analysis server.
* This method should be invoked exactly one time.
*/
« no previous file with comments | « no previous file | pkg/analyzer/lib/source/pub_package_map_provider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698