aggregate 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -198,6 +198,11 @@ Total |------------------------------------------------------------------| 65532
198
198
  We can see from these histograms that Ruby's rand function does a relatively good
199
199
  job of distributing returned values in the requested range.
200
200
 
201
+ h2. Examples
202
+
203
+ Here's an example of a "handy timing benchmark":http://gist.github.com/187669
204
+ implemented with aggregate.
205
+
201
206
  h2. NOTES
202
207
 
203
208
  Ruby doesn't have a log2 function built into Math, so we approximate with
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ begin
6
6
  gemspec.name = "aggregate"
7
7
  gemspec.summary = "Aggregate is a Ruby class for accumulating aggregate statistics and includes histogram support"
8
8
  gemspec.description = "Aggregate is a Ruby class for accumulating aggregate statistics and includes histogram support. For a detailed README see: http://github.com/josephruscio/aggregate"
9
- gemspec.email = "jruscio@gmail.com"
9
+ gemspec.email = "joe@ruscio.org"
10
10
  gemspec.homepage = "http://github.com/josephruscio/aggregate"
11
11
  gemspec.authors = ["Joseph Ruscio"]
12
12
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -1,17 +1,17 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{aggregate}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joseph Ruscio"]
12
- s.date = %q{2009-09-13}
12
+ s.date = %q{2011-03-05}
13
13
  s.description = %q{Aggregate is a Ruby class for accumulating aggregate statistics and includes histogram support. For a detailed README see: http://github.com/josephruscio/aggregate}
14
- s.email = %q{jruscio@gmail.com}
14
+ s.email = %q{joe@ruscio.org}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
17
  "README.textile"
@@ -29,19 +29,19 @@ Gem::Specification.new do |s|
29
29
  s.homepage = %q{http://github.com/josephruscio/aggregate}
30
30
  s.rdoc_options = ["--charset=UTF-8"]
31
31
  s.require_paths = ["lib"]
32
- s.rubygems_version = %q{1.3.5}
32
+ s.rubygems_version = %q{1.4.2}
33
33
  s.summary = %q{Aggregate is a Ruby class for accumulating aggregate statistics and includes histogram support}
34
34
  s.test_files = [
35
35
  "test/ts_aggregate.rb"
36
36
  ]
37
37
 
38
38
  if s.respond_to? :specification_version then
39
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
40
39
  s.specification_version = 3
41
40
 
42
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
41
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
42
  else
44
43
  end
45
44
  else
46
45
  end
47
46
  end
47
+
@@ -2,9 +2,6 @@
2
2
  # configurable histogram for a set of given samples. Convenient for tracking
3
3
  # high throughput data.
4
4
  class Aggregate
5
- #The current average of all samples
6
- attr_reader :mean
7
-
8
5
  #The current number of samples
9
6
  attr_reader :count
10
7
 
@@ -59,6 +56,7 @@ class Aggregate
59
56
  @width = width
60
57
  else
61
58
  @low = 1
59
+ @width = nil
62
60
  @high = to_bucket(@@LOG_BUCKETS - 1)
63
61
  end
64
62
 
@@ -74,8 +72,8 @@ class Aggregate
74
72
  @min = data
75
73
  @max = data
76
74
  else
77
- @max = [data, @max].max
78
- @min = [data, @min].min
75
+ @max = data if data > @max
76
+ @min = data if data < @min
79
77
  end
80
78
 
81
79
  # Update the running info
@@ -87,6 +85,7 @@ class Aggregate
87
85
  @buckets[to_index(data)] += 1 unless outlier?(data)
88
86
  end
89
87
 
88
+ #The current average of all samples
90
89
  def mean
91
90
  @sum / @count
92
91
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aggregate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 2
10
+ version: 0.2.2
5
11
  platform: ruby
6
12
  authors:
7
13
  - Joseph Ruscio
@@ -9,12 +15,12 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-09-13 00:00:00 -07:00
18
+ date: 2011-03-05 00:00:00 -08:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
16
22
  description: "Aggregate is a Ruby class for accumulating aggregate statistics and includes histogram support. For a detailed README see: http://github.com/josephruscio/aggregate"
17
- email: jruscio@gmail.com
23
+ email: joe@ruscio.org
18
24
  executables: []
19
25
 
20
26
  extensions: []
@@ -23,7 +29,6 @@ extra_rdoc_files:
23
29
  - LICENSE
24
30
  - README.textile
25
31
  files:
26
- - .gitignore
27
32
  - LICENSE
28
33
  - README.textile
29
34
  - Rakefile
@@ -36,26 +41,32 @@ homepage: http://github.com/josephruscio/aggregate
36
41
  licenses: []
37
42
 
38
43
  post_install_message:
39
- rdoc_options:
40
- - --charset=UTF-8
44
+ rdoc_options: []
45
+
41
46
  require_paths:
42
47
  - lib
43
48
  required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ">="
46
52
  - !ruby/object:Gem::Version
53
+ hash: 3
54
+ segments:
55
+ - 0
47
56
  version: "0"
48
- version:
49
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
+ none: false
50
59
  requirements:
51
60
  - - ">="
52
61
  - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
53
65
  version: "0"
54
- version:
55
66
  requirements: []
56
67
 
57
68
  rubyforge_project:
58
- rubygems_version: 1.3.5
69
+ rubygems_version: 1.4.2
59
70
  signing_key:
60
71
  specification_version: 3
61
72
  summary: Aggregate is a Ruby class for accumulating aggregate statistics and includes histogram support
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- pkg/