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

Unified Diff: runtime/observatory/lib/tracer.dart

Issue 839543002: Revert "Build Observatory with runtime" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/observatory/maintainers/.gitignore » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/tracer.dart
diff --git a/runtime/observatory/lib/tracer.dart b/runtime/observatory/lib/tracer.dart
deleted file mode 100644
index 1453c3c0028672c9383204aea3c2df490888ce92..0000000000000000000000000000000000000000
--- a/runtime/observatory/lib/tracer.dart
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2013, 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 tracer;
-
-import 'dart:async';
-
-import 'package:logging/logging.dart';
-import 'package:observe/observe.dart';
-
-_deepCopy(src) {
- if (src is Map) {
- var dest = {};
- src.forEach((key, val) {
- dest[key] = _deepCopy(val);
- });
- return dest;
- } else if (src is List) {
- var dest = [];
- src.forEach((val) {
- dest.add(_deepCopy(val));
- });
- return dest;
- } else {
- return src;
- }
-}
-
-class TraceEvent {
- TraceEvent.msg(this._time, this.message, Map originalMap) {
- map = _deepCopy(originalMap);
- }
-
- String get timeStamp => "T+${_time}us";
-
- String toString() {
- return "[${timeStamp}] ${message}";
- }
-
- int _time;
- String message;
- Map map;
-}
-
-class Tracer extends Observable {
- // The current global tracer.
- static Tracer get current => _current;
-
- static Tracer _current;
-
- static void start() {
- if (_current == null) {
- _current = new Tracer();
- }
- }
- static void stop() {
- if (_current != null) {
- _current.cancel();
- _current = null;
- }
- }
-
- // The tracer subscribes to all logging events.
- StreamSubscription loggerSub = null;
-
- // The start time for the current request.
- Stopwatch _time;
-
- // A list of all tracing events for thre current request.
- ObservableList<TraceEvent> events = new ObservableList<TraceEvent>();
-
- Tracer() {
- _time = new Stopwatch();
- _time.start();
- loggerSub = Logger.root.onRecord.listen((LogRecord rec) {
- // Echo all log messages to the trace.
- trace('${rec.level.name}: ${rec.message}');
- });
- reset();
- }
-
- void cancel() {
- loggerSub.cancel();
- }
-
- void reset() {
- _time.reset();
- events.clear();
- }
-
- TraceEvent trace(String message, {Map map: null}) {
- var event = new TraceEvent.msg(_time.elapsedMicroseconds, message, map);
- events.add(event);
- return event;
- }
-}
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/observatory/maintainers/.gitignore » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698