Skip to content

Commit

Permalink
Use timestamps for summary graph x-axis.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonjlee committed Jul 27, 2011
1 parent 3f53308 commit e380f6a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 23 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Features:

* rps is now a separate stat from result codes
* summary graph time does not auto-update on open
* graph x-axis now use times rather than minutes since test start

## v0.3.0 (2011/06/16) ##

Expand Down
1 change: 0 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@
- Add JMX monitoring support
- Add support for bar graphs
- Methods for graphing histograms
- Timestamp graphs rather than using minutes
- Allow graphs to be overlayed
- Use agents for concurrent connections
17 changes: 4 additions & 13 deletions lib/reporting/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var NODELOAD_CONFIG = config.NODELOAD_CONFIG;
var START = NODELOAD_CONFIG.START;
var DYGRAPH_SOURCE = require('./dygraph.tpl.js').DYGRAPH_SOURCE;
}
var Chart, timeFromStart;
var Chart;

/** A Report contains a summary object and set of charts. It can be easily updated using the stats from
a monitor.js#Monitor or monitor.js#MonitorGroup using updateFromMonitor()/updateFromMonitorGroup().
Expand Down Expand Up @@ -79,7 +79,7 @@ var Chart = exports.Chart = function(name) {
this.name = name;
this.uid = util.uid();
this.columns = ["time"];
this.rows = [[timeFromStart()]];
this.rows = [[Date.now()]];
};
Chart.prototype = {
/** Put a row of data into the chart. The current time will be used as the x-value. The lines in the
Expand All @@ -93,7 +93,7 @@ Chart.prototype = {
}
*/
put: function(data) {
var self = this, row = [timeFromStart()];
var self = this, row = [Date.now()];
util.forEach(data, function(column, val) {
var col = self.columns.indexOf(column);
if (col < 0) {
Expand Down Expand Up @@ -165,13 +165,4 @@ ReportGroup.prototype = {
this.loggingTimeoutId = setTimeout(this.writeToLog_.bind(this), this.refreshIntervalMs);
this.logger.clear(this.getHtml());
}
};

// =================
// Private methods
// =================

/** current time from start of nodeload process in 100ths of a minute */
function timeFromStart() {
return (Math.floor((new Date().getTime() - START) / 600) / 100);
}
};
10 changes: 6 additions & 4 deletions lib/reporting/summary.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@
for (var j in report.charts) {
var chart = report.charts[j];
var rows = chart.rows.map(function(x) { return [new Date(x[0])].concat(x.slice(1)) });
if (graphs[chart.uid]) {
graphs[chart.uid].updateOptions({"file": chart.rows, labels: chart.columns});
graphs[chart.uid].updateOptions({"file": rows, labels: chart.columns});
} else {
var newchart = document.createElement("div");
newchart.setAttribute("class", "post");
Expand All @@ -86,11 +86,13 @@
main.appendChild(newchart);
graphs[chart.uid] = new Dygraph(
document.getElementById("chart" + chart.uid),
chart.rows,
rows,
{
labelsDiv: document.getElementById("chartlegend" + chart.uid),
labelsSeparateLines: true,
labels: chart.columns
labels: chart.columns,
xAxisLabelWidth: 80,
pixelsPerXLabel: 100
});
}
}
Expand Down
9 changes: 4 additions & 5 deletions nodeload.js

Large diffs are not rendered by default.

0 comments on commit e380f6a

Please sign in to comment.