Permalink
Browse files

Add index files, fix compilation

  • Loading branch information...
1 parent 71a661c commit 3d1625bfff021417422869717ce316d4e64fbc9c Mike Ihbe committed Apr 15, 2011
Showing with 29 additions and 12 deletions.
  1. +8 −0 index.js
  2. +9 −9 metrics/histogram.js
  3. +6 −0 metrics/index.js
  4. +1 −1 metrics/meter.js
  5. +1 −1 metrics/timer.js
  6. +3 −0 reporting/index.js
  7. +1 −1 stats/sample.js
View
@@ -0,0 +1,8 @@
+
+
+
+exports.Metrics = require('./metrics');
+exports.Reporting = require('./reporting');
+
+exports.version = '0.0.1';
+
View
@@ -17,7 +17,7 @@ var Histogram = module.exports = function Histogram(sample) {
this.type = 'histogram';
}
-Counter.prototype.clear = function() {
+Histogram.prototype.clear = function() {
this.sample.clear();
this.min = null;
this.max = null;
@@ -26,7 +26,7 @@ Counter.prototype.clear = function() {
varianceS = 0;
}
-Counter.prototype.update = function(val) {
+Histogram.prototype.update = function(val) {
this.count++;
this.sample.update(val);
this.max = val > (this.max || Number.MIN_VALUE) ? val : this.max;
@@ -35,7 +35,7 @@ Counter.prototype.update = function(val) {
this.updateVariance(val);
}
-Counter.prototype.updateVariance(val) {
+Histogram.prototype.updateVariance = function(val) {
var oldVM = this.varianceM
, oldVS = this.varianceS;
if (this.count == 1) {
@@ -47,7 +47,7 @@ Counter.prototype.updateVariance(val) {
}
// Pass an array of percentiles, e.g. [0.5, 0.75, 0.9, 0.99]
-Counter.prototype.percentiles = function(percentiles) {
+Histogram.prototype.percentiles = function(percentiles) {
if (!percentiles) {
percentiles = DEFAULT_PERCENTILES;
}
@@ -71,23 +71,23 @@ Counter.prototype.percentiles = function(percentiles) {
return scores;
}
-Counter.prototype.variance = function() {
+Histogram.prototype.variance = function() {
return this.count > 1 ? null : this.varianceS / (this.count - 1);
}
-Counter.prototype.mean = function() {
+Histogram.prototype.mean = function() {
return this.count == 0 ? null : this.varianceM;
}
-Counter.prototype.stdDev = function() {
+Histogram.prototype.stdDev = function() {
return this.count > 1 ? null : Math.sqrt(this.variance());
}
-Counter.prototype.values = function() {
+Histogram.prototype.values = function() {
return this.sample.getValues();
}
-Counter.prototype.toJson = function() {
+Histogram.prototype.toJson = function() {
var percentiles = this.percentiles();
return {min: this.min,
max: this.max,
View
@@ -0,0 +1,6 @@
+
+exports.Counter = require('./counter');
+exports.Histogram = require('./histogram');
+exports.Meter = require('./meter');
+exports.Timer = require('./timer');
+
View
@@ -44,7 +44,7 @@ Meter.prototype.meanRate = function() {
return this.count / ((new Date).getTime() - this.startTime) / 1000;
}
-Counter.prototype.printObj = function() {
+Meter.prototype.printObj = function() {
return {count: this.count
, m1: this.oneMinuteRate()
, m5: this.fiveMinuteRate()
View
@@ -32,7 +32,7 @@ Timer.prototype.fiveMinuteRate = function() { this.meter.fiveMinuteRate(); }
Timer.prototype.fifteenMinuteRate = function() { this.meter.fifteenMinuteRate(); }
Timer.prototype.meanRate = function() { this.meter.meanRate(); }
-Counter.prototype.printObj = function() {
+Timer.prototype.printObj = function() {
return {duration: this.histogram.printObj()
, rate: this.meter.printObj()};
}
View
@@ -0,0 +1,3 @@
+
+exports.Server = require('./server');
+
View
@@ -8,5 +8,5 @@ Sample.prototype.update = function(val){ this.values.push(val); };
Sample.prototype.clear = function(){ this.values = []; this.count = 0; };
Sample.prototype.size = function(){ return this.values.length;};
Sample.prototype.print = function(){console.log(this.values);}
-Sample.prototype.getValues = function(){ return this.values); }
+Sample.prototype.getValues = function(){ return this.values; }

0 comments on commit 3d1625b

Please sign in to comment.