| <!doctype html> |
| <html lang='en-us'> |
| <head> |
| <script src="open_perfetto_trace_bundle.js"></script> |
| <style type="text/css"> |
| html { font-family: Roboto, sans-serif; } |
| main {display: flex; flex-direction: column; max-width: 800px;} |
| main > * { margin: 5px; } |
| </style> |
| </head> |
| <body> |
| |
| |
| <main> |
| <select id='trace_source' size='5'> |
| <option>https://storage.googleapis.com/perfetto-misc/example_android_trace_15s</option> |
| <option selected>https://storage.googleapis.com/perfetto-misc/chrome_example_wikipedia.perfetto_trace.gz</option> |
| </select> |
| <label>Or select a local file: <input type="file" id="file"></label> |
| <input type='button' value='Fetch and open selected trace' id='fetch'> |
| <label><input type='checkbox' id='show_progress' checked="checked">Show progress dialog</label> |
| <label><input type='checkbox' id='new_tab'>Open in new tab</label> |
| <label><input type='checkbox' id='hide_sidebar'>Hide sidebar in Perfetto UI</label> |
| |
| </main> |
| |
| <script type='text/javascript'> |
| |
| function getCheckbox(id) { |
| return document.getElementById(id).checked; |
| } |
| |
| document.getElementById('fetch').addEventListener('click', () => { |
| const opts = {}; |
| |
| if (location.host.startsWith('127.0.0.1') || |
| location.host.startsWith('localhost')) { |
| opts.uiUrl = `${location.protocol}//${location.host}`; |
| } |
| |
| opts.statusDialog = getCheckbox('show_progress'); |
| opts.newTab = getCheckbox('new_tab'); |
| opts.hideSidebar = getCheckbox('hide_sidebar'); |
| |
| const fileInput = document.getElementById('file'); |
| let traceSource; |
| if (fileInput.files.length > 0) { |
| traceSource = fileInput.files[0] |
| } else { |
| traceSource = document.getElementById('trace_source').value; |
| } |
| |
| open_perfetto_trace(traceSource, opts); |
| }); |
| |
| </script> |
| </body> |
| </html> |
| |