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 +6 -0
- data/README +5 -0
- data/ext/hitimes_stats.c +24 -0
- data/lib/hitimes/timer.rb +10 -0
- data/lib/hitimes/version.rb +1 -1
- data/spec/stats_spec.rb +4 -0
- data/spec/timer_spec.rb +7 -0
- data/tasks/announce.rake +2 -1
- data/tasks/config.rb +1 -1
- data/tasks/documentation.rake +2 -0
- data/tasks/rubyforge.rake +1 -0
- data/tasks/utils.rb +1 -1
- metadata +4 -2
data/HISTORY
CHANGED
data/README
CHANGED
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
|
data/lib/hitimes/version.rb
CHANGED
data/spec/stats_spec.rb
CHANGED
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
|
|
data/tasks/documentation.rake
CHANGED
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(/^(
|
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.
|
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-
|
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:
|