Home | History | Annotate | Download | only in resources
      1 <!DOCTYPE HTML>
      2 
      3 <!--
      4 about:memory template page
      5 -->
      6 <html id="t">
      7   <head>
      8     <title>About Memory</title>
      9     <link rel="stylesheet" href="shared/css/about_memory.css">
     10 
     11 <style>
     12 body {
     13   font-family: Helvetica, Arial, sans-serif;
     14 }
     15 div#header select {
     16   font-family: Helvetica, Arial, sans-serif;
     17 }
     18 div.viewOptions input {
     19   font-family: Helvetica, Arial, sans-serif;
     20 }
     21 div.otherbrowsers {
     22   font-family: Helvetica, Arial, sans-serif;
     23 }
     24 table.list#browserComparison tr:not([class*='firstRow']) > *:nth-child(1),
     25 table.list#browserComparison tr:not([class*='firstRow']) > *:nth-child(4),
     26 table.list#browserComparison tr.firstRow th:nth-child(1),
     27 table.list#browserComparison tr.firstRow th:nth-child(2) {
     28   border-right: 1px solid #b5c6de;
     29 }
     30 table.list#memoryDetails tr:not([class*='firstRow']) > *:nth-child(2),
     31 table.list#memoryDetails tr:not([class*='firstRow']) > *:nth-child(5),
     32 table.list#memoryDetails tr.firstRow th:nth-child(2),
     33 table.list#memoryDetails tr.firstRow th:nth-child(3) {
     34   border-right: 1px solid #b5c6de;
     35 }
     36 </style>
     37 <script>
     38 function reload() {
     39   if (document.getElementById('helpTooltip'))
     40     return;
     41   history.go(0);
     42 }
     43 
     44 function formatNumber(str) {
     45   str += '';
     46   if (str == '0') {
     47     return 'N/A ';
     48   }
     49   var x = str.split('.');
     50   var x1 = x[0];
     51   var x2 = x.length > 1 ? '.' + x[1] : '';
     52   var regex = /(\d+)(\d{3})/;
     53   while (regex.test(x1)) {
     54     x1 = x1.replace(regex, '$1' + ',' + '$2');
     55   }
     56   return x1;
     57 }
     58 
     59 function addToSum(id, value) {
     60   var target = document.getElementById(id);
     61   var sum = parseInt(target.innerHTML);
     62   sum += parseInt(value);
     63   target.innerHTML = sum;
     64 }
     65 
     66 function handleHelpTooltipMouseOver(event) {
     67   var el = document.createElement('div');
     68   el.id = 'helpTooltip';
     69   el.innerHTML = event.toElement.getElementsByTagName('div')[0].innerHTML;
     70   el.style.top = 0;
     71   el.style.left = 0;
     72   el.style.visibility = 'hidden';
     73   document.body.appendChild(el);
     74 
     75   var width = el.offsetWidth;
     76   var height = el.offsetHeight;
     77 
     78   if (event.pageX - width - 50 + document.body.scrollLeft >= 0 ) {
     79     el.style.left = (event.pageX - width - 20) + 'px';
     80   } else {
     81     el.style.left = (event.pageX + 20) + 'px';
     82   }
     83 
     84 
     85   if (event.pageY - height - 50 + document.body.scrollTop >= 0) {
     86     el.style.top = (event.pageY - height - 20) + 'px';
     87   } else {
     88     el.style.top = (event.pageY + 20) + 'px';
     89   }
     90 
     91   el.style.visibility = 'visible';
     92 }
     93 
     94 function handleHelpTooltipMouseOut(event) {
     95   var el = document.getElementById('helpTooltip');
     96   el.parentNode.removeChild(el);
     97 }
     98 
     99 function enableHelpTooltips() {
    100   var helpEls = document.getElementsByClassName('help');
    101 
    102   for (var i = 0, helpEl; helpEl = helpEls[i]; i++) {
    103     helpEl.onmouseover = handleHelpTooltipMouseOver;
    104     helpEl.onmouseout = handleHelpTooltipMouseOut;
    105   }
    106 }
    107 
    108 //setInterval("reload()", 10000);
    109 </script>
    110 </head>
    111 <body>
    112     <div id='header'>
    113       <h1>
    114         About memory
    115       </h1>
    116       <p>
    117         Measuring memory usage in a multi-process browser
    118       </p>
    119     </div>
    120 
    121     <div id='content'>
    122       <h2>
    123         Summary
    124         <div class='help'>
    125           <div>
    126             <p>
    127               Summary of memory used by currently active browsers. For browsers
    128               which use multiple processes, memory reflects aggregate memory
    129               used across all browser processes.
    130             </p>
    131             <p>
    132               For <span jscontent="current_browser_name"></span>, processes used
    133               to to display diagnostics information (such as this
    134               "about:memory") are excluded.
    135             </p>
    136           </div>
    137         </div>
    138       </h2>
    139 
    140       <table class='list' id='browserComparison'>
    141         <colgroup>
    142           <col class='name' />
    143           <col class='number' />
    144           <col class='number' />
    145           <col class='number' />
    146           <col class='number' />
    147           <col class='number' />
    148         </colgroup>
    149         <tr class='firstRow doNotFilter'>
    150           <th>
    151           </th>
    152           <th colspan='3'>
    153             Memory
    154             <div class='help'>
    155               <div>
    156                 <p>
    157                   <strong>Memory</strong>
    158                 </p>
    159                 <p>
    160                   <strong>Private:</strong>
    161                   Resident memory size that is not shared with any other
    162                   process.  This is the best indicator of browser memory
    163                   resource usage.
    164                 </p>
    165                 <p>
    166                   <strong>Shared:</strong>
    167                   Resident memory size that is currently shared with 2 or more
    168                   processes.  Note: For browsers using multiple processes, if we
    169                   simply added the shared memory of each individual process,
    170                   this value would be inflated. Therefore, this value is
    171                   computed as an approximate value for shared memory in each of
    172                   the browser's processes. Note also that shared memory varies
    173                   depending on what other processes are running on the system,
    174                   and may be difficult to measure reproducibly.
    175                 </p>
    176                 <p>
    177                   <strong>Total:</strong>
    178                   The sum of the private + shared resident memory sizes.
    179                 </p>
    180               </div>
    181             </div>
    182           </th>
    183           <th colspan='2'>
    184             Virtual memory
    185             <div class='help'>
    186               <div>
    187                 <p>
    188                   <strong>Virtual memory</strong>
    189                 </p>
    190                 <p>
    191                   <strong>Private:</strong>
    192                   The resident and paged bytes committed for use by only this
    193                   process.
    194                 </p>
    195                 <p>
    196                   <strong>Mapped:</strong>
    197                   Total bytes allocated by this process that are mapped into the
    198                   view of a section, backed by either system pagefile or file
    199                   system. This is primarily memory-mapped files.
    200                 </p>
    201               </div>
    202             </div>
    203           </th>
    204         </tr>
    205         <tr class='secondRow doNotFilter'>
    206           <th class='name'>
    207             Browser
    208           </th>
    209           <th class='name'>
    210             Private
    211           </th>
    212           <th class='number'>
    213             Shared
    214           </th>
    215           <th class='number'>
    216             Total
    217           </th>
    218           <th class='number'>
    219             Private
    220           </th>
    221           <th class='number'>
    222             Mapped
    223           </th>
    224         </tr>
    225         <tr jsselect="browsers">
    226           <td class='name'>
    227             <div>
    228               <strong jscontent="name"></strong>
    229               <span jscontent="version"></span>
    230             </div>
    231           </td>
    232           <td class='number'>
    233             <span class='th'
    234                 jscontent="formatNumber(ws_priv + ws_shareable - ws_shared)">
    235             </span><span class='k'>k</span>
    236           </td>
    237           <td class='number'>
    238             <span class='th' jscontent="formatNumber(ws_shared / processes)">
    239             </span><span class='k'>k</span>
    240           </td>
    241           <td class='number'>
    242             <span class='th'
    243                 jscontent="formatNumber(ws_priv + ws_shareable - ws_shared +
    244                 (ws_shared / processes))"></span><span class='k'>k</span>
    245           </td>
    246           <td class='number'>
    247             <span class='th' jscontent="formatNumber(comm_priv)"></span>
    248             <span class='k'>k</span>
    249           </td>
    250           <td class='number'>
    251             <span class='th' jscontent="formatNumber(comm_map)"></span>
    252             <span class='k'>k</span>
    253           </td>
    254         </tr>
    255       </table>
    256       <div class=otherbrowsers jsdisplay="browsers.length == 1">
    257         Note: If other browsers (e.g. IE, Firefox, Safari) are running,
    258         I'll show their memory details here.
    259       </div>
    260 
    261       <br /><br /><br />
    262 
    263       <h2>
    264         Processes
    265         <div class='help'>
    266           <div>
    267             <p>
    268               Details of memory usage for each of
    269               <span jscontent="current_browser_name"></span>'s processes.
    270             </p>
    271           </div>
    272         </div>
    273       </h2>
    274 
    275       <table class='list' id='memoryDetails'>
    276         <colgroup>
    277           <col class='pid' />
    278           <col class='name' />
    279           <col class='number' />
    280           <col class='number' />
    281           <col class='number' />
    282           <col class='number' />
    283           <col class='number' />
    284         </colgroup>
    285         <tr class='firstRow doNotFilter'>
    286           <th>
    287           </th>
    288           <th>
    289           </th>
    290           <th colspan='3'>
    291             Memory
    292           </th>
    293           <th colspan='2'>
    294             Virtual memory
    295           </th>
    296 
    297         </tr>
    298         <tr class='secondRow doNotFilter'>
    299           <th class='pid'>
    300             PID
    301           </th>
    302           <th class='name'>
    303             Name
    304           </th>
    305           <th class='number'>
    306             Private
    307           </th>
    308           <th class='number'>
    309             Shared
    310           </th>
    311           <th class='number'>
    312             Total
    313           </th>
    314           <th class='number'>
    315             Private
    316           </th>
    317           <th class='number'>
    318             Mapped
    319           </th>
    320         </tr>
    321 
    322         <tr jsselect="browzr_data">
    323           <td class='pid'>
    324             <span class='th' jscontent="pid"></span>
    325           </td>
    326           <td class='name'>
    327             <div>
    328               Browser
    329             </div>
    330           </td>
    331           <td class='number'>
    332             <span class='th' jseval="addToSum('tot_ws_priv', $this.ws_priv +
    333                 $this.ws_shareable - $this.ws_shared)" jscontent="ws_priv +
    334             ws_shareable - ws_shared"></span><span class='k'>k</span>
    335           </td>
    336           <td class='number'>
    337             <span class='th' jscontent="ws_shared"></span>
    338             <span class='k'>k</span>
    339           </td>
    340           <td class='number'>
    341             <span class='th' jseval="addToSum('tot_ws_tot', $this.ws_priv +
    342                 $this.ws_shareable)" jscontent="ws_priv +
    343             ws_shareable"></span><span class='k'>k</span>
    344           </td>
    345           <td class='number'>
    346             <span class='th' jseval="addToSum('tot_comm_priv', $this.comm_priv)"
    347                 jscontent="comm_priv"></span><span class='k'>k</span>
    348           </td>
    349           <td class='number'>
    350             <span class='th' jseval="addToSum('tot_comm_map', $this.comm_map)"
    351                 jscontent="comm_map"></span><span class='k'>k</span>
    352           </td>
    353         </tr>
    354         <tr jsselect="child_data">
    355           <td class='pid'>
    356             <span class='th' jscontent="pid"></span>
    357           </td>
    358           <td class='name'>
    359             <div jscontent="child_name"></div>
    360             <div jsselect="titles">
    361               <span jscontent="$this"></span><br>
    362             </div>
    363           </td>
    364           <td class='number'>
    365             <span class='th' jseval="addToSum('tot_ws_priv', $this.ws_priv +
    366                 $this.ws_shareable - $this.ws_shared)" jscontent="ws_priv +
    367             ws_shareable - ws_shared"></span><span class='k'>k</span>
    368           </td>
    369           <td class='number'>
    370             <span class='th' jscontent="ws_shared"></span><span
    371                 class='k'>k</span>
    372           </td>
    373           <td class='number'>
    374             <span class='th' jseval="addToSum('tot_ws_tot', $this.ws_priv +
    375                 $this.ws_shareable)" jscontent="ws_priv +
    376             ws_shareable"></span><span class='k'>k</span>
    377           </td>
    378           <td class='number'>
    379             <span class='th' jseval="addToSum('tot_comm_priv', $this.comm_priv)"
    380                 jscontent="comm_priv"></span><span class='k'>k</span>
    381           </td>
    382           <td class='number'>
    383             <span class='th' jseval="addToSum('tot_comm_map', $this.comm_map)"
    384                 jscontent="comm_map"></span><span class='k'>k</span>
    385           </td>
    386         </tr>
    387         <tr class='total doNotFilter'>
    388           <td class='pid'>
    389           </td>
    390           <td class='name'>
    391             &Sigma;
    392           </td>
    393           <td class='number'>
    394             <span class='th' id="tot_ws_priv">0</span><span class='k'>k</span>
    395           </td>
    396           <td class='number'>
    397           </td>
    398           <td class='number'>
    399             <span class='th' id="tot_ws_tot">0</span><span class='k'>k</span>
    400           </td>
    401           <td class='number'>
    402             <span class='th' id="tot_comm_priv">0</span><span class='k'>k</span>
    403           </td>
    404           <td class='number'>
    405             <div class='help'>
    406               <div>
    407                 <p>
    408                   This is an approximation. Conceptually, this is the total
    409                   amount of in-memory pages for the entire logical
    410                   <span jscontent="current_browser_name"></span> application,
    411                   without double counting shared pages (e.g.  mapped DLLs,
    412                   SharedMemory bitmaps, etc.) across the browser and renderers.
    413                 </p>
    414               </div>
    415             </div>
    416             <span class='th' id="tot_comm_map">0</span><span class='k'>k</span>
    417           </td>
    418         </tr>
    419 
    420         <tr class='noResults'>
    421           <td colspan='99'>
    422             No results found.
    423           </td>
    424         </tr>
    425       </table>
    426     </div>
    427 </body>
    428 <script>
    429   enableHelpTooltips();
    430 </script>
    431 </html>
    432