forked from cory/tildefriends
Perfetto UI => speedscope. I'm not going to switch away from JSON traces like Perfetto UI wants me to, and this is light, fast, and sufficient.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4031 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -140,44 +140,7 @@ function showFiles() {
|
||||
}
|
||||
|
||||
function trace() {
|
||||
fetch('/trace')
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
throw new Error('Request failed: ' + response.status + ' ' + response.statusText);
|
||||
}
|
||||
return response.arrayBuffer();
|
||||
}).then(function(data) {
|
||||
let perfetto = window.open('/perfetto/');
|
||||
let done = false;
|
||||
if (perfetto) {
|
||||
function message_handler(message) {
|
||||
if (message.data == 'PONG') {
|
||||
perfetto.postMessage({
|
||||
perfetto: {
|
||||
buffer: data,
|
||||
title: 'Tilde Friends Trace',
|
||||
url: window.location.href,
|
||||
}
|
||||
}, '*');
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
window.addEventListener('message', message_handler);
|
||||
function ping_perfetto() {
|
||||
perfetto.postMessage('PING', window.location.origin);
|
||||
if (!done && !perfetto.closed) {
|
||||
setTimeout(ping_perfetto, 50);
|
||||
} else {
|
||||
window.removeEventListener('message', message_handler);
|
||||
}
|
||||
}
|
||||
setTimeout(ping_perfetto, 50);
|
||||
} else {
|
||||
alert("Unable to open perfetto.");
|
||||
}
|
||||
}).catch(function(error) {
|
||||
alert('Failed to load trace: ' + error);
|
||||
});
|
||||
window.open(`/speedscope/#profileURL=${encodeURIComponent('/trace')}&title=Tilde%20Friends`);
|
||||
}
|
||||
|
||||
function stats() {
|
||||
|
Reference in New Issue
Block a user