Home | History | Annotate | Download | only in systrace
      1 <!DOCTYPE html>
      2 <html>
      3 <head i18n-values="dir:textdirection;">
      4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      5 <meta charset="utf-8"/>
      6 <title>Android System Trace</title>
      7 <style>
      8   html,
      9   body {
     10     height: 100%;
     11   }
     12 
     13   body {
     14     -webkit-flex-direction: column;
     15     display: -webkit-flex;
     16     margin: 0;
     17     padding: 0;
     18   }
     19 
     20   body > tr-ui-timeline-view {
     21     -webkit-flex: 1 1 auto;
     22     min-height: 0;
     23   }
     24   body > tr-ui-timeline-view:focus {
     25     outline: none;
     26   }
     27 </style>
     28 {{SYSTRACE_TRACE_VIEWER_HTML}}
     29 </head>
     30 <body>
     31   <tr-ui-timeline-view>
     32     <track-view-container id='track_view_container'></track-view-container>
     33   </tr-ui-timeline-view>
     34 
     35   <script>
     36   'use strict';
     37   var timelineViewEl;
     38 
     39   function onLoad() {
     40     timelineViewEl = document.querySelector('tr-ui-timeline-view');
     41     timelineViewEl.globalMode = true;
     42 
     43     var traceDataEls = document.body.querySelectorAll('.trace-data');
     44     var traces = [];
     45     for (var i = 0; i < traceDataEls.length; i++) {
     46       var traceText = traceDataEls[i].textContent;
     47       // Remove the leading newline.
     48       traceText = traceText.substring(1);
     49       traces.push(traceText);
     50     }
     51 
     52     var m = new tr.Model();
     53     var i = new tr.importer.Import(m);
     54     var p = i.importTracesWithProgressDialog(traces);
     55     p.then(
     56       function() {
     57         timelineViewEl.model = m;
     58         timelineViewEl.updateDocumentFavicon();
     59         timelineViewEl.globalMode = true;
     60         timelineViewEl.viewTitle = 'Android System Trace';
     61       },
     62       function(err) {
     63         var overlay = new tr.ui.b.Overlay();
     64         overlay.textContent = tr.b.normalizeException(err).message;
     65         overlay.title = 'Import error';
     66         overlay.visible = true;
     67       });
     68   }
     69   window.addEventListener('load', onLoad);
     70   </script>
     71