hitimes 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,4 +1,10 @@
1
1
  = Changelog
2
+
3
+ == Version 0.2.1
4
+
5
+ * added Timer#rate method
6
+ * switched to darkfish rdoc
7
+
2
8
  == Version 0.2.0
3
9
 
4
10
  * Performance improvements
data/README CHANGED
@@ -47,6 +47,11 @@ Use a Hitimes::Timer to calculate statistics about an iterative operation
47
47
  puts timer.min
48
48
  puts timer.stddev
49
49
 
50
+
51
+ == CHANGES
52
+
53
+ Read the HISTORY file.
54
+
50
55
  == CREDITS
51
56
 
52
57
  * Bruce Williams for suggesting the idea
data/ext/hitimes_stats.c CHANGED
@@ -86,6 +86,29 @@ VALUE hitimes_stats_mean( VALUE self )
86
86
  return rb_float_new( mean );
87
87
  }
88
88
 
89
+
90
+ /**
91
+ * call-seq:
92
+ * stat.rate -> Float
93
+ *
94
+ * Return the count per seconds ( rate ) rate stat. If no values have passed
95
+ * through the stats object then 0.0 is returned.
96
+ */
97
+ VALUE hitimes_stats_rate( VALUE self )
98
+ {
99
+ hitimes_stats_t *stats;
100
+ double rate = 0.0;
101
+
102
+ Data_Get_Struct( self, hitimes_stats_t, stats );
103
+
104
+ if ( stats->sum > 0.0 ) {
105
+ rate = stats->count / stats->sum;
106
+ }
107
+
108
+ return rb_float_new( rate );
109
+ }
110
+
111
+
89
112
  /**
90
113
  * call-seq:
91
114
  * stat.max -> Float
@@ -208,6 +231,7 @@ void Init_hitimes_stats()
208
231
 
209
232
  rb_define_method( cH_Stats, "update", hitimes_stats_update, 1 ); /* in hitimes_stats.c */
210
233
  rb_define_method( cH_Stats, "mean", hitimes_stats_mean, 0 ); /* in hitimes_stats.c */
234
+ rb_define_method( cH_Stats, "rate", hitimes_stats_rate, 0 ); /* in hitimes_stats.c */
211
235
  rb_define_method( cH_Stats, "max", hitimes_stats_max, 0 ); /* in hitimes_stats.c */
212
236
  rb_define_method( cH_Stats, "min", hitimes_stats_min, 0 ); /* in hitimes_stats.c */
213
237
  rb_define_method( cH_Stats, "count", hitimes_stats_count, 0 ); /* in hitimes_stats.c */
data/lib/hitimes/timer.rb CHANGED
@@ -170,6 +170,16 @@ module Hitimes
170
170
  stats.mean
171
171
  end
172
172
 
173
+ #
174
+ # :call-seq:
175
+ # timer.rate -> Float
176
+ #
177
+ # Return the rate of the states, which is the count / duration
178
+ #
179
+ def rate
180
+ stats.rate
181
+ end
182
+
173
183
  #
174
184
  # :call-seq:
175
185
  # timer.stddev -> Float
@@ -11,7 +11,7 @@ module Hitimes
11
11
 
12
12
  MAJOR = 0
13
13
  MINOR = 2
14
- BUILD = 0
14
+ BUILD = 1
15
15
 
16
16
  #
17
17
  # :call-seq:
data/spec/stats_spec.rb CHANGED
@@ -21,6 +21,10 @@ describe Hitimes::Stats do
21
21
  @full_stats.mean.should == 2.0
22
22
  end
23
23
 
24
+ it "calculates the rate correctly" do
25
+ @full_stats.rate.should == 0.5
26
+ end
27
+
24
28
  it "tracks the maximum value" do
25
29
  @full_stats.max.should == 3.0
26
30
  end
data/spec/timer_spec.rb CHANGED
@@ -50,6 +50,13 @@ describe Hitimes::Timer do
50
50
  t.mean.should > 0.04
51
51
  end
52
52
 
53
+ it "calculates the rate of the counts " do
54
+ t = Hitimes::Timer.new
55
+ 5.times { t.start ; sleep 0.05 ; t.stop }
56
+ t.rate.should > 19.0
57
+ end
58
+
59
+
53
60
  it "calculates the stddev of the durations" do
54
61
  t = Hitimes::Timer.new
55
62
  2.times { t.start ; sleep 0.05 ; t.stop }
data/tasks/announce.rake CHANGED
@@ -16,6 +16,8 @@ namespace :announce do
16
16
  mail.puts "Subject: [ANN] #{info[:subject]}"
17
17
  mail.puts
18
18
  mail.puts info[:title]
19
+ mail.puts
20
+ mail.puts " gem install #{Hitimes::GEM_SPEC.name}"
19
21
  mail.puts
20
22
  mail.puts info[:urls]
21
23
  mail.puts
@@ -25,7 +27,6 @@ namespace :announce do
25
27
  mail.puts
26
28
  mail.puts info[:release_notes]
27
29
  mail.puts
28
- mail.puts info[:urls]
29
30
  end
30
31
  puts "Created the following as email.txt:"
31
32
  puts "-" * 72
data/tasks/config.rb CHANGED
@@ -83,7 +83,7 @@ Configuration.for('rdoc') {
83
83
  files Configuration.for('packaging').files.rdoc
84
84
  main_page files.first
85
85
  title Configuration.for('project').name
86
- options %w[ --line-numbers --inline-source ]
86
+ options %w[ --line-numbers --inline-source -f darkfish ]
87
87
  output_dir "doc"
88
88
  }
89
89
 
@@ -9,6 +9,8 @@ if rdoc_config = Configuration.for_if_exist?('rdoc') then
9
9
  namespace :doc do
10
10
 
11
11
  require 'rake/rdoctask'
12
+ gem 'darkfish-rdoc'
13
+ require 'darkfish-rdoc'
12
14
 
13
15
  # generating documentation locally
14
16
  Rake::RDocTask.new do |rdoc|
data/tasks/rubyforge.rake CHANGED
@@ -42,6 +42,7 @@ if rf_conf = Configuration.for_if_exist?("rubyforge") then
42
42
  task :rubyforge do
43
43
  info = Utils.announcement
44
44
  rubyforge = RubyForge.new
45
+ rubyforge.configure
45
46
  rubyforge.login
46
47
  rubyforge.post_news(rf_conf.project, info[:subject], "#{info[:title]}\n\n#{info[:urls]}\n\n#{info[:release_notes]}")
47
48
  puts "Posted to rubyforge"
data/tasks/utils.rb CHANGED
@@ -54,7 +54,7 @@ module Utils
54
54
  #
55
55
  def release_notes_from(history_file)
56
56
  releases = {}
57
- File.read(history_file).split(/^(?==)/).each do |section|
57
+ File.read(history_file).split(/^(?=== Version)/).each do |section|
58
58
  lines = section.split("\n")
59
59
  md = %r{Version ((\w+\.)+\w+)}.match(lines.first)
60
60
  next unless md
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hitimes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Hinegardner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-14 00:00:00 -06:00
12
+ date: 2008-09-28 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -103,6 +103,8 @@ post_install_message:
103
103
  rdoc_options:
104
104
  - --line-numbers
105
105
  - --inline-source
106
+ - -f
107
+ - darkfish
106
108
  - --main
107
109
  - README
108
110
  require_paths: