Example #1
0
File: statik.go Project: lewgun/gom
func init() {
	data := "PK\x03\x04\x14\x00\x08\x00\x00\x009#uE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00app.js'use strict';\n\n(function(){\n  var profile = \"heap\";\n  var cumsort = true;\n  var data = {\n    max: 0,\n    goroutine: [],\n    thread: [],\n    block: [],\n  };\n\n  refresh();\n\n  $(\".cpu\").on(\"click\", function() {\n    profile = \"profile\";\n    refresh();\n  });\n  $(\".heap\").on(\"click\", function() {\n    profile = \"heap\";\n    refresh();\n  });\n  $(\".refresh\").on(\"click\", function() {\n    refresh(true);\n  });\n  $(\".filter\").on(\"keyup\", function() {\n    refresh();\n  });\n  $('#cumsort').on('change', function() {\n    cumsort = $(this).is(':checked');\n    refresh();\n  });\n\n  var moreStats = function() {\n    $.ajax('/stats').done(function(d) {\n      appendChartData(data.goroutine, d.goroutine);\n      appendChartData(data.thread, d.thread);\n      drawCharts();\n      setTimeout(function() {\n        moreStats();\n      }, 500);\n    });\n  };\n\n  moreStats();\n\n  function refresh(force) {\n    // TODO: cancel the existing request if it's not ciompleted.\n    $('.results').html('Loading, be patient... CPU profile takes 30 seconds.');\n    var f = $('.filter').val();\n    $.get('/p', { profile: profile, filter: f, cumsort: cumsort, force: !!force })\n        .done(function(items) {\n      var html = '';\n      for (var i=0; i<items.length; i++) {\n        var item = items[i];\n        var row = '';\n        row += '<td class=\"bar\"><div style=\"width:' + item['score']*100 + 'px\"></div></td>'\n        row += '<td class=\"num\">' + item['flat'] + '</td>';\n        row += '<td class=\"num\">' + item['flat_perc'] + '</td>';\n        row += '<td class=\"num\">' + item['flatsum_perc'] + '</td>';\n        row += '<td class=\"num\">' + item['cum'] + '</td>';\n        row += '<td class=\"num\">' + item['cum_perc'] + '</td>';\n        row += '<td>' + item['name'] + '</td>';\n        html += '<tr>' + row + '</tr>';\n      }\n      $(\".results\").html('<table>' + html + '</table>');\n    }).fail(function(data) {\n      $('.results').html(data);\n    });\n  };\n\n  function appendChartData(target, val) {\n    if (val > data.max) {\n      data.max = val;\n    }\n    target.pop();\n    if (target.length > 265) {\n      target.shift();\n    }\n    target.push(val);\n    // Add zeros, because sparkline draws the chart relatively,\n    // depending on the min-max range of the dataset.\n    target.push(0);\n  }\n\n  function drawCharts() {\n    var opts = {\n      type: 'line',\n      height: '40px',\n      lineColor: '#1ABC9C',\n      lineWidth: 1,\n      fillColor: '#1ABC9C',\n      spotColor: '#1ABC9C',\n      minSpotColor: '#1ABC9C',\n      maxSpotColor: '#1ABC9C',\n      chartRangeMax: data.max\n    };\n    $(\"#gorotinechart\").sparkline(data.goroutine, opts);\n    $(\"#threadchart\").sparkline(data.thread, opts);\n  }\n})()\nPK\x07\x08v\xbc\x1f\xa3h\n\x00\x00h\n\x00\x00PK\x03\x04\x14\x00\x08\x00\x00\x00\xac\xbd\xbaF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00index.html<!doctype html>\n<html>\n<head>\n  <title>gom</title>\n  <link rel=\"stylesheet\" href=\"//cdn.jsdelivr.net/flat-ui/2.0/css/flat-ui.css\">\n  <style>\n    @import ur(//cdn.jsdelivr.net/flat-ui/2.0/fonts/Flat-UI-Icons.dev.svg);\n    h2 {font-size: 18px; margin: 30px 0px 0px 0px;}\n    .chart{margin: 10px 0px; background: #ECF0F1; border-radius: 5px; padding-top: 3px;}\n    .btn {padding: 2px 13px;}\n    .right{float:right}\n    .filter{width:100%}\n    .container{ width: 800px; margin: 50px auto;}\n    .results { margin: 20px 0px; font-family: monospace; }\n    .results table { width: 8000px; }\n    .results td.num {text-align: right; width: 50px;}\n    .results .bar { width: 100px; }\n    .results .bar div { background: #BDC3C7; height: 10px; border-radius: 4px; }\n    #cumsort { width: 20px; }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n\n    <h2>goroutines</h2>\n    <p>number of execution stacks from all current goroutines</p>\n    <div id=\"gorotinechart\" class=\"chart\"></div>\n\n    <h2>thread</h2>\n    <p>number of execution stacks from all stack traces that led to the creation of new OS threads</p>\n    <div id=\"threadchart\" class=\"chart\"></div>\n\n    <!--\n    <h2>block</h2>\n    <p>number of stack traces that led to blocking on synchronization primitives</p>\n    <div id=\"blockedchart\" class=\"chart\"></div>\n    -->\n\n    <div class=\"row\">\n        <h2>runtime profiles</h2>\n        <span class=\"fui-alert-circle\"></span>\n        <p>\n        <span class=\"fui-repeat\"></span>\n          <button type=\"button\" class=\"cpu btn btn-primary\">CPU</button>\n          <button type=\"button\" class=\"heap btn btn-primary\">Heap</button>\n          <input checked=\"checked\" id=\"cumsort\" class=\"checkbox\" type=\"checkbox\">Cumulative sort\n          <button type=\"button\" class=\"refresh btn right\">Refresh</button>\n        </p>\n        <input type=\"text\" class=\"filter\" placeholder=\"Focus by regex... You can filter by package, type or function name.\">\n        <div class=\"row\"><div class=\"results\"></div></div>\n      </div>\n\n    <p>Source code is available on <a href=\"https://github.com/rakyll/gom\">github.com/rakyll/gom</a>.</p>\n  </div>\n  <!-- TODO(jbd): Add the remote resources to the public folder,\n  otherwise I can't use this program on no-Wifi flights. -->\n  <script src=\"//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>\n  <script src=\"//cdnjs.cloudflare.com/ajax/libs/jquery-sparklines/2.1.2/jquery.sparkline.min.js\"></script>\n  <script type=\"text/javascript\" src=\"/app.js\"></script>\n</body>\n</html>\nPK\x07\x08ja\x84J\xcf	\x00\x00\xcf	\x00\x00PK\x01\x02\x14\x03\x14\x00\x08\x00\x00\x009#uEv\xbc\x1f\xa3h\n\x00\x00h\n\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x00\x00\x00\x00app.jsPK\x01\x02\x14\x03\x14\x00\x08\x00\x00\x00\xac\xbd\xbaFja\x84J\xcf	\x00\x00\xcf	\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x9c\n\x00\x00index.htmlPK\x05\x06\x00\x00\x00\x00\x02\x00\x02\x00l\x00\x00\x00\xa3\x14\x00\x00\x00\x00"
	fs.Register(data)
}
Example #2
0
func init() {
	data := "PK\x03\x04\x14\x00\x08\x00\x00\x00\xa4\x96\xfdF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b\x00\x00\x00favicon.ico\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00 \x00h\x04\x00\x00\x16\x00\x00\x00(\x00\x00\x00\x10\x00\x00\x00 \x00\x00\x00\x01\x00 \x00\x00\x00\x00\x00\x00\x04\x00\x00\x12\x0b\x00\x00\x12\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\xfe\xfe\xff\xfd\xfd\xfd\xff\xfd\xfd\xfe\xff\xff\xff\xff\xff\xfb\xfb\xfd\xff\xbe\xbd\xe2\xff\x8e\x8d\xce\xff\x81\x7f\xc9\xff~{\xc8\xff\x85\x83\xca\xff\xb4\xb2\xde\xff\xf2\xf1\xf9\xff\xff\xff\xff\xff\xfb\xfb\xfd\xff\xfc\xfc\xfc\xff\xff\xff\xff\xff\xfe\xfe\xfe\xff\xfa\xfa\xfb\xff\xff\xff\xff\xff\xd2\xd1\xeb\xff|z\xc5\xff\x98\x96\xd0\xff\xcf\xce\xe8\xff\xd4\xd3\xeb\xff\xd0\xcf\xe9\xff\xce\xce\xe9\xff\x9d\x9b\xd3\xffjh\xbf\xff\xb8\xb8\xe1\xff\xff\xff\xff\xff\xf9\xf9\xfb\xff\xfd\xfd\xfd\xff\xfd\xfd\xfe\xff\xff\xff\xff\xff\xb8\xb7\xe0\xffpn\xc0\xff\xee\xed\xf6\xff\xff\xff\xff\xff\xff\xff\xff\xff\xd3\xd3\xec\xff\xb2\xb1\xdd\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf7\xf7\xfb\xff{z\xc5\xff\x9c\x9b\xd5\xff\xff\xff\xff\xff\xfc\xfc\xfd\xff\xff\xff\xff\xff\xd2\xd1\xec\xfflj\xbf\xff\xf6\xf6\xfa\xff\xd2\xd1\xeb\xff\xe2\xe2\xf2\xff\xdd\xdc\xf0\xff\xe1\xe0\xf2\xff\xd9\xd8\xee\xff\xbb\xba\xe2\xff\xcd\xcc\xe9\xff\xc5\xc4\xe7\xff\xf9\xf9\xfc\xff}{\xc6\xff\xb5\xb4\xdf\xff\xff\xff\xff\xff\xff\xff\xff\xffqo\xc2\xff\xe2\xe1\xf1\xff\xc5\xc4\xe7\xffUS\xb7\xffzx\xc6\xff\xc6\xc5\xe5\xffdc\xbc\xff\x8c\x8b\xce\xffUT\xb8\xff\xbc\xbb\xe1\xffKI\xb2\xff\xf1\xf1\xf9\xff\xef\xee\xf7\xffpn\xc1\xff\xf0\xf0\xf9\xff\xc9\xc9\xe7\xff\x83\x82\xc8\xff\xff\xff\xff\xff\x92\x92\xd0\xffZY\xba\xffec\xbe\xff\x95\x93\xd0\xff@>\xae\xff\xae\xac\xdd\xfflk\xc2\xff\xec\xec\xf6\xffEC\xb1\xff\xf3\xf3\xf9\xff\xff\xff\xff\xff\xa1\xa0\xd4\xff\xb6\xb5\xdf\xff\x97\x95\xd3\xff\xb1\xb0\xdc\xff\xff\xff\xff\xff\xca\xca\xe9\xffZX\xba\xff\x97\x95\xd2\xfffe\xbf\xffsr\xc3\xff\x9f\x9e\xd6\xffvt\xc6\xff\xa7\xa6\xd9\xffKI\xb3\xff\xd7\xd6\xed\xff\xff\xff\xff\xff\xd6\xd5\xec\xff\x91\x8f\xce\xff\x8f\x8d\xce\xff\xd5\xd4\xec\xff\xe3\xe3\xf3\xff\xc7\xc6\xe6\xff\xda\xda\xee\xff\xc1\xc1\xe3\xff\xab\xaa\xda\xff\xc3\xc2\xe4\xff\x9e\x9c\xd5\xff\x9a\x99\xd3\xff\xb4\xb3\xdf\xff\xc4\xc3\xe5\xff\xa2\xa1\xd6\xff\xff\xff\xff\xff\xe4\xe4\xf3\xff~|\xc7\xff\x88\x87\xcc\xff\xd3\xd3\xeb\xff\xd2\xd1\xeb\xfflj\xc0\xff\xa7\xa6\xda\xffrp\xc3\xff\xa8\xa8\xda\xff\xb4\xb3\xde\xffJH\xb4\xff}|\xc7\xff\x8b\x8a\xce\xff\xcb\xcb\xe9\xffPN\xb6\xff\xff\xff\xff\xff\xe2\xe2\xf2\xffyx\xc5\xff\x99\x98\xd3\xff\xc0\xbf\xe2\xff\xc7\xc7\xe7\xff\x06\x03\x99\xff\xcb\xca\xe8\xffrp\xc3\xff\xc2\xc2\xe5\xff\xb2\xb1\xdd\xffLJ\xb5\xff\xaf\xad\xdc\xffa_\xbb\xff\xb4\xb3\xde\xffB?\xb0\xff\xdf\xde\xf0\xff\xd2\xd1\xea\xff\x80~\xc8\xff\xcf\xce\xea\xff\x9d\x9b\xd3\xff\x9c\x9b\xd5\xffpn\xc2\xff\xa9\xa7\xd9\xffFD\xb0\xff\x89\x88\xcc\xff\xa1\xa0\xd7\xff__\xbc\xff\xa9\xa7\xda\xff_]\xbb\xff\x89\x88\xcc\xffB?\xb0\xff\xc5\xc4\xe5\xff\x9b\x99\xd2\xff\xb2\xb1\xdd\xff\xff\xff\xff\xff|z\xc6\xff\xc3\xc2\xe4\xff\xd6\xd5\xed\xff\xbd\xbd\xe2\xff\xc2\xc1\xe5\xff\xce\xce\xea\xff\xe2\xe1\xf2\xff\xd7\xd6\xee\xff\xe1\xe0\xf2\xff\xbe\xbd\xe3\xff\xb6\xb5\xdf\xff\xc5\xc4\xe6\xff\xbf\xbe\xe2\xffrq\xc2\xff\xf8\xf8\xfc\xff\xff\xff\xff\xff\xde\xdd\xf1\xffus\xc2\xff\xd5\xd5\xeb\xff\xb6\xb5\xdf\xff\xff\xff\xff\xff\xfd\xfd\xfe\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xfd\xfd\xfe\xff\xff\xff\xff\xff\xb1\xb0\xdc\xff\xeb\xeb\xf5\xff\x81\x80\xc8\xff\xc3\xc2\xe5\xff\xff\xff\xff\xff\xfc\xfc\xfd\xff\xff\xff\xff\xff\xca\xc9\xe8\xffki\xbe\xff\xcf\xce\xe8\xff\xff\xff\xff\xff\xff\xff\xff\xff\xbf\xbf\xe3\xff\xda\xd9\xee\xff\xff\xff\xff\xff\xff\xff\xff\xff\xdc\xdb\xee\xffon\xbf\xff\xaf\xae\xdd\xff\xff\xff\xff\xff\xfc\xfc\xfe\xff\xfd\xfd\xfd\xff\xfa\xfa\xfb\xff\xff\xff\xff\xff\xe0\xe0\xf2\xff~}\xc7\xff\x8e\x8c\xcd\xff\xbd\xbc\xe1\xff\xa6\xa5\xd7\xff\xba\xb9\xe0\xff\xc3\xc2\xe3\xff\x8c\x8b\xcc\xffxv\xc4\xff\xcc\xcb\xe9\xff\xff\xff\xff\xff\xfa\xf9\xfb\xff\xfd\xfd\xfd\xff\xff\xff\xff\xff\xfd\xfd\xfd\xff\xfd\xfd\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xd3\xd3\xec\xff\x9b\x9a\xd3\xff\x92\x90\xd0\xff\x8e\x8d\xce\xff\x9d\x9c\xd4\xff\xc9\xc8\xe7\xff\xf9\xf9\xfc\xff\xff\xff\xff\xff\xfd\xfc\xfe\xff\xfe\xfe\xfe\xff\xfe\xfe\xfe\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00PK\x07\x08\x1a*\x0c\xd7~\x04\x00\x00~\x04\x00\x00PK\x03\x04\x14\x00\x08\x00\x00\x00\xcaB\xd8F\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00robots.txtUser-agent: *\nDisallow: /\nPK\x07\x08B\x84\xa4\x8f\x1a\x00\x00\x00\x1a\x00\x00\x00PK\x01\x02\x14\x03\x14\x00\x08\x00\x00\x00\xa4\x96\xfdF\x1a*\x0c\xd7~\x04\x00\x00~\x04\x00\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xed\x81\x00\x00\x00\x00favicon.icoPK\x01\x02\x14\x03\x14\x00\x08\x00\x00\x00\xcaB\xd8FB\x84\xa4\x8f\x1a\x00\x00\x00\x1a\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\xb7\x04\x00\x00robots.txtPK\x05\x06\x00\x00\x00\x00\x02\x00\x02\x00q\x00\x00\x00	\x05\x00\x00\x00\x00"
	fs.Register(data)
}
Example #3
0
func init() {
	data := "PK\x03\x04\x14\x00\x08\x00\x00\x00@\x8cVH\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x00\x00public/css.css#id {color:red};\nPK\x07\x08\x1fSB\x1d\x11\x00\x00\x00\x11\x00\x00\x00PK\x03\x04\x14\x00\x08\x00\x00\x00-\x8cVH\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x00\x00templates/template.html<!doctype html>\n<html>\n<head>\n</head>\n<body>\n    <h1>Hello</h1>\n</body>\nPK\x07\x08	\xf96[H\x00\x00\x00H\x00\x00\x00PK\x01\x02\x14\x03\x14\x00\x08\x00\x00\x00@\x8cVH\x1fSB\x1d\x11\x00\x00\x00\x11\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x00\x00\x00\x00public/css.cssPK\x01\x02\x14\x03\x14\x00\x08\x00\x00\x00-\x8cVH	\xf96[H\x00\x00\x00H\x00\x00\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81M\x00\x00\x00templates/template.htmlPK\x05\x06\x00\x00\x00\x00\x02\x00\x02\x00\x81\x00\x00\x00\xda\x00\x00\x00\x00\x00"
	fs.Register(data)
}