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

Unified Diff: runtime/observatory/lib/src/elements/isolate_view.dart

Issue 1290643005: Remove load graph from isolate (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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: runtime/observatory/lib/src/elements/isolate_view.dart
diff --git a/runtime/observatory/lib/src/elements/isolate_view.dart b/runtime/observatory/lib/src/elements/isolate_view.dart
index de8487ce1e3b50338d037b75defb1a2385888078..fe4fd95b8f660280acd1e333fea9340ebcc9c6df 100644
--- a/runtime/observatory/lib/src/elements/isolate_view.dart
+++ b/runtime/observatory/lib/src/elements/isolate_view.dart
@@ -6,126 +6,27 @@ library isolate_view_element;
import 'dart:async';
import 'observatory_element.dart';
-import 'package:observatory/app.dart';
import 'package:observatory/service.dart';
import 'package:polymer/polymer.dart';
-class TagProfileChart {
- var _table = new DataTable();
- var _chart;
-
- void update(TagProfile tagProfile) {
- if (_table.columns == 0) {
- // Initialize.
- _table.addColumn('string', 'Time');
- for (var tagName in tagProfile.names) {
- if (tagName == 'Idle') {
- // Skip Idle tag.
- continue;
- }
- _table.addColumn('number', tagName);
- }
- }
- _table.clearRows();
- var idleIndex = tagProfile.names.indexOf('Idle');
- assert(idleIndex != -1);
- var t = tagProfile.updatedAtSeconds;
- for (var i = 0; i < tagProfile.snapshots.length; i++) {
- var snapshotTime = tagProfile.snapshots[i].seconds;
- var row = [];
- if (snapshotTime > 0.0) {
- row.add('t ${(snapshotTime - t).toStringAsFixed(2)}');
- } else {
- row.add('');
- }
- var sum = tagProfile.snapshots[i].sum;
- if (sum == 0) {
- for (var j = 0; j < tagProfile.snapshots[i].counters.length; j++) {
- if (j == idleIndex) {
- // Skip idle.
- continue;
- }
- row.add(0);
- }
- } else {
- for (var j = 0; j < tagProfile.snapshots[i].counters.length; j++) {
- if (j == idleIndex) {
- // Skip idle.
- continue;
- }
- var percentage = tagProfile.snapshots[i].counters[j] / sum * 100.0;
- row.add(percentage.toInt());
- }
- }
- _table.addRow(row);
- }
- }
-
- void draw(var element) {
- if (_chart == null) {
- assert(element != null);
- _chart = new Chart('SteppedAreaChart', element);
- _chart.options['isStacked'] = true;
- _chart.options['connectSteps'] = false;
- _chart.options['vAxis'] = {
- 'minValue': 0.0,
- 'maxValue': 100.0,
- };
- }
- _chart.draw(_table);
- }
-}
-
@CustomTag('isolate-view')
class IsolateViewElement extends ObservatoryElement {
@published Isolate isolate;
@published Library rootLibrary;
- Timer _updateTimer;
- TagProfileChart tagProfileChart = new TagProfileChart();
IsolateViewElement.created() : super.created();
Future<ServiceObject> evaluate(String expression) {
return isolate.rootLibrary.evaluate(expression);
}
- void _updateTagProfile() {
- isolate.updateTagProfile().then((tagProfile) {
- tagProfileChart.update(tagProfile);
- _drawTagProfileChart();
- if (_updateTimer != null) {
- // Start the timer again.
- _updateTimer = new Timer(new Duration(seconds: 1), _updateTagProfile);
- }
- });
- }
-
- @override
void attached() {
super.attached();
- // Start a timer to update the isolate summary once a second.
- _updateTimer = new Timer(new Duration(seconds: 1), _updateTagProfile);
if (isolate.topFrame != null) {
isolate.topFrame.function.load();
}
isolate.rootLibrary.load().then((lib) => rootLibrary = lib);
}
- @override
- void detached() {
- super.detached();
- if (_updateTimer != null) {
- _updateTimer.cancel();
- _updateTimer = null;
- }
- }
-
- void _drawTagProfileChart() {
- var element = shadowRoot.querySelector('#tagProfileChart');
- if (element != null) {
- tagProfileChart.draw(element);
- }
- }
-
Future refresh() async {
await isolate.reload();
if (isolate.topFrame != null) {

Powered by Google App Engine
This is Rietveld 408576698