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

Unified Diff: runtime/observatory/web/timeline.js

Issue 1525913002: Observatory: Include profiler samples in the timeline view. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/tests/service/get_cpu_profile_timeline_rpc_test.dart ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/web/timeline.js
diff --git a/runtime/observatory/web/timeline.js b/runtime/observatory/web/timeline.js
index 155d010b2a42f27b216485882e80c69220215c5e..27f572c2ad5cf95b9fe788accdad21235919b70c 100644
--- a/runtime/observatory/web/timeline.js
+++ b/runtime/observatory/web/timeline.js
@@ -40,18 +40,50 @@ function fetchUri(uri, onLoad, onError) {
console.log('GET ' + uri);
}
+
+var traceObject;
+var pendingRequests;
+
+function gotReponse() {
+ pendingRequests--;
+ if (pendingRequests == 0) {
+ console.log("Got all timeline parts");
+ updateTimeline(traceObject);
+ }
+}
+
function fetchTimelineOnLoad(event) {
var xhr = event.target;
var response = JSON.parse(xhr.responseText);
var result = response['result'];
- var traceEvents = result['traceEvents'];
- updateTimeline(traceEvents);
+ var newStackFrames = result['stackFrames']; // Map.
+ var newTraceEvents = result['traceEvents']; // List.
+
+ // Merge in timeline events.
+ traceObject.traceEvents = traceObject.traceEvents.concat(newTraceEvents);
+ for (var key in newStackFrames) {
+ if (newStackFrames.hasOwnProperty(key)) {
+ traceObject.stackFrames[key] = newStackFrames[key];
+ }
+ }
+
+ gotReponse();
}
function fetchTimelineOnError(event) {
+ var xhr = event.target;
+ console.log(xhr.statusText);
+ gotReponse();
}
-function fetchTimeline(vmAddress) {
+function fetchTimeline(vmAddress, isolateIds) {
+ // Reset combined timeline.
+ traceObject = {
+ 'stackFrames': {},
+ 'traceEvents': []
+ };
+ pendingRequests = 1 + isolateIds.length;
+
var parser = document.createElement('a');
parser.href = vmAddress;
var requestUri = 'http://' +
@@ -60,6 +92,17 @@ function fetchTimeline(vmAddress) {
parser.port +
'/_getVMTimeline';
fetchUri(requestUri, fetchTimelineOnLoad, fetchTimelineOnError);
+
+ for (var i = 0; i < isolateIds.length; i++) {
+ var isolateId = isolateIds[i];
+ var requestUri = 'http://' +
+ parser.hostname +
+ ':' +
+ parser.port +
+ '/_getCpuProfileTimeline?tags=VMUser&isolateId=' +
+ isolateId;
+ fetchUri(requestUri, fetchTimelineOnLoad, fetchTimelineOnError);
+ }
}
function onMessage(event) {
@@ -68,7 +111,7 @@ function onMessage(event) {
var params = request['params'];
switch (method) {
case 'refresh':
- fetchTimeline(params['vmAddress']);
+ fetchTimeline(params['vmAddress'], params['isolateIds']);
break;
case 'clear':
clearTimeline();
@@ -90,4 +133,4 @@ document.addEventListener('DOMContentLoaded', function() {
registerForMessages();
});
-console.log('loaded');
+console.log('loaded');
« no previous file with comments | « runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698