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:
2022-11-10 02:39:00 +00:00
parent 205f0df1b4
commit de59a7f338
71 changed files with 901 additions and 242577 deletions

View File

@ -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() {

View File

@ -781,8 +781,8 @@ loadSettings().then(function() {
return staticFileHandler(request, response, null, match[1]);
} else if (match = /^\/codemirror\/([\.\w-/]*)$/.exec(request.uri)) {
return staticDirectoryHandler(request, response, 'deps/codemirror/', match[1]);
} else if (match = /^\/perfetto\/([\.\w-/]*)$/.exec(request.uri)) {
return staticDirectoryHandler(request, response, 'deps/perfetto/', match[1]);
} else if (match = /^\/speedscope\/([\.\w-/]*)$/.exec(request.uri)) {
return staticDirectoryHandler(request, response, 'deps/speedscope/', match[1]);
} else if (match = /^\/split\/([\.\w-/]*)$/.exec(request.uri)) {
return staticDirectoryHandler(request, response, 'deps/split/', match[1]);
} else if (match = /^\/smoothie\/([\.\w-/]*)$/.exec(request.uri)) {