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

Unified Diff: runtime/bin/vmstats/vmstats.dart

Issue 12377099: Added support for "bin-ified" vmstats web app source files (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Final code review changes Created 7 years, 9 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/bin/vmstats/vmstats.css ('k') | runtime/bin/vmstats/vmstats.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmstats/vmstats.dart
===================================================================
--- runtime/bin/vmstats/vmstats.dart (revision 0)
+++ runtime/bin/vmstats/vmstats.dart (revision 0)
@@ -0,0 +1,60 @@
+// 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 dart.vmstats;
+
+import 'dart:async';
+import 'dart:html';
+import 'dart:json' as JSON;
+
+part 'bargraph.dart';
+part 'isolate_list.dart';
+part 'models.dart';
+
+BarGraph _graph;
+IsolateList _isolateList;
+DivElement _statusText;
+IsolateListModel _isolates;
+Timer _updater;
+
+final int _POLL_INTERVAL_IN_MS = 1000;
+
+void main() {
+ DivElement dashBoard = query('#dashboard');
+ CanvasElement canvas = query('#graph');
+ var elements = [ new Element("Old Space", "#97FFFF"),
+ new Element("New Space", "#00EE76")];
+ _graph = new BarGraph(canvas, elements);
+ UListElement isolateListElement = query('#isolateList');
+ _isolateList = new IsolateList(isolateListElement);
+ _statusText = query('#statusText');
+
+ _isolates = new IsolateListModel();
+ _isolates.addListener(onUpdateStatus, onRequestFailed);
+ _isolates.update();
+ _updater =
+ new Timer.repeating(_POLL_INTERVAL_IN_MS, (timer) => _isolates.update());
+}
+
+void onUpdateStatus(IsolateListModel model) {
+ int oldSpace = 0;
+ int newSpace = 0;
+ model.forEach((Isolate element) {
+ oldSpace += element.oldSpace.used;
+ newSpace += element.newSpace.used;
+ });
+ _graph.addSample([oldSpace, newSpace]);
+ _isolateList.updateList(model);
+ showStatus('Running ...');
+}
+
+void onRequestFailed() {
+ _updater.cancel();
+ _isolates.removeListener(onUpdateStatus);
+ showStatus('Server closed');
+}
+
+void showStatus(status) {
+ _statusText.text = status;
+}
« no previous file with comments | « runtime/bin/vmstats/vmstats.css ('k') | runtime/bin/vmstats/vmstats.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698