diff --git a/main.css b/main.css
deleted file mode 100644
index 051699e..0000000
--- a/main.css
+++ /dev/null
@@ -1,23 +0,0 @@
-#reset {
- margin-top: 15px;
- margin-bottom: 15px;
-}
-#start {
- position: absolute;
- visibility: none;
- width: 5px;
- height: 600px;
- background-color: red;
- opacity: 80%;
-}
-#chart {
- width: 800px;
- height: 600px;
- float:left;
-}
-#stacktrace {
- left: 820px;
- position: absolute;
- font-family: arial;
- font-size: 12px;
-}
\ No newline at end of file
diff --git a/main.html b/main.html
deleted file mode 100644
index 41f5425..0000000
--- a/main.html
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
- Click the graph to zoom in
-
-
-
-
-
diff --git a/main.js b/main.js
deleted file mode 100644
index f1b6db1..0000000
--- a/main.js
+++ /dev/null
@@ -1,65 +0,0 @@
-var clicks = [];
-var bind = false;
-
-function plotclick(event, pos, item)
-{
- if (!item)
- return;
- clicks.push(item);
- if (clicks.length == 2) {
- if (clicks[0].datapoint[0] > clicks[1].datapoint[0]) {
- // swap
- var tmp = clicks[0];
- clicks[0] = clicks[1];
- clicks[1] = tmp;
- }
- $.getJSON("/get_json?x0=" + clicks[0].datapoint[0] + "&x1=" + clicks[1].datapoint[0],
- plot_data);
- return;
- }
- $("#start").css({left: pos.pageX});
- $("#start").show();
-}
-
-function zoom_out()
-{
- $.getJSON("/get_json", plot_data);
- clicks = [];
-}
-
-function plothover(event, pos, item)
-{
- var x = Math.ceil(pos);
- if (item) {
- $("#stacktrace").html(glob_data.mem[item.dataIndex][2]);
- }
-}
-
-function format_y_axis(val, axis)
-{
- if (val > 1024) {
- return (val / 1024).toFixed() + " MiB";
- }
- return val + " KiB";
-}
-
-function plot_data(data)
-{
- glob_data = data;
- $.plot("#chart", [data['mem']], {
- grid: {hoverable: true, clickable: true},
- yaxis: {tickFormatter: format_y_axis}
- });
- if (!bind) {
- $("#chart").bind("plothover", plothover);
- $("#chart").bind("plotclick", plotclick);
- bind = true;
- }
- clicks = [];
- $("#start").hide();
-}
-
-$(function() {
- $.getJSON("/get_json", plot_data);
- $("#start").hide();
-})
\ No newline at end of file
diff --git a/flot/API.md b/static/flot/API.md
similarity index 100%
rename from flot/API.md
rename to static/flot/API.md
diff --git a/flot/CONTRIBUTING.md b/static/flot/CONTRIBUTING.md
similarity index 100%
rename from flot/CONTRIBUTING.md
rename to static/flot/CONTRIBUTING.md
diff --git a/flot/FAQ.md b/static/flot/FAQ.md
similarity index 100%
rename from flot/FAQ.md
rename to static/flot/FAQ.md
diff --git a/flot/LICENSE.txt b/static/flot/LICENSE.txt
similarity index 100%
rename from flot/LICENSE.txt
rename to static/flot/LICENSE.txt
diff --git a/flot/Makefile b/static/flot/Makefile
similarity index 100%
rename from flot/Makefile
rename to static/flot/Makefile
diff --git a/flot/NEWS.md b/static/flot/NEWS.md
similarity index 100%
rename from flot/NEWS.md
rename to static/flot/NEWS.md
diff --git a/flot/PLUGINS.md b/static/flot/PLUGINS.md
similarity index 100%
rename from flot/PLUGINS.md
rename to static/flot/PLUGINS.md
diff --git a/flot/README.md b/static/flot/README.md
similarity index 100%
rename from flot/README.md
rename to static/flot/README.md
diff --git a/flot/examples/.DS_Store b/static/flot/examples/.DS_Store
similarity index 100%
rename from flot/examples/.DS_Store
rename to static/flot/examples/.DS_Store
diff --git a/flot/examples/ajax/data-eu-gdp-growth-1.json b/static/flot/examples/ajax/data-eu-gdp-growth-1.json
similarity index 100%
rename from flot/examples/ajax/data-eu-gdp-growth-1.json
rename to static/flot/examples/ajax/data-eu-gdp-growth-1.json
diff --git a/flot/examples/ajax/data-eu-gdp-growth-2.json b/static/flot/examples/ajax/data-eu-gdp-growth-2.json
similarity index 100%
rename from flot/examples/ajax/data-eu-gdp-growth-2.json
rename to static/flot/examples/ajax/data-eu-gdp-growth-2.json
diff --git a/flot/examples/ajax/data-eu-gdp-growth-3.json b/static/flot/examples/ajax/data-eu-gdp-growth-3.json
similarity index 100%
rename from flot/examples/ajax/data-eu-gdp-growth-3.json
rename to static/flot/examples/ajax/data-eu-gdp-growth-3.json
diff --git a/flot/examples/ajax/data-eu-gdp-growth-4.json b/static/flot/examples/ajax/data-eu-gdp-growth-4.json
similarity index 100%
rename from flot/examples/ajax/data-eu-gdp-growth-4.json
rename to static/flot/examples/ajax/data-eu-gdp-growth-4.json
diff --git a/flot/examples/ajax/data-eu-gdp-growth-5.json b/static/flot/examples/ajax/data-eu-gdp-growth-5.json
similarity index 100%
rename from flot/examples/ajax/data-eu-gdp-growth-5.json
rename to static/flot/examples/ajax/data-eu-gdp-growth-5.json
diff --git a/flot/examples/ajax/data-eu-gdp-growth.json b/static/flot/examples/ajax/data-eu-gdp-growth.json
similarity index 100%
rename from flot/examples/ajax/data-eu-gdp-growth.json
rename to static/flot/examples/ajax/data-eu-gdp-growth.json
diff --git a/flot/examples/ajax/data-japan-gdp-growth.json b/static/flot/examples/ajax/data-japan-gdp-growth.json
similarity index 100%
rename from flot/examples/ajax/data-japan-gdp-growth.json
rename to static/flot/examples/ajax/data-japan-gdp-growth.json
diff --git a/flot/examples/ajax/data-usa-gdp-growth.json b/static/flot/examples/ajax/data-usa-gdp-growth.json
similarity index 100%
rename from flot/examples/ajax/data-usa-gdp-growth.json
rename to static/flot/examples/ajax/data-usa-gdp-growth.json
diff --git a/flot/examples/ajax/index.html b/static/flot/examples/ajax/index.html
similarity index 100%
rename from flot/examples/ajax/index.html
rename to static/flot/examples/ajax/index.html
diff --git a/flot/examples/annotating/index.html b/static/flot/examples/annotating/index.html
similarity index 100%
rename from flot/examples/annotating/index.html
rename to static/flot/examples/annotating/index.html
diff --git a/flot/examples/axes-interacting/index.html b/static/flot/examples/axes-interacting/index.html
similarity index 100%
rename from flot/examples/axes-interacting/index.html
rename to static/flot/examples/axes-interacting/index.html
diff --git a/flot/examples/axes-multiple/index.html b/static/flot/examples/axes-multiple/index.html
similarity index 100%
rename from flot/examples/axes-multiple/index.html
rename to static/flot/examples/axes-multiple/index.html
diff --git a/flot/examples/axes-time-zones/date.js b/static/flot/examples/axes-time-zones/date.js
similarity index 100%
rename from flot/examples/axes-time-zones/date.js
rename to static/flot/examples/axes-time-zones/date.js
diff --git a/flot/examples/axes-time-zones/index.html b/static/flot/examples/axes-time-zones/index.html
similarity index 100%
rename from flot/examples/axes-time-zones/index.html
rename to static/flot/examples/axes-time-zones/index.html
diff --git a/flot/examples/axes-time-zones/tz/africa b/static/flot/examples/axes-time-zones/tz/africa
similarity index 100%
rename from flot/examples/axes-time-zones/tz/africa
rename to static/flot/examples/axes-time-zones/tz/africa
diff --git a/flot/examples/axes-time-zones/tz/antarctica b/static/flot/examples/axes-time-zones/tz/antarctica
similarity index 100%
rename from flot/examples/axes-time-zones/tz/antarctica
rename to static/flot/examples/axes-time-zones/tz/antarctica
diff --git a/flot/examples/axes-time-zones/tz/asia b/static/flot/examples/axes-time-zones/tz/asia
similarity index 100%
rename from flot/examples/axes-time-zones/tz/asia
rename to static/flot/examples/axes-time-zones/tz/asia
diff --git a/flot/examples/axes-time-zones/tz/australasia b/static/flot/examples/axes-time-zones/tz/australasia
similarity index 100%
rename from flot/examples/axes-time-zones/tz/australasia
rename to static/flot/examples/axes-time-zones/tz/australasia
diff --git a/flot/examples/axes-time-zones/tz/backward b/static/flot/examples/axes-time-zones/tz/backward
similarity index 100%
rename from flot/examples/axes-time-zones/tz/backward
rename to static/flot/examples/axes-time-zones/tz/backward
diff --git a/flot/examples/axes-time-zones/tz/etcetera b/static/flot/examples/axes-time-zones/tz/etcetera
similarity index 100%
rename from flot/examples/axes-time-zones/tz/etcetera
rename to static/flot/examples/axes-time-zones/tz/etcetera
diff --git a/flot/examples/axes-time-zones/tz/europe b/static/flot/examples/axes-time-zones/tz/europe
similarity index 100%
rename from flot/examples/axes-time-zones/tz/europe
rename to static/flot/examples/axes-time-zones/tz/europe
diff --git a/flot/examples/axes-time-zones/tz/factory b/static/flot/examples/axes-time-zones/tz/factory
similarity index 100%
rename from flot/examples/axes-time-zones/tz/factory
rename to static/flot/examples/axes-time-zones/tz/factory
diff --git a/flot/examples/axes-time-zones/tz/iso3166.tab b/static/flot/examples/axes-time-zones/tz/iso3166.tab
similarity index 100%
rename from flot/examples/axes-time-zones/tz/iso3166.tab
rename to static/flot/examples/axes-time-zones/tz/iso3166.tab
diff --git a/flot/examples/axes-time-zones/tz/leapseconds b/static/flot/examples/axes-time-zones/tz/leapseconds
similarity index 100%
rename from flot/examples/axes-time-zones/tz/leapseconds
rename to static/flot/examples/axes-time-zones/tz/leapseconds
diff --git a/flot/examples/axes-time-zones/tz/northamerica b/static/flot/examples/axes-time-zones/tz/northamerica
similarity index 100%
rename from flot/examples/axes-time-zones/tz/northamerica
rename to static/flot/examples/axes-time-zones/tz/northamerica
diff --git a/flot/examples/axes-time-zones/tz/pacificnew b/static/flot/examples/axes-time-zones/tz/pacificnew
similarity index 100%
rename from flot/examples/axes-time-zones/tz/pacificnew
rename to static/flot/examples/axes-time-zones/tz/pacificnew
diff --git a/flot/examples/axes-time-zones/tz/solar87 b/static/flot/examples/axes-time-zones/tz/solar87
similarity index 100%
rename from flot/examples/axes-time-zones/tz/solar87
rename to static/flot/examples/axes-time-zones/tz/solar87
diff --git a/flot/examples/axes-time-zones/tz/solar88 b/static/flot/examples/axes-time-zones/tz/solar88
similarity index 100%
rename from flot/examples/axes-time-zones/tz/solar88
rename to static/flot/examples/axes-time-zones/tz/solar88
diff --git a/flot/examples/axes-time-zones/tz/solar89 b/static/flot/examples/axes-time-zones/tz/solar89
similarity index 100%
rename from flot/examples/axes-time-zones/tz/solar89
rename to static/flot/examples/axes-time-zones/tz/solar89
diff --git a/flot/examples/axes-time-zones/tz/southamerica b/static/flot/examples/axes-time-zones/tz/southamerica
similarity index 100%
rename from flot/examples/axes-time-zones/tz/southamerica
rename to static/flot/examples/axes-time-zones/tz/southamerica
diff --git a/flot/examples/axes-time-zones/tz/systemv b/static/flot/examples/axes-time-zones/tz/systemv
similarity index 100%
rename from flot/examples/axes-time-zones/tz/systemv
rename to static/flot/examples/axes-time-zones/tz/systemv
diff --git a/flot/examples/axes-time-zones/tz/yearistype.sh b/static/flot/examples/axes-time-zones/tz/yearistype.sh
similarity index 100%
rename from flot/examples/axes-time-zones/tz/yearistype.sh
rename to static/flot/examples/axes-time-zones/tz/yearistype.sh
diff --git a/flot/examples/axes-time-zones/tz/zone.tab b/static/flot/examples/axes-time-zones/tz/zone.tab
similarity index 100%
rename from flot/examples/axes-time-zones/tz/zone.tab
rename to static/flot/examples/axes-time-zones/tz/zone.tab
diff --git a/flot/examples/axes-time/index.html b/static/flot/examples/axes-time/index.html
similarity index 100%
rename from flot/examples/axes-time/index.html
rename to static/flot/examples/axes-time/index.html
diff --git a/flot/examples/background.png b/static/flot/examples/background.png
similarity index 100%
rename from flot/examples/background.png
rename to static/flot/examples/background.png
diff --git a/flot/examples/basic-options/index.html b/static/flot/examples/basic-options/index.html
similarity index 100%
rename from flot/examples/basic-options/index.html
rename to static/flot/examples/basic-options/index.html
diff --git a/flot/examples/basic-usage/index.html b/static/flot/examples/basic-usage/index.html
similarity index 100%
rename from flot/examples/basic-usage/index.html
rename to static/flot/examples/basic-usage/index.html
diff --git a/flot/examples/canvas/index.html b/static/flot/examples/canvas/index.html
similarity index 100%
rename from flot/examples/canvas/index.html
rename to static/flot/examples/canvas/index.html
diff --git a/flot/examples/categories/index.html b/static/flot/examples/categories/index.html
similarity index 100%
rename from flot/examples/categories/index.html
rename to static/flot/examples/categories/index.html
diff --git a/flot/examples/examples.css b/static/flot/examples/examples.css
similarity index 100%
rename from flot/examples/examples.css
rename to static/flot/examples/examples.css
diff --git a/flot/examples/image/hs-2004-27-a-large-web.jpg b/static/flot/examples/image/hs-2004-27-a-large-web.jpg
similarity index 100%
rename from flot/examples/image/hs-2004-27-a-large-web.jpg
rename to static/flot/examples/image/hs-2004-27-a-large-web.jpg
diff --git a/flot/examples/image/index.html b/static/flot/examples/image/index.html
similarity index 100%
rename from flot/examples/image/index.html
rename to static/flot/examples/image/index.html
diff --git a/flot/examples/index.html b/static/flot/examples/index.html
similarity index 100%
rename from flot/examples/index.html
rename to static/flot/examples/index.html
diff --git a/flot/examples/interacting/index.html b/static/flot/examples/interacting/index.html
similarity index 100%
rename from flot/examples/interacting/index.html
rename to static/flot/examples/interacting/index.html
diff --git a/flot/examples/navigate/arrow-down.gif b/static/flot/examples/navigate/arrow-down.gif
similarity index 100%
rename from flot/examples/navigate/arrow-down.gif
rename to static/flot/examples/navigate/arrow-down.gif
diff --git a/flot/examples/navigate/arrow-left.gif b/static/flot/examples/navigate/arrow-left.gif
similarity index 100%
rename from flot/examples/navigate/arrow-left.gif
rename to static/flot/examples/navigate/arrow-left.gif
diff --git a/flot/examples/navigate/arrow-right.gif b/static/flot/examples/navigate/arrow-right.gif
similarity index 100%
rename from flot/examples/navigate/arrow-right.gif
rename to static/flot/examples/navigate/arrow-right.gif
diff --git a/flot/examples/navigate/arrow-up.gif b/static/flot/examples/navigate/arrow-up.gif
similarity index 100%
rename from flot/examples/navigate/arrow-up.gif
rename to static/flot/examples/navigate/arrow-up.gif
diff --git a/flot/examples/navigate/index.html b/static/flot/examples/navigate/index.html
similarity index 100%
rename from flot/examples/navigate/index.html
rename to static/flot/examples/navigate/index.html
diff --git a/flot/examples/percentiles/index.html b/static/flot/examples/percentiles/index.html
similarity index 100%
rename from flot/examples/percentiles/index.html
rename to static/flot/examples/percentiles/index.html
diff --git a/flot/examples/realtime/index.html b/static/flot/examples/realtime/index.html
similarity index 100%
rename from flot/examples/realtime/index.html
rename to static/flot/examples/realtime/index.html
diff --git a/flot/examples/resize/index.html b/static/flot/examples/resize/index.html
similarity index 100%
rename from flot/examples/resize/index.html
rename to static/flot/examples/resize/index.html
diff --git a/flot/examples/selection/index.html b/static/flot/examples/selection/index.html
similarity index 100%
rename from flot/examples/selection/index.html
rename to static/flot/examples/selection/index.html
diff --git a/flot/examples/series-errorbars/index.html b/static/flot/examples/series-errorbars/index.html
similarity index 100%
rename from flot/examples/series-errorbars/index.html
rename to static/flot/examples/series-errorbars/index.html
diff --git a/flot/examples/series-pie/index.html b/static/flot/examples/series-pie/index.html
similarity index 100%
rename from flot/examples/series-pie/index.html
rename to static/flot/examples/series-pie/index.html
diff --git a/flot/examples/series-toggle/index.html b/static/flot/examples/series-toggle/index.html
similarity index 100%
rename from flot/examples/series-toggle/index.html
rename to static/flot/examples/series-toggle/index.html
diff --git a/flot/examples/series-types/index.html b/static/flot/examples/series-types/index.html
similarity index 100%
rename from flot/examples/series-types/index.html
rename to static/flot/examples/series-types/index.html
diff --git a/flot/examples/shared/jquery-ui/jquery-ui.min.css b/static/flot/examples/shared/jquery-ui/jquery-ui.min.css
similarity index 100%
rename from flot/examples/shared/jquery-ui/jquery-ui.min.css
rename to static/flot/examples/shared/jquery-ui/jquery-ui.min.css
diff --git a/flot/examples/shared/jquery-ui/jquery-ui.min.js b/static/flot/examples/shared/jquery-ui/jquery-ui.min.js
similarity index 100%
rename from flot/examples/shared/jquery-ui/jquery-ui.min.js
rename to static/flot/examples/shared/jquery-ui/jquery-ui.min.js
diff --git a/flot/examples/stacking/index.html b/static/flot/examples/stacking/index.html
similarity index 100%
rename from flot/examples/stacking/index.html
rename to static/flot/examples/stacking/index.html
diff --git a/flot/examples/symbols/index.html b/static/flot/examples/symbols/index.html
similarity index 100%
rename from flot/examples/symbols/index.html
rename to static/flot/examples/symbols/index.html
diff --git a/flot/examples/threshold/index.html b/static/flot/examples/threshold/index.html
similarity index 100%
rename from flot/examples/threshold/index.html
rename to static/flot/examples/threshold/index.html
diff --git a/flot/examples/tracking/index.html b/static/flot/examples/tracking/index.html
similarity index 100%
rename from flot/examples/tracking/index.html
rename to static/flot/examples/tracking/index.html
diff --git a/flot/examples/visitors/index.html b/static/flot/examples/visitors/index.html
similarity index 100%
rename from flot/examples/visitors/index.html
rename to static/flot/examples/visitors/index.html
diff --git a/flot/examples/zooming/index.html b/static/flot/examples/zooming/index.html
similarity index 100%
rename from flot/examples/zooming/index.html
rename to static/flot/examples/zooming/index.html
diff --git a/flot/excanvas.js b/static/flot/excanvas.js
similarity index 100%
rename from flot/excanvas.js
rename to static/flot/excanvas.js
diff --git a/flot/excanvas.min.js b/static/flot/excanvas.min.js
similarity index 100%
rename from flot/excanvas.min.js
rename to static/flot/excanvas.min.js
diff --git a/flot/jquery.colorhelpers.js b/static/flot/jquery.colorhelpers.js
similarity index 100%
rename from flot/jquery.colorhelpers.js
rename to static/flot/jquery.colorhelpers.js
diff --git a/flot/jquery.colorhelpers.min.js b/static/flot/jquery.colorhelpers.min.js
similarity index 100%
rename from flot/jquery.colorhelpers.min.js
rename to static/flot/jquery.colorhelpers.min.js
diff --git a/flot/jquery.flot.canvas.js b/static/flot/jquery.flot.canvas.js
similarity index 100%
rename from flot/jquery.flot.canvas.js
rename to static/flot/jquery.flot.canvas.js
diff --git a/flot/jquery.flot.canvas.min.js b/static/flot/jquery.flot.canvas.min.js
similarity index 100%
rename from flot/jquery.flot.canvas.min.js
rename to static/flot/jquery.flot.canvas.min.js
diff --git a/flot/jquery.flot.categories.js b/static/flot/jquery.flot.categories.js
similarity index 100%
rename from flot/jquery.flot.categories.js
rename to static/flot/jquery.flot.categories.js
diff --git a/flot/jquery.flot.categories.min.js b/static/flot/jquery.flot.categories.min.js
similarity index 100%
rename from flot/jquery.flot.categories.min.js
rename to static/flot/jquery.flot.categories.min.js
diff --git a/flot/jquery.flot.crosshair.js b/static/flot/jquery.flot.crosshair.js
similarity index 100%
rename from flot/jquery.flot.crosshair.js
rename to static/flot/jquery.flot.crosshair.js
diff --git a/flot/jquery.flot.crosshair.min.js b/static/flot/jquery.flot.crosshair.min.js
similarity index 100%
rename from flot/jquery.flot.crosshair.min.js
rename to static/flot/jquery.flot.crosshair.min.js
diff --git a/flot/jquery.flot.errorbars.js b/static/flot/jquery.flot.errorbars.js
similarity index 100%
rename from flot/jquery.flot.errorbars.js
rename to static/flot/jquery.flot.errorbars.js
diff --git a/flot/jquery.flot.errorbars.min.js b/static/flot/jquery.flot.errorbars.min.js
similarity index 100%
rename from flot/jquery.flot.errorbars.min.js
rename to static/flot/jquery.flot.errorbars.min.js
diff --git a/flot/jquery.flot.fillbetween.js b/static/flot/jquery.flot.fillbetween.js
similarity index 100%
rename from flot/jquery.flot.fillbetween.js
rename to static/flot/jquery.flot.fillbetween.js
diff --git a/flot/jquery.flot.fillbetween.min.js b/static/flot/jquery.flot.fillbetween.min.js
similarity index 100%
rename from flot/jquery.flot.fillbetween.min.js
rename to static/flot/jquery.flot.fillbetween.min.js
diff --git a/flot/jquery.flot.image.js b/static/flot/jquery.flot.image.js
similarity index 100%
rename from flot/jquery.flot.image.js
rename to static/flot/jquery.flot.image.js
diff --git a/flot/jquery.flot.image.min.js b/static/flot/jquery.flot.image.min.js
similarity index 100%
rename from flot/jquery.flot.image.min.js
rename to static/flot/jquery.flot.image.min.js
diff --git a/flot/jquery.flot.js b/static/flot/jquery.flot.js
similarity index 100%
rename from flot/jquery.flot.js
rename to static/flot/jquery.flot.js
diff --git a/flot/jquery.flot.min.js b/static/flot/jquery.flot.min.js
similarity index 100%
rename from flot/jquery.flot.min.js
rename to static/flot/jquery.flot.min.js
diff --git a/flot/jquery.flot.navigate.js b/static/flot/jquery.flot.navigate.js
similarity index 100%
rename from flot/jquery.flot.navigate.js
rename to static/flot/jquery.flot.navigate.js
diff --git a/flot/jquery.flot.navigate.min.js b/static/flot/jquery.flot.navigate.min.js
similarity index 100%
rename from flot/jquery.flot.navigate.min.js
rename to static/flot/jquery.flot.navigate.min.js
diff --git a/flot/jquery.flot.pie.js b/static/flot/jquery.flot.pie.js
similarity index 100%
rename from flot/jquery.flot.pie.js
rename to static/flot/jquery.flot.pie.js
diff --git a/flot/jquery.flot.pie.min.js b/static/flot/jquery.flot.pie.min.js
similarity index 100%
rename from flot/jquery.flot.pie.min.js
rename to static/flot/jquery.flot.pie.min.js
diff --git a/flot/jquery.flot.resize.js b/static/flot/jquery.flot.resize.js
similarity index 100%
rename from flot/jquery.flot.resize.js
rename to static/flot/jquery.flot.resize.js
diff --git a/flot/jquery.flot.resize.min.js b/static/flot/jquery.flot.resize.min.js
similarity index 100%
rename from flot/jquery.flot.resize.min.js
rename to static/flot/jquery.flot.resize.min.js
diff --git a/flot/jquery.flot.selection.js b/static/flot/jquery.flot.selection.js
similarity index 100%
rename from flot/jquery.flot.selection.js
rename to static/flot/jquery.flot.selection.js
diff --git a/flot/jquery.flot.selection.min.js b/static/flot/jquery.flot.selection.min.js
similarity index 100%
rename from flot/jquery.flot.selection.min.js
rename to static/flot/jquery.flot.selection.min.js
diff --git a/flot/jquery.flot.stack.js b/static/flot/jquery.flot.stack.js
similarity index 100%
rename from flot/jquery.flot.stack.js
rename to static/flot/jquery.flot.stack.js
diff --git a/flot/jquery.flot.stack.min.js b/static/flot/jquery.flot.stack.min.js
similarity index 100%
rename from flot/jquery.flot.stack.min.js
rename to static/flot/jquery.flot.stack.min.js
diff --git a/flot/jquery.flot.symbol.js b/static/flot/jquery.flot.symbol.js
similarity index 100%
rename from flot/jquery.flot.symbol.js
rename to static/flot/jquery.flot.symbol.js
diff --git a/flot/jquery.flot.symbol.min.js b/static/flot/jquery.flot.symbol.min.js
similarity index 100%
rename from flot/jquery.flot.symbol.min.js
rename to static/flot/jquery.flot.symbol.min.js
diff --git a/flot/jquery.flot.threshold.js b/static/flot/jquery.flot.threshold.js
similarity index 100%
rename from flot/jquery.flot.threshold.js
rename to static/flot/jquery.flot.threshold.js
diff --git a/flot/jquery.flot.threshold.min.js b/static/flot/jquery.flot.threshold.min.js
similarity index 100%
rename from flot/jquery.flot.threshold.min.js
rename to static/flot/jquery.flot.threshold.min.js
diff --git a/flot/jquery.flot.time.js b/static/flot/jquery.flot.time.js
similarity index 100%
rename from flot/jquery.flot.time.js
rename to static/flot/jquery.flot.time.js
diff --git a/flot/jquery.flot.time.min.js b/static/flot/jquery.flot.time.min.js
similarity index 100%
rename from flot/jquery.flot.time.min.js
rename to static/flot/jquery.flot.time.min.js
diff --git a/flot/jquery.js b/static/flot/jquery.js
similarity index 100%
rename from flot/jquery.js
rename to static/flot/jquery.js
diff --git a/flot/jquery.min.js b/static/flot/jquery.min.js
similarity index 100%
rename from flot/jquery.min.js
rename to static/flot/jquery.min.js
diff --git a/static/jquery.ba-throttle-debounce.min.js b/static/jquery.ba-throttle-debounce.min.js
new file mode 100644
index 0000000..0720550
--- /dev/null
+++ b/static/jquery.ba-throttle-debounce.min.js
@@ -0,0 +1,9 @@
+/*
+ * jQuery throttle / debounce - v1.1 - 3/7/2010
+ * http://benalman.com/projects/jquery-throttle-debounce-plugin/
+ *
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);
\ No newline at end of file
diff --git a/static/main.css b/static/main.css
new file mode 100644
index 0000000..ae6d87f
--- /dev/null
+++ b/static/main.css
@@ -0,0 +1,16 @@
+html { width: 100%; height: 100%; }
+body { font-family: sans-serif; width: 100%; height: 100%; }
+#chart {
+ width: 70%;
+ height: 95%;
+ float: left;
+}
+#stacktrace {
+ float: left;
+ margin-left: 1%;
+ width: 29%;
+ font-size: 80%;
+}
+.stacktrace-line span:nth-child(1) { font-weight: bold; }
+.stacktrace-line span:nth-child(2) { margin-left: 1em; color: grey; }
+.stacktrace-line { display: block; }
diff --git a/static/main.html b/static/main.html
new file mode 100644
index 0000000..acbd920
--- /dev/null
+++ b/static/main.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/static/main.js b/static/main.js
new file mode 100644
index 0000000..f414ac0
--- /dev/null
+++ b/static/main.js
@@ -0,0 +1,75 @@
+function zoom_out()
+{
+ $.getJSON("/get_json", plot_data);
+ clicks = [];
+}
+
+function plothover(event, pos, item)
+{
+ var x = Math.ceil(pos);
+ if (item) {
+ $("#stacktrace").html(glob_data.mem[item.dataIndex][2]);
+ }
+}
+
+function format_y_axis(val, axis)
+{
+ if (val > 1024) {
+ return (val / 1024).toFixed() + " MiB";
+ }
+ return val + " KiB";
+}
+
+var lastWindow = {};
+function resample(render, plot)
+{
+ var xAxis = plot.getXAxes()[0];
+ var newWindow = {
+ x0: Math.floor(xAxis.min),
+ x1: Math.ceil(xAxis.max)
+ };
+ if (newWindow.x0 != lastWindow.x0 || newWindow.x1 != lastWindow.x1) {
+ $.getJSON("/get_json?x0=" + newWindow.x0 + "&x1=" + newWindow.x1, render);
+ lastWindow = newWindow;
+ }
+}
+
+function plot_data(data)
+{
+ glob_data = data;
+ var axesMax = {
+ x: Math.ceil(data.mem[data.mem.length-1][0]),
+ y: Math.max.apply(null, data.mem.map(function (x) { return x[1]; }))
+ };
+ var axesMargin = {
+ x: 0.05 * axesMax.x,
+ y: 0.05 * axesMax.y
+ }
+ var maxAxesWindows = {
+ x: [-axesMargin.x, axesMax.x + axesMargin.x],
+ y: [-axesMargin.y, axesMax.y + axesMargin.y],
+ };
+
+ var plotOpts = {
+ grid: {hoverable: true, clickable: true},
+ xaxis: {panRange: maxAxesWindows.x},
+ yaxis: {panRange: maxAxesWindows.y, tickFormatter: format_y_axis},
+ zoom: {interactive: true},
+ pan: {interactive: true}
+ };
+ function render(data) {
+ $.plot("#chart", [data.mem], plotOpts);
+ }
+
+ render(data);
+
+ $("#chart").bind("plothover", plothover);
+ var resampleZoom = $.debounce(10, resample);
+ var resamplePan = $.debounce(100, resample);
+ $("#chart").on("plotzoom", function (event, plot) { resampleZoom(render, plot); });
+ $("#chart").on("plotpan", function (event, plot) { resamplePan(render, plot); });
+}
+
+$(function() {
+ $.getJSON("/get_json", plot_data);
+})
diff --git a/vmemprof.py b/vmemprof.py
index e68b897..0325ec6 100644
--- a/vmemprof.py
+++ b/vmemprof.py
@@ -4,9 +4,9 @@
Run with output of vmprof run with memory profiling (like vmprof.enable(fileno, 0.01, True))
"""
+import re, os, json, sys
import vmprof
-import os, json, sys
-from flask import Flask, Response, request
+from flask import Flask, Response, request, escape
app = Flask(__name__)
if len(sys.argv) != 2:
@@ -15,15 +15,17 @@
stats = vmprof.read_profile(sys.argv[1])
-MAX = 60
+MAX_SOURCEFILE_LEN = 60
-def strip(s):
- s = s.replace("<", "<").replace(">", ">")
- l = s.split(":")
- if len(l[3]) > MAX:
- l[3] = "..." + l[3][-(MAX - 3):]
- l[1] = "" + l[1] + ""
- return "%s %s:%s" % (l[1], l[3], l[2])
+def format_stracktrace_line(line):
+ if line is None:
+ return ""
+ _, funcname, lineno, sourcefile = line.split(':')
+ sourcefile = re.sub('.*/lib/python[\d\.]+/(site-packages/)?', '', sourcefile)
+ if len(sourcefile) > MAX_SOURCEFILE_LEN:
+ sourcefile = "..." + sourcefile[-(MAX_SOURCEFILE_LEN - 3):]
+ return "%s %s:%s" \
+ % (escape(funcname), escape(sourcefile), escape(lineno))
def resample_and_pack(profiles, start, end, window_size):
next = []
@@ -32,52 +34,22 @@ def resample_and_pack(profiles, start, end, window_size):
skip = (end - start) / window_size
while i < end:
prof = profiles[int(i)]
- stack_trace = "
".join([strip(stats.adr_dict.get(x, '')) for x in prof[0]])
+ stack_trace = "".join([format_stracktrace_line(stats.adr_dict.get(x)) for x in prof[0]])
mem.append((i, prof[3], stack_trace))
i += skip
return {'mem': mem}
-def root_dir():
- return os.path.abspath(os.path.dirname(__file__))
-
-def get_file(filename): # pragma: no cover
- try:
- src = os.path.join(root_dir(), filename)
- # Figure out how flask returns static files
- # Tried:
- # - render_template
- # - send_file
- # This should not be so non-obvious
- return open(src).read()
- except IOError as exc:
- return str(exc)
-
-@app.route('/', methods=['GET'])
-def index(): # pragma: no cover
- content = get_file('main.html')
- return Response(content, mimetype="text/html")
-
@app.route('/get_json', methods=['GET'])
def get_json():
default_size = 800
- x0 = float(request.args.get("x0", "0"))
- x1 = float(request.args.get("x1", len(stats.profiles)))
- content = resample_and_pack(stats.profiles, x0, x1, default_size)
+ x0 = max(0, float(request.args.get("x0", 0)))
+ x1 = min(len(stats.profiles), float(request.args.get("x1", 'inf')))
+ content = resample_and_pack(stats.profiles, x0, x1, default_size)
return Response(json.dumps(content), mimetype="text/json")
-@app.route('/', defaults={'path': ''})
-@app.route('/')
-def get_resource(path): # pragma: no cover
- mimetypes = {
- ".css": "text/css",
- ".html": "text/html",
- ".js": "application/javascript",
- }
- complete_path = os.path.join(root_dir(), path)
- ext = os.path.splitext(path)[1]
- mimetype = mimetypes.get(ext, "text/html")
- content = get_file(complete_path)
- return Response(content, mimetype=mimetype)
+@app.route('/')
+def get_resource(): # pragma: no cover
+ return app.send_static_file('main.html')
if __name__ == '__main__':
app.run(debug=True)