var history = [], max, rows, measures, colors, info, fade_dur, chart_options, plot1, plot2, plot3; var initialize = function(params) { measures = params.measures colors = params.colors max = params.max rows = params.rows fade_dur = params.fade_dur info = $("#info") chart_options = { chart1: { seriesDefaults: { showMarker: false, shadow: false }, axesDefaults: { labelRenderer: $.jqplot.CanvasAxisLabelRenderer, tickRenderer: $.jqplot.CanvasAxisTickRenderer }, axes: { xaxis: { pad: 1, min: - max, tickOptions: { show: true } }, yaxis: { label:'Commands/sec', min: 0, pad: 1.2 } }, grid: { borderWidth: 0.0, borderColor: '#ddd', background: '#ffffff', shadowAlpha: 0.03 } }, chart2: { seriesDefaults: { showMarker: false, shadow: false, fill: true }, series: [ { label: "user" }, { label: "sys" } ], stackSeries: true, axesDefaults: { labelRenderer: $.jqplot.CanvasAxisLabelRenderer, tickRenderer: $.jqplot.CanvasAxisTickRenderer, shadow: false }, axes: { xaxis: { pad: 1, min: - max, tickOptions: { show: true } }, yaxis: { label:'CPU usage', min: 0, pad: 1.0 } }, legend: { show: true, location: 'se' }, grid: { borderWidth: 0.0, borderColor: '#ddd', background: '#ffffff', shadowAlpha: 0.03 } }, chart3: { seriesDefaults: { showMarker: false, shadow: false, }, series: [ { label: "mem" }, { label: "rss" } ], axesDefaults: { labelRenderer: $.jqplot.CanvasAxisLabelRenderer, tickRenderer: $.jqplot.CanvasAxisTickRenderer, shadow: false }, axes: { xaxis: { pad: 1, min: - max, tickOptions: { show: true } }, yaxis: { label:'Memory usage', min: 0, pad: 1.2, tickOptions: { formatString: "%dMB" } } }, legend: { show: true, location: 'se' }, grid: { borderWidth: 0.0, borderColor: '#ddd', background: '#ffffff', shadowAlpha: 0.03 } }, } // chart_options for (var i = 0; i < params.history.length; ++i) { appendToHistory(params.history[i]) if (params.history.length - i <= rows) updateTable() } updatePlot() } var appendToHistory = function(json) { if (history.length == 0 || json.at > history[ history.length - 1 ].at) { history.push(json) if (history.length > max) history.shift() return true } else { return false } } var updateTable = function() { var json = history[ history.length - 1 ], js = json.static, jd = json.dynamic // Instance information (mostly static) for (var stat in js) { $("#" + stat).replaceWith( "