hitimes 1.2.1-java → 1.2.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +11 -0
- data/HISTORY.md +5 -0
- data/Manifest.txt +1 -0
- data/Rakefile +6 -4
- data/ext/hitimes/c/extconf.rb +7 -0
- data/lib/hitimes/hitimes.jar +0 -0
- data/lib/hitimes/version.rb +1 -1
- data/spec/hitimes_spec.rb +2 -2
- data/spec/interval_spec.rb +33 -33
- data/spec/metric_spec.rb +7 -7
- data/spec/mutex_stats_spec.rb +3 -3
- data/spec/paths_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -1
- data/spec/stats_spec.rb +27 -27
- data/spec/timed_metric_spec.rb +37 -37
- data/spec/timed_value_metric_spec.rb +49 -49
- data/spec/value_metric_spec.rb +25 -25
- data/spec/version_spec.rb +1 -1
- data/tasks/default.rake +13 -8
- data/tasks/this.rb +8 -3
- metadata +34 -46
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d94ad885b546cfabd2429bb32edb587cb5bdffce
|
4
|
+
data.tar.gz: 83cc096240320c96147dc18f9305345a14e64e87
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bd6ffe724b229edd4ccd3d2a348a9696e1d50d4dc732c49e5d0414e61b17598bb361ccf65b5186f45add3832bc4524e136ab05ca8396090fc4671d0728c469d5
|
7
|
+
data.tar.gz: fb95561d1d465d57faa6325df9fa0eafba5779a4eae813c8ada010673071edf60a08c8b27d9a01d29da03138ac56414cb08868f770ad5b46bc4dad5b80c8f38d
|
data/.travis.yml
ADDED
data/HISTORY.md
CHANGED
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -7,17 +7,19 @@ This.email = "jeremy@copiousfreetime.org"
|
|
7
7
|
This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
|
8
8
|
|
9
9
|
This.ruby_gemspec do |spec|
|
10
|
-
spec.add_development_dependency( 'rake' , '~> 10.0
|
11
|
-
spec.add_development_dependency( '
|
12
|
-
spec.add_development_dependency( 'rdoc' , '~> 4.
|
10
|
+
spec.add_development_dependency( 'rake' , '~> 10.0')
|
11
|
+
spec.add_development_dependency( 'minitest' , '~> 5.3' )
|
12
|
+
spec.add_development_dependency( 'rdoc' , '~> 4.1' )
|
13
13
|
spec.add_development_dependency( 'json' , '~> 1.7.7' )
|
14
|
-
spec.add_development_dependency( 'rake-compiler', '~> 0.
|
14
|
+
spec.add_development_dependency( 'rake-compiler', '~> 0.9' )
|
15
15
|
|
16
16
|
spec.extensions.concat This.extension_conf_files
|
17
|
+
spec.license = "ISC"
|
17
18
|
end
|
18
19
|
|
19
20
|
This.java_gemspec( This.ruby_gemspec ) do |spec|
|
20
21
|
spec.extensions.clear
|
22
|
+
spec.files << "lib/hitimes/hitimes.jar"
|
21
23
|
end
|
22
24
|
|
23
25
|
load 'tasks/default.rake'
|
data/ext/hitimes/c/extconf.rb
CHANGED
@@ -9,6 +9,13 @@ elsif RbConfig::CONFIG['host_os'] =~ /win32/ or RbConfig::CONFIG['host_os'] =~ /
|
|
9
9
|
else
|
10
10
|
if have_library("rt", "clock_gettime") then
|
11
11
|
$CFLAGS += " -DUSE_INSTANT_CLOCK_GETTIME=1"
|
12
|
+
elsif have_library("c", "clock_gettime") then
|
13
|
+
$CFLAGS += " -DUSE_INSTANT_CLOCK_GETTIME=1"
|
14
|
+
else
|
15
|
+
raise NotImplementedError, <<-_
|
16
|
+
Unable to find the function 'clock_gettime' in either libc or librt.
|
17
|
+
Please file an issue at https://github.com/copiousfreetime/hitimes.
|
18
|
+
_
|
12
19
|
end
|
13
20
|
end
|
14
21
|
|
data/lib/hitimes/hitimes.jar
CHANGED
Binary file
|
data/lib/hitimes/version.rb
CHANGED
data/spec/hitimes_spec.rb
CHANGED
@@ -5,10 +5,10 @@ describe Hitimes do
|
|
5
5
|
d = Hitimes.measure do
|
6
6
|
sleep 0.2
|
7
7
|
end
|
8
|
-
d.
|
8
|
+
d.must_be_close_to(0.2, 0.002)
|
9
9
|
end
|
10
10
|
|
11
11
|
it "raises an error if measure is called with no block" do
|
12
|
-
lambda{ Hitimes.measure }.
|
12
|
+
lambda{ Hitimes.measure }.must_raise( Hitimes::Error )
|
13
13
|
end
|
14
14
|
end
|
data/spec/interval_spec.rb
CHANGED
@@ -3,54 +3,54 @@ require "spec_helper"
|
|
3
3
|
describe Hitimes::Interval do
|
4
4
|
it "raises an error if duration is called on a non-started interval" do
|
5
5
|
i = Hitimes::Interval.new
|
6
|
-
lambda{ i.duration }.
|
6
|
+
lambda{ i.duration }.must_raise( Hitimes::Error, /\AAttempt to report a duration on an interval that has not started\Z/ )
|
7
7
|
end
|
8
8
|
|
9
9
|
it "raises an error if stop is called on a non-started interval" do
|
10
10
|
i = Hitimes::Interval.new
|
11
|
-
lambda { i.stop }.
|
11
|
+
lambda { i.stop }.must_raise( Hitimes::Error, /\AAttempt to stop an interval that has not started\Z/ )
|
12
12
|
end
|
13
13
|
|
14
14
|
it "knows if it has been started" do
|
15
15
|
i = Hitimes::Interval.new
|
16
|
-
i.
|
16
|
+
i.started?.must_equal false
|
17
17
|
|
18
18
|
i.start
|
19
|
-
i.
|
19
|
+
i.started?.must_equal true
|
20
20
|
end
|
21
21
|
|
22
22
|
it "knows if it has been stopped" do
|
23
23
|
i = Hitimes::Interval.new
|
24
24
|
i.start
|
25
|
-
i.
|
25
|
+
i.stopped?.must_equal false
|
26
26
|
i.stop
|
27
|
-
i.
|
27
|
+
i.stopped?.must_equal true
|
28
28
|
end
|
29
29
|
|
30
30
|
it "knows if it is currently running" do
|
31
31
|
i = Hitimes::Interval.new
|
32
|
-
i.
|
32
|
+
i.running?.must_equal false
|
33
33
|
i.start
|
34
|
-
i.
|
34
|
+
i.running?.must_equal true
|
35
35
|
i.stop
|
36
|
-
i.
|
36
|
+
i.running?.must_equal false
|
37
37
|
end
|
38
38
|
|
39
39
|
it "can time a block of code" do
|
40
40
|
d = Hitimes::Interval.measure do
|
41
41
|
sleep 0.2
|
42
42
|
end
|
43
|
-
d.
|
43
|
+
d.must_be_close_to(0.2, 0.002)
|
44
44
|
end
|
45
45
|
|
46
46
|
it "raises an error if measure is called with no block" do
|
47
|
-
lambda{ Hitimes::Interval.measure }.
|
47
|
+
lambda{ Hitimes::Interval.measure }.must_raise( Hitimes::Error, /\ANo block given to Interval.measure\Z/ )
|
48
48
|
end
|
49
49
|
|
50
50
|
it "creates an interval via #now" do
|
51
51
|
i = Hitimes::Interval.now
|
52
|
-
i.
|
53
|
-
i.
|
52
|
+
i.started?.must_equal true
|
53
|
+
i.stopped?.must_equal false
|
54
54
|
end
|
55
55
|
|
56
56
|
it "calling duration multiple times returns successivly grater durations" do
|
@@ -58,33 +58,33 @@ describe Hitimes::Interval do
|
|
58
58
|
i.start
|
59
59
|
y = i.duration
|
60
60
|
z = i.duration
|
61
|
-
z.
|
61
|
+
z.must_be :>, y
|
62
62
|
end
|
63
63
|
|
64
64
|
it "calling start multiple times on has no effect after the first call" do
|
65
65
|
i = Hitimes::Interval.new
|
66
|
-
i.start.
|
66
|
+
i.start.must_equal true
|
67
67
|
x = i.start_instant
|
68
|
-
i.start_instant.
|
69
|
-
i.start.
|
70
|
-
x.
|
68
|
+
i.start_instant.must_be :>, 0
|
69
|
+
i.start.must_equal false
|
70
|
+
x.must_equal i.start_instant
|
71
71
|
end
|
72
72
|
|
73
73
|
it "returns the duration on the first call to stop" do
|
74
74
|
i = Hitimes::Interval.now
|
75
75
|
d = i.stop
|
76
|
-
d.
|
76
|
+
d.must_be_instance_of( Float )
|
77
77
|
end
|
78
78
|
|
79
79
|
it "calling stop multiple times on has no effect after the first call" do
|
80
80
|
i = Hitimes::Interval.new
|
81
|
-
i.start.
|
81
|
+
i.start.must_equal true
|
82
82
|
i.stop
|
83
83
|
|
84
84
|
x = i.stop_instant
|
85
|
-
i.stop_instant.
|
86
|
-
i.stop.
|
87
|
-
x.
|
85
|
+
i.stop_instant.must_be :>, 0
|
86
|
+
i.stop.must_equal false
|
87
|
+
x.must_equal i.stop_instant
|
88
88
|
|
89
89
|
end
|
90
90
|
|
@@ -93,26 +93,26 @@ describe Hitimes::Interval do
|
|
93
93
|
i.start
|
94
94
|
x = i.stop
|
95
95
|
y = i.duration
|
96
|
-
i.stop.
|
96
|
+
i.stop.must_equal false
|
97
97
|
|
98
98
|
z = i.duration
|
99
99
|
|
100
|
-
x.
|
101
|
-
x.
|
100
|
+
x.must_equal y
|
101
|
+
x.must_equal z
|
102
102
|
|
103
|
-
y.
|
103
|
+
y.must_equal z
|
104
104
|
end
|
105
105
|
|
106
106
|
it "can return how much time has elapsed from the start without stopping the interval" do
|
107
107
|
i = Hitimes::Interval.new
|
108
108
|
i.start
|
109
109
|
x = i.duration_so_far
|
110
|
-
i.
|
110
|
+
i.running?.must_equal true
|
111
111
|
y = i.duration_so_far
|
112
112
|
i.stop
|
113
|
-
x.
|
114
|
-
x.
|
115
|
-
y.
|
113
|
+
x.must_be :<, y
|
114
|
+
x.must_be :<, i.duration
|
115
|
+
y.must_be :<, i.duration
|
116
116
|
end
|
117
117
|
|
118
118
|
describe "#split" do
|
@@ -121,14 +121,14 @@ describe Hitimes::Interval do
|
|
121
121
|
i = Hitimes::Interval.new
|
122
122
|
i.start
|
123
123
|
i2 = i.split
|
124
|
-
i.object_id.
|
124
|
+
i.object_id.wont_equal i2.object_id
|
125
125
|
end
|
126
126
|
|
127
127
|
it "with the stop instant equivialent to the previous Interval's start instant" do
|
128
128
|
i = Hitimes::Interval.new
|
129
129
|
i.start
|
130
130
|
i2 = i.split
|
131
|
-
i.stop_instant.
|
131
|
+
i.stop_instant.must_equal i2.start_instant
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
data/spec/metric_spec.rb
CHANGED
@@ -6,22 +6,22 @@ describe Hitimes::Metric do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'has a name' do
|
9
|
-
@metric.name.
|
9
|
+
@metric.name.must_equal "testing"
|
10
10
|
end
|
11
11
|
|
12
12
|
it "has associated data from initialization" do
|
13
13
|
m = Hitimes::Metric.new( "more-data", 'foo' => 'bar', 'this' => 'that' )
|
14
|
-
m.additional_data['foo'].
|
15
|
-
m.additional_data['this'].
|
14
|
+
m.additional_data['foo'].must_equal 'bar'
|
15
|
+
m.additional_data['this'].must_equal 'that'
|
16
16
|
|
17
17
|
m = Hitimes::Metric.new( "more-data", { 'foo' => 'bar', 'this' => 'that' } )
|
18
|
-
m.additional_data['foo'].
|
19
|
-
m.additional_data['this'].
|
18
|
+
m.additional_data['foo'].must_equal 'bar'
|
19
|
+
m.additional_data['this'].must_equal 'that'
|
20
20
|
end
|
21
21
|
|
22
22
|
it "initially has no sampling times" do
|
23
|
-
@metric.sampling_start_time.
|
24
|
-
@metric.sampling_stop_time.
|
23
|
+
@metric.sampling_start_time.must_be_nil
|
24
|
+
@metric.sampling_stop_time.must_be_nil
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
data/spec/mutex_stats_spec.rb
CHANGED
@@ -19,18 +19,18 @@ describe Hitimes::MutexedStats do
|
|
19
19
|
if (not defined? RUBY_ENGINE) or (RUBY_ENGINE == "ruby") then
|
20
20
|
it "Hitimes::Stats is threadsafe" do
|
21
21
|
stats = run_with_scissors( ::Hitimes::Stats.new, @threads, @iters )
|
22
|
-
stats.count.
|
22
|
+
stats.count.must_equal @final_value
|
23
23
|
end
|
24
24
|
else
|
25
25
|
it "Hitimes::Stats is not threadsafe" do
|
26
26
|
stats = run_with_scissors( ::Hitimes::Stats.new, @threads, @iters )
|
27
|
-
stats.count.
|
27
|
+
stats.count.wont_equal @final_value
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
it "has a threadsafe update" do
|
32
32
|
stats = run_with_scissors( ::Hitimes::MutexedStats.new, @threads, @iters )
|
33
|
-
stats.count.
|
33
|
+
stats.count.must_equal @final_value
|
34
34
|
end
|
35
35
|
|
36
36
|
end
|
data/spec/paths_spec.rb
CHANGED
@@ -2,10 +2,10 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Hitimes::Paths do
|
4
4
|
it "can access the root dir of the project" do
|
5
|
-
Hitimes::Paths.root_dir.
|
5
|
+
Hitimes::Paths.root_dir.must_equal File.expand_path( File.join( File.dirname( __FILE__ ), ".." ) ) + ::File::SEPARATOR
|
6
6
|
end
|
7
7
|
|
8
8
|
it "can access the lib path of the project" do
|
9
|
-
Hitimes::Paths.lib_path.
|
9
|
+
Hitimes::Paths.lib_path.must_equal File.expand_path( File.join( File.dirname( __FILE__ ), "..", "lib" ) ) + ::File::SEPARATOR
|
10
10
|
end
|
11
11
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/stats_spec.rb
CHANGED
@@ -10,64 +10,64 @@ describe Hitimes::Stats do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "is initialized with 0 values" do
|
13
|
-
@stats.count.
|
14
|
-
@stats.min.
|
15
|
-
@stats.max.
|
16
|
-
@stats.sum.
|
17
|
-
@stats.rate.
|
13
|
+
@stats.count.must_equal 0
|
14
|
+
@stats.min.must_equal 0.0
|
15
|
+
@stats.max.must_equal 0.0
|
16
|
+
@stats.sum.must_equal 0.0
|
17
|
+
@stats.rate.must_equal 0.0
|
18
18
|
end
|
19
19
|
|
20
20
|
it "calculates the mean correctly" do
|
21
|
-
@full_stats.mean.
|
21
|
+
@full_stats.mean.must_equal 2.0
|
22
22
|
end
|
23
23
|
|
24
24
|
it "calculates the rate correctly" do
|
25
|
-
@full_stats.rate.
|
25
|
+
@full_stats.rate.must_equal 0.5
|
26
26
|
end
|
27
27
|
|
28
28
|
it "tracks the maximum value" do
|
29
|
-
@full_stats.max.
|
29
|
+
@full_stats.max.must_equal 3.0
|
30
30
|
end
|
31
31
|
|
32
32
|
it "tracks the minimum value" do
|
33
|
-
@full_stats.min.
|
33
|
+
@full_stats.min.must_equal 1.0
|
34
34
|
end
|
35
35
|
|
36
36
|
it "tracks the count" do
|
37
|
-
@full_stats.count.
|
37
|
+
@full_stats.count.must_equal 3
|
38
38
|
end
|
39
39
|
|
40
40
|
it "tracks the sum" do
|
41
|
-
@full_stats.sum.
|
41
|
+
@full_stats.sum.must_equal 6.0
|
42
42
|
end
|
43
43
|
|
44
44
|
it "calculates the standard deviation" do
|
45
|
-
@full_stats.stddev.
|
45
|
+
@full_stats.stddev.must_equal 1.0
|
46
46
|
end
|
47
47
|
|
48
48
|
it "calculates the sum of squares " do
|
49
|
-
@full_stats.sumsq.
|
49
|
+
@full_stats.sumsq.must_equal 14.0
|
50
50
|
end
|
51
51
|
|
52
52
|
describe "#to_hash " do
|
53
53
|
it "converts to a Hash" do
|
54
54
|
h = @full_stats.to_hash
|
55
|
-
h.size.
|
56
|
-
h.keys.sort.
|
55
|
+
h.size.must_equal ::Hitimes::Stats::STATS.size
|
56
|
+
h.keys.sort.must_equal ::Hitimes::Stats::STATS
|
57
57
|
end
|
58
58
|
|
59
59
|
it "converts to a limited Hash if given arguments" do
|
60
60
|
h = @full_stats.to_hash( "min", "max", "mean" )
|
61
|
-
h.size.
|
62
|
-
h.keys.sort.
|
61
|
+
h.size.must_equal 3
|
62
|
+
h.keys.sort.must_equal %w[ max mean min ]
|
63
63
|
|
64
64
|
h = @full_stats.to_hash( %w[ count rate ] )
|
65
|
-
h.size.
|
66
|
-
h.keys.sort.
|
65
|
+
h.size.must_equal 2
|
66
|
+
h.keys.sort.must_equal %w[ count rate ]
|
67
67
|
end
|
68
68
|
|
69
69
|
it "raises NoMethodError if an invalid stat is used" do
|
70
|
-
lambda { @full_stats.to_hash( "wibble" ) }.
|
70
|
+
lambda { @full_stats.to_hash( "wibble" ) }.must_raise( NoMethodError )
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -75,24 +75,24 @@ describe Hitimes::Stats do
|
|
75
75
|
it "converts to a json string" do
|
76
76
|
j = @full_stats.to_json
|
77
77
|
h = JSON.parse( j )
|
78
|
-
h.size.
|
79
|
-
h.keys.sort.
|
78
|
+
h.size.must_equal ::Hitimes::Stats::STATS.size
|
79
|
+
h.keys.sort.must_equal ::Hitimes::Stats::STATS
|
80
80
|
end
|
81
81
|
|
82
82
|
it "converts to a limited Hash if given arguments" do
|
83
83
|
j = @full_stats.to_json( "min", "max", "mean" )
|
84
84
|
h = JSON.parse( j )
|
85
|
-
h.size.
|
86
|
-
h.keys.sort.
|
85
|
+
h.size.must_equal 3
|
86
|
+
h.keys.sort.must_equal %w[ max mean min ]
|
87
87
|
|
88
88
|
j = @full_stats.to_json( %w[ count rate ] )
|
89
89
|
h = JSON.parse( j )
|
90
|
-
h.size.
|
91
|
-
h.keys.sort.
|
90
|
+
h.size.must_equal 2
|
91
|
+
h.keys.sort.must_equal %w[ count rate ]
|
92
92
|
end
|
93
93
|
|
94
94
|
it "raises NoMethodError if an invalid stat is used" do
|
95
|
-
lambda { @full_stats.to_json( "wibble" ) }.
|
95
|
+
lambda { @full_stats.to_json( "wibble" ) }.must_raise( NoMethodError )
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
data/spec/timed_metric_spec.rb
CHANGED
@@ -6,90 +6,90 @@ describe Hitimes::TimedMetric do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it "knows if it is running or not" do
|
9
|
-
@tm.
|
9
|
+
@tm.running?.must_equal false
|
10
10
|
@tm.start
|
11
|
-
@tm.
|
11
|
+
@tm.running?.must_equal true
|
12
12
|
@tm.stop
|
13
|
-
@tm.
|
13
|
+
@tm.running?.must_equal false
|
14
14
|
end
|
15
15
|
|
16
16
|
it "#split returns the last duration and the timer is still running" do
|
17
17
|
@tm.start
|
18
18
|
d = @tm.split
|
19
|
-
@tm.
|
20
|
-
d.
|
21
|
-
@tm.count.
|
22
|
-
@tm.duration.
|
19
|
+
@tm.running?.must_equal true
|
20
|
+
d.must_be :>, 0
|
21
|
+
@tm.count.must_equal 1
|
22
|
+
@tm.duration.must_equal d
|
23
23
|
end
|
24
24
|
|
25
25
|
it "#stop returns false if called more than once in a row" do
|
26
26
|
@tm.start
|
27
|
-
@tm.stop.
|
28
|
-
@tm.stop.
|
27
|
+
@tm.stop.must_be :>, 0
|
28
|
+
@tm.stop.must_equal false
|
29
29
|
end
|
30
30
|
|
31
31
|
it "does not count a currently running interval as an interval in calculations" do
|
32
32
|
@tm.start
|
33
|
-
@tm.count.
|
33
|
+
@tm.count.must_equal 0
|
34
34
|
@tm.split
|
35
|
-
@tm.count.
|
35
|
+
@tm.count.must_equal 1
|
36
36
|
end
|
37
37
|
|
38
38
|
it "#split called on a stopped timer does nothing" do
|
39
39
|
@tm.start
|
40
40
|
@tm.stop
|
41
|
-
@tm.split.
|
41
|
+
@tm.split.must_equal false
|
42
42
|
end
|
43
43
|
|
44
44
|
it "calculates the mean of the durations" do
|
45
45
|
2.times { @tm.start ; sleep 0.05 ; @tm.stop }
|
46
|
-
@tm.mean.
|
46
|
+
@tm.mean.must_be_close_to(0.05, 0.002)
|
47
47
|
end
|
48
48
|
|
49
49
|
it "calculates the rate of the counts " do
|
50
50
|
5.times { @tm.start ; sleep 0.05 ; @tm.stop }
|
51
|
-
@tm.rate.
|
51
|
+
@tm.rate.must_be_close_to(20.00, 0.5)
|
52
52
|
end
|
53
53
|
|
54
54
|
|
55
55
|
it "calculates the stddev of the durations" do
|
56
56
|
3.times { |x| @tm.start ; sleep(0.05 * x) ; @tm.stop }
|
57
|
-
@tm.stddev.
|
57
|
+
@tm.stddev.must_be_close_to(0.05)
|
58
58
|
end
|
59
59
|
|
60
60
|
it "returns 0.0 for stddev if there is no data" do
|
61
|
-
@tm.stddev.
|
61
|
+
@tm.stddev.must_equal 0.0
|
62
62
|
end
|
63
63
|
|
64
64
|
it "keeps track of the min value" do
|
65
65
|
2.times { @tm.start ; sleep 0.05 ; @tm.stop }
|
66
|
-
@tm.min.
|
66
|
+
@tm.min.must_be_close_to(0.05, 0.01)
|
67
67
|
end
|
68
68
|
|
69
69
|
it "keeps track of the max value" do
|
70
70
|
2.times { @tm.start ; sleep 0.05 ; @tm.stop }
|
71
|
-
@tm.max.
|
71
|
+
@tm.max.must_be_close_to(0.05, 0.01)
|
72
72
|
end
|
73
73
|
|
74
74
|
it "keeps track of the sum value" do
|
75
75
|
2.times { @tm.start ; sleep 0.05 ; @tm.stop }
|
76
|
-
@tm.sum.
|
76
|
+
@tm.sum.must_be_close_to(0.10, 0.01)
|
77
77
|
end
|
78
78
|
|
79
79
|
it "keeps track of the sum of squars value" do
|
80
80
|
3.times { @tm.start ; sleep 0.05 ; @tm.stop }
|
81
|
-
@tm.sumsq.
|
81
|
+
@tm.sumsq.must_be_close_to(0.0075)
|
82
82
|
end
|
83
83
|
|
84
84
|
it "keeps track of the minimum start time of all the intervals" do
|
85
85
|
f1 = Time.now.gmtime.to_f * 1_000_000
|
86
86
|
5.times { @tm.start ; sleep 0.05 ; @tm.stop }
|
87
87
|
f2 = Time.now.gmtime.to_f * 1_000_000
|
88
|
-
@tm.sampling_start_time.
|
89
|
-
@tm.sampling_start_time.
|
88
|
+
@tm.sampling_start_time.must_be :>=, f1
|
89
|
+
@tm.sampling_start_time.must_be :<, f2
|
90
90
|
# distance from now to start time should be greater than the distance from
|
91
91
|
# the start to the min start_time
|
92
|
-
(f2 - @tm.sampling_start_time).
|
92
|
+
(f2 - @tm.sampling_start_time).must_be :>, ( @tm.sampling_start_time - f1 )
|
93
93
|
end
|
94
94
|
|
95
95
|
it "keeps track of the last stop time of all the intervals" do
|
@@ -98,57 +98,57 @@ describe Hitimes::TimedMetric do
|
|
98
98
|
5.times { @tm.start ; sleep 0.05 ; @tm.stop }
|
99
99
|
sleep 0.01
|
100
100
|
f2 = Time.now.gmtime.to_f * 1_000_000
|
101
|
-
@tm.sampling_stop_time.
|
102
|
-
@tm.sampling_stop_time.
|
101
|
+
@tm.sampling_stop_time.must_be :>, f1
|
102
|
+
@tm.sampling_stop_time.must_be :<=, f2
|
103
103
|
# distance from now to max stop time time should be less than the distance
|
104
104
|
# from the start to the max stop time
|
105
|
-
(f2 - @tm.sampling_stop_time).
|
105
|
+
(f2 - @tm.sampling_stop_time).must_be :<, ( @tm.sampling_stop_time - f1 )
|
106
106
|
end
|
107
107
|
|
108
108
|
it "can create an already running timer" do
|
109
109
|
t = Hitimes::TimedMetric.now( 'already-running' )
|
110
|
-
t.
|
110
|
+
t.running?.must_equal true
|
111
111
|
end
|
112
112
|
|
113
113
|
it "can measure a block of code from an instance" do
|
114
114
|
t = Hitimes::TimedMetric.new( 'measure a block' )
|
115
115
|
3.times { t.measure { sleep 0.05 } }
|
116
|
-
t.duration.
|
117
|
-
t.count.
|
116
|
+
t.duration.must_be_close_to(0.15, 0.01)
|
117
|
+
t.count.must_equal 3
|
118
118
|
end
|
119
119
|
|
120
120
|
it "returns the value of the block when measuring" do
|
121
121
|
t = Hitimes::TimedMetric.new( 'measure a block' )
|
122
122
|
x = t.measure { sleep 0.05; 42 }
|
123
|
-
t.duration.
|
124
|
-
x.
|
123
|
+
t.duration.must_be_close_to(0.05, 0.002)
|
124
|
+
x.must_equal 42
|
125
125
|
end
|
126
126
|
|
127
127
|
describe "#to_hash" do
|
128
128
|
|
129
129
|
it "has name value" do
|
130
130
|
h = @tm.to_hash
|
131
|
-
h['name'].
|
131
|
+
h['name'].must_equal "test-timed-metric"
|
132
132
|
end
|
133
133
|
|
134
134
|
it "has an empty hash for additional_data" do
|
135
135
|
h = @tm.to_hash
|
136
|
-
h['additional_data'].
|
137
|
-
h['additional_data'].size.
|
136
|
+
h['additional_data'].must_equal Hash.new
|
137
|
+
h['additional_data'].size.must_equal 0
|
138
138
|
end
|
139
139
|
|
140
140
|
it "has the right sum" do
|
141
141
|
10.times { |x| @tm.measure { sleep 0.01*x } }
|
142
142
|
h = @tm.to_hash
|
143
|
-
h['sum'].
|
143
|
+
h['sum'].must_be_close_to(0.45, 0.01)
|
144
144
|
end
|
145
145
|
|
146
146
|
fields = ::Hitimes::Stats::STATS.dup + %w[ name additional_data sampling_start_time sampling_stop_time ]
|
147
147
|
fields.each do |f|
|
148
|
-
it "
|
148
|
+
it "has a value for #{f}" do
|
149
149
|
@tm.measure { sleep 0.001 }
|
150
150
|
h = @tm.to_hash
|
151
|
-
h[f].
|
151
|
+
h[f].wont_be_nil
|
152
152
|
end
|
153
153
|
end
|
154
154
|
end
|
@@ -6,100 +6,100 @@ describe Hitimes::TimedValueMetric do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it "knows if it is running or not" do
|
9
|
-
@tm.
|
9
|
+
@tm.running?.must_equal false
|
10
10
|
@tm.start
|
11
|
-
@tm.
|
11
|
+
@tm.running?.must_equal true
|
12
12
|
@tm.stop( 1 )
|
13
|
-
@tm.
|
13
|
+
@tm.running?.must_equal false
|
14
14
|
end
|
15
15
|
|
16
16
|
it "#split returns the last duration and the timer is still running" do
|
17
17
|
@tm.start
|
18
18
|
d = @tm.split( 1 )
|
19
|
-
@tm.
|
20
|
-
d.
|
21
|
-
@tm.value_stats.count.
|
22
|
-
@tm.timed_stats.count.
|
23
|
-
@tm.duration.
|
19
|
+
@tm.running?.must_equal true
|
20
|
+
d.must_be :>, 0
|
21
|
+
@tm.value_stats.count.must_equal 1
|
22
|
+
@tm.timed_stats.count.must_equal 1
|
23
|
+
@tm.duration.must_equal d
|
24
24
|
end
|
25
25
|
|
26
26
|
it "#stop returns false if called more than once in a row" do
|
27
27
|
@tm.start
|
28
|
-
@tm.stop( 1 ).
|
29
|
-
@tm.stop( 1 ).
|
28
|
+
@tm.stop( 1 ).must_be :>, 0
|
29
|
+
@tm.stop( 1 ).must_equal false
|
30
30
|
end
|
31
31
|
|
32
32
|
it "does not count a currently running interval as an interval in calculations" do
|
33
33
|
@tm.start
|
34
|
-
@tm.value_stats.count.
|
35
|
-
@tm.timed_stats.count.
|
34
|
+
@tm.value_stats.count.must_equal 0
|
35
|
+
@tm.timed_stats.count.must_equal 0
|
36
36
|
@tm.split( 1 )
|
37
|
-
@tm.value_stats.count.
|
38
|
-
@tm.timed_stats.count.
|
37
|
+
@tm.value_stats.count.must_equal 1
|
38
|
+
@tm.timed_stats.count.must_equal 1
|
39
39
|
end
|
40
40
|
|
41
41
|
it "#split called on a stopped timer does nothing" do
|
42
42
|
@tm.start
|
43
43
|
@tm.stop( 1 )
|
44
|
-
@tm.split( 1 ).
|
44
|
+
@tm.split( 1 ).must_equal false
|
45
45
|
end
|
46
46
|
|
47
47
|
it "calculates the mean of the durations" do
|
48
48
|
3.times { |x| @tm.start ; sleep 0.05 ; @tm.stop(x) }
|
49
|
-
@tm.timed_stats.mean.
|
50
|
-
@tm.value_stats.mean.
|
49
|
+
@tm.timed_stats.mean.must_be_close_to(0.05, 0.01)
|
50
|
+
@tm.value_stats.mean.must_equal 1.00
|
51
51
|
end
|
52
52
|
|
53
53
|
it "calculates the rate of the counts " do
|
54
54
|
5.times { |x| @tm.start ; sleep 0.05 ; @tm.stop( x ) }
|
55
|
-
@tm.rate.
|
55
|
+
@tm.rate.must_be_close_to(40.0, 1.0)
|
56
56
|
end
|
57
57
|
|
58
58
|
|
59
59
|
it "calculates the stddev of the durations" do
|
60
60
|
3.times { |x| @tm.start ; sleep(0.05 * x) ; @tm.stop(x) }
|
61
|
-
@tm.timed_stats.stddev.
|
62
|
-
@tm.value_stats.stddev.
|
61
|
+
@tm.timed_stats.stddev.must_be_close_to(0.05, 0.001)
|
62
|
+
@tm.value_stats.stddev.must_equal 1.0
|
63
63
|
end
|
64
64
|
|
65
65
|
it "returns 0.0 for stddev if there is no data" do
|
66
|
-
@tm.timed_stats.stddev.
|
67
|
-
@tm.value_stats.stddev.
|
66
|
+
@tm.timed_stats.stddev.must_equal 0.0
|
67
|
+
@tm.value_stats.stddev.must_equal 0.0
|
68
68
|
end
|
69
69
|
|
70
70
|
it "keeps track of the min value" do
|
71
71
|
3.times { |x| @tm.start ; sleep 0.05 ; @tm.stop( x ) }
|
72
|
-
@tm.timed_stats.min.
|
73
|
-
@tm.value_stats.min.
|
72
|
+
@tm.timed_stats.min.must_be_close_to( 0.05, 0.003 )
|
73
|
+
@tm.value_stats.min.must_equal 0
|
74
74
|
end
|
75
75
|
|
76
76
|
it "keeps track of the max value" do
|
77
77
|
3.times { |x| @tm.start ; sleep 0.05 ; @tm.stop( x ) }
|
78
|
-
@tm.timed_stats.max.
|
79
|
-
@tm.value_stats.max.
|
78
|
+
@tm.timed_stats.max.must_be_close_to( 0.05, 0.003 )
|
79
|
+
@tm.value_stats.max.must_equal 2
|
80
80
|
end
|
81
81
|
|
82
82
|
it "keeps track of the sum value" do
|
83
83
|
3.times { |x| @tm.start ; sleep 0.05 ; @tm.stop( x ) }
|
84
|
-
@tm.timed_stats.sum.
|
85
|
-
@tm.value_stats.sum.
|
84
|
+
@tm.timed_stats.sum.must_be_close_to( 0.15, 0.01 )
|
85
|
+
@tm.value_stats.sum.must_equal 3
|
86
86
|
end
|
87
87
|
|
88
88
|
it "keeps track of the sum of squares value" do
|
89
89
|
3.times { |x| @tm.start ; sleep 0.05 ; @tm.stop( x ) }
|
90
|
-
@tm.timed_stats.sumsq.
|
91
|
-
@tm.value_stats.sumsq.
|
90
|
+
@tm.timed_stats.sumsq.must_be_close_to(0.0075, 0.0005)
|
91
|
+
@tm.value_stats.sumsq.must_equal 5
|
92
92
|
end
|
93
93
|
|
94
94
|
it "keeps track of the minimum start time of all the intervals" do
|
95
95
|
f1 = Time.now.gmtime.to_f * 1000000
|
96
96
|
5.times { @tm.start ; sleep 0.05 ; @tm.stop( 1 ) }
|
97
97
|
f2 = Time.now.gmtime.to_f * 1000000
|
98
|
-
@tm.sampling_start_time.
|
99
|
-
@tm.sampling_start_time.
|
98
|
+
@tm.sampling_start_time.must_be :>=, f1
|
99
|
+
@tm.sampling_start_time.must_be :<, f2
|
100
100
|
# distance from now to start time should be greater than the distance from
|
101
101
|
# the start to the min start_time
|
102
|
-
(f2 - @tm.sampling_start_time).
|
102
|
+
(f2 - @tm.sampling_start_time).must_be :>, ( @tm.sampling_start_time - f1 )
|
103
103
|
end
|
104
104
|
|
105
105
|
it "keeps track of the last stop time of all the intervals" do
|
@@ -107,64 +107,64 @@ describe Hitimes::TimedValueMetric do
|
|
107
107
|
5.times { @tm.start ; sleep 0.05 ; @tm.stop( 1 ) }
|
108
108
|
sleep 0.05
|
109
109
|
f2 = Time.now.gmtime.to_f * 1_000_000
|
110
|
-
@tm.sampling_stop_time.
|
111
|
-
@tm.sampling_stop_time.
|
110
|
+
@tm.sampling_stop_time.must_be :>, f1
|
111
|
+
@tm.sampling_stop_time.must_be :<=, f2
|
112
112
|
# distance from now to max stop time time should be less than the distance
|
113
113
|
# from the start to the max stop time
|
114
|
-
(f2 - @tm.sampling_stop_time).
|
114
|
+
(f2 - @tm.sampling_stop_time).must_be :<, ( @tm.sampling_stop_time - f1 )
|
115
115
|
end
|
116
116
|
|
117
117
|
it "can create an already running timer" do
|
118
118
|
t = Hitimes::TimedValueMetric.now( 'already-running' )
|
119
|
-
t.
|
119
|
+
t.running?.must_equal true
|
120
120
|
end
|
121
121
|
|
122
122
|
it "can measure a block of code from an instance" do
|
123
123
|
t = Hitimes::TimedValueMetric.new( 'measure a block' )
|
124
124
|
3.times { t.measure( 1 ) { sleep 0.05 } }
|
125
|
-
t.duration.
|
126
|
-
t.timed_stats.count.
|
127
|
-
t.value_stats.count.
|
125
|
+
t.duration.must_be_close_to(0.15, 0.004)
|
126
|
+
t.timed_stats.count.must_equal 3
|
127
|
+
t.value_stats.count.must_equal 3
|
128
128
|
end
|
129
129
|
|
130
130
|
it "returns the value of the block when measuring" do
|
131
131
|
t = Hitimes::TimedValueMetric.new( 'measure a block' )
|
132
132
|
x = t.measure( 42 ) { sleep 0.05; 42 }
|
133
|
-
t.duration.
|
134
|
-
x.
|
133
|
+
t.duration.must_be_close_to(0.05, 0.002)
|
134
|
+
x.must_equal 42
|
135
135
|
end
|
136
136
|
|
137
137
|
describe "#to_hash" do
|
138
138
|
|
139
139
|
it "has name value" do
|
140
140
|
h = @tm.to_hash
|
141
|
-
h['name'].
|
141
|
+
h['name'].must_equal "test-timed-value-metric"
|
142
142
|
end
|
143
143
|
|
144
144
|
it "has an empty has for additional_data" do
|
145
145
|
h = @tm.to_hash
|
146
|
-
h['additional_data'].
|
147
|
-
h['additional_data'].size.
|
146
|
+
h['additional_data'].must_equal Hash.new
|
147
|
+
h['additional_data'].size.must_equal 0
|
148
148
|
end
|
149
149
|
|
150
150
|
it "has a rate" do
|
151
151
|
5.times { |x| @tm.start ; sleep 0.05 ; @tm.stop( x ) }
|
152
152
|
h = @tm.to_hash
|
153
|
-
h['rate'].
|
153
|
+
h['rate'].must_be_close_to(40.0, 1.0)
|
154
154
|
end
|
155
155
|
|
156
156
|
it "has a unit_count" do
|
157
157
|
5.times { |x| @tm.start ; sleep 0.05 ; @tm.stop( x ) }
|
158
158
|
h = @tm.to_hash
|
159
|
-
h['unit_count'].
|
159
|
+
h['unit_count'].must_equal 10
|
160
160
|
end
|
161
161
|
|
162
162
|
fields = %w[ name additional_data sampling_start_time sampling_stop_time value_stats timed_stats rate unit_count ]
|
163
163
|
fields.each do |f|
|
164
|
-
it "
|
164
|
+
it "has a value for #{f}" do
|
165
165
|
3.times { |x| @tm.measure(x) { sleep 0.001 } }
|
166
166
|
h = @tm.to_hash
|
167
|
-
h[f].
|
167
|
+
h[f].wont_be_nil
|
168
168
|
end
|
169
169
|
end
|
170
170
|
end
|
data/spec/value_metric_spec.rb
CHANGED
@@ -7,50 +7,50 @@ describe Hitimes::ValueMetric do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'has a name' do
|
10
|
-
@metric.name.
|
10
|
+
@metric.name.must_equal "testing"
|
11
11
|
end
|
12
12
|
|
13
13
|
it "has associated data from initialization" do
|
14
14
|
m = Hitimes::ValueMetric.new( "more-data", 'foo' => 'bar', 'this' => 'that' )
|
15
|
-
m.additional_data['foo'].
|
16
|
-
m.additional_data['this'].
|
15
|
+
m.additional_data['foo'].must_equal 'bar'
|
16
|
+
m.additional_data['this'].must_equal 'that'
|
17
17
|
|
18
18
|
m = Hitimes::ValueMetric.new( "more-data", { 'foo' => 'bar', 'this' => 'that' } )
|
19
|
-
m.additional_data['foo'].
|
20
|
-
m.additional_data['this'].
|
19
|
+
m.additional_data['foo'].must_equal 'bar'
|
20
|
+
m.additional_data['this'].must_equal 'that'
|
21
21
|
end
|
22
22
|
|
23
23
|
it "calculates the mean of the measurements" do
|
24
|
-
@metric.mean.
|
24
|
+
@metric.mean.must_equal 4.5
|
25
25
|
end
|
26
26
|
|
27
27
|
it "calculates the stddev of the measurements" do
|
28
|
-
@metric.stddev.
|
28
|
+
@metric.stddev.must_be :>, 0.0
|
29
29
|
end
|
30
30
|
|
31
31
|
it "returns 0.0 for stddev if there is no data" do
|
32
32
|
m = Hitimes::ValueMetric.new('0-data')
|
33
|
-
m.stddev.
|
33
|
+
m.stddev.must_equal 0.0
|
34
34
|
end
|
35
35
|
|
36
36
|
it "keeps track of the sum of data" do
|
37
|
-
@metric.sum.
|
37
|
+
@metric.sum.must_equal 45.0
|
38
38
|
end
|
39
39
|
|
40
40
|
it "keeps track of the sum of squars of data" do
|
41
|
-
@metric.sumsq.
|
41
|
+
@metric.sumsq.must_equal 285.0
|
42
42
|
end
|
43
43
|
|
44
44
|
it "retuns 0.0 for mean if there is no data" do
|
45
|
-
Hitimes::ValueMetric.new('0-data').mean.
|
45
|
+
Hitimes::ValueMetric.new('0-data').mean.must_equal 0.0
|
46
46
|
end
|
47
47
|
|
48
48
|
it "keeps track of the min value" do
|
49
|
-
@metric.min.
|
49
|
+
@metric.min.must_equal 0
|
50
50
|
end
|
51
51
|
|
52
52
|
it "keeps track of the max value" do
|
53
|
-
@metric.max.
|
53
|
+
@metric.max.must_equal 9
|
54
54
|
end
|
55
55
|
|
56
56
|
it "keeps track of the first start time of all the measurements" do
|
@@ -58,11 +58,11 @@ describe Hitimes::ValueMetric do
|
|
58
58
|
f1 = Time.now.gmtime.to_f * 1_000_000
|
59
59
|
10.times{ |x| m.measure( x ); sleep 0.1 }
|
60
60
|
f2 = Time.now.gmtime.to_f * 1_000_000
|
61
|
-
m.sampling_start_time.
|
62
|
-
m.sampling_start_time.
|
61
|
+
m.sampling_start_time.must_be :>=, f1
|
62
|
+
m.sampling_start_time.must_be :<, f2
|
63
63
|
# distance from now to start time should be greater than the distance from
|
64
64
|
# the start to the min start_time
|
65
|
-
(f2 - m.sampling_start_time).
|
65
|
+
(f2 - m.sampling_start_time).must_be :>, ( m.sampling_start_time - f1 )
|
66
66
|
end
|
67
67
|
|
68
68
|
it "keeps track of the last stop time of all the intervals" do
|
@@ -70,37 +70,37 @@ describe Hitimes::ValueMetric do
|
|
70
70
|
f1 = Time.now.gmtime.to_f * 1_000_000
|
71
71
|
10.times {|x| m.measure( x ); sleep 0.1 }
|
72
72
|
f2 = Time.now.gmtime.to_f * 1_000_000
|
73
|
-
m.sampling_stop_time.
|
74
|
-
m.sampling_stop_time.
|
73
|
+
m.sampling_stop_time.must_be :>, f1
|
74
|
+
m.sampling_stop_time.must_be :<=, f2
|
75
75
|
# distance from now to max stop time time should be less than the distance
|
76
76
|
# from the start to the max stop time
|
77
|
-
(f2 - m.sampling_stop_time).
|
77
|
+
(f2 - m.sampling_stop_time).must_be :<, ( m.sampling_stop_time - f1 )
|
78
78
|
end
|
79
79
|
|
80
80
|
describe "#to_hash" do
|
81
81
|
|
82
82
|
it "has name value" do
|
83
83
|
h = @metric.to_hash
|
84
|
-
h['name'].
|
84
|
+
h['name'].must_equal "testing"
|
85
85
|
end
|
86
86
|
|
87
87
|
it "has an empty has for additional_data" do
|
88
88
|
h = @metric.to_hash
|
89
|
-
h['additional_data'].
|
90
|
-
h['additional_data'].size.
|
89
|
+
h['additional_data'].must_equal Hash.new
|
90
|
+
h['additional_data'].size.must_equal 0
|
91
91
|
end
|
92
92
|
|
93
93
|
it "has the right sum" do
|
94
94
|
h = @metric.to_hash
|
95
|
-
h['sum'].
|
95
|
+
h['sum'].must_equal 45
|
96
96
|
end
|
97
97
|
|
98
98
|
fields = ::Hitimes::Stats::STATS.dup + %w[ name additional_data sampling_start_time sampling_stop_time ]
|
99
99
|
fields = fields - [ 'rate' ]
|
100
100
|
fields.each do |f|
|
101
|
-
it "
|
101
|
+
it "has a value for #{f}" do
|
102
102
|
h = @metric.to_hash
|
103
|
-
h[f].
|
103
|
+
h[f].wont_be_nil
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
data/spec/version_spec.rb
CHANGED
data/tasks/default.rake
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# vim: syntax=ruby
|
2
2
|
require 'rake/clean'
|
3
|
+
require 'digest'
|
3
4
|
#------------------------------------------------------------------------------
|
4
5
|
# If you want to Develop on this project just run 'rake develop' and you'll
|
5
6
|
# have all you need to get going. If you want to use bundler for development,
|
@@ -11,7 +12,7 @@ namespace :develop do
|
|
11
12
|
# gemspec.
|
12
13
|
task :default do
|
13
14
|
require 'rubygems/dependency_installer'
|
14
|
-
installer = Gem::DependencyInstaller.new
|
15
|
+
installer = ::Gem::DependencyInstaller.new
|
15
16
|
|
16
17
|
This.set_coverage_gem
|
17
18
|
|
@@ -30,7 +31,9 @@ namespace :develop do
|
|
30
31
|
# Create a Gemfile that just references the gemspec
|
31
32
|
file 'Gemfile' => :gemspec do
|
32
33
|
File.open( "Gemfile", "w+" ) do |f|
|
33
|
-
f.puts
|
34
|
+
f.puts "# DO NOT EDIT - This file is automatically generated"
|
35
|
+
f.puts "# Make changes to Manifest.txt and/or Rakefile and regenerate"
|
36
|
+
f.puts 'source "https://rubygems.org/"'
|
34
37
|
f.puts 'gemspec'
|
35
38
|
end
|
36
39
|
end
|
@@ -53,8 +56,8 @@ begin
|
|
53
56
|
require 'rake/testtask'
|
54
57
|
Rake::TestTask.new( :test ) do |t|
|
55
58
|
t.ruby_opts = %w[ -w -rubygems ]
|
56
|
-
t.libs = %w[ lib spec ]
|
57
|
-
t.pattern = "spec
|
59
|
+
t.libs = %w[ lib spec test ]
|
60
|
+
t.pattern = "{test,spec}/**/{test_*,*_spec}.rb"
|
58
61
|
end
|
59
62
|
|
60
63
|
task :test_requirements
|
@@ -79,7 +82,7 @@ begin
|
|
79
82
|
t.rdoc_files.include( FileList['*.{rdoc,md,txt}'], FileList['ext/**/*.c'],
|
80
83
|
FileList['lib/**/*.rb'] )
|
81
84
|
end
|
82
|
-
rescue LoadError
|
85
|
+
rescue StandardError, LoadError
|
83
86
|
This.task_warning( 'rdoc' )
|
84
87
|
end
|
85
88
|
|
@@ -106,9 +109,9 @@ else
|
|
106
109
|
desc 'Run tests with code coverage'
|
107
110
|
task :coverage do
|
108
111
|
ENV['COVERAGE'] = 'true'
|
109
|
-
Rake::Task[:test].
|
112
|
+
Rake::Task[:test].invoke
|
110
113
|
end
|
111
|
-
CLOBBER << FileList["coverage"]
|
114
|
+
CLOBBER << FileList["coverage"] if File.directory?( "coverage" )
|
112
115
|
rescue LoadError
|
113
116
|
This.task_warning( 'simplecov' )
|
114
117
|
end
|
@@ -222,6 +225,8 @@ task :fixme => "fixme:default"
|
|
222
225
|
desc "Build the #{This.name}.gemspec file"
|
223
226
|
task :gemspec do
|
224
227
|
File.open( This.gemspec_file, "wb+" ) do |f|
|
228
|
+
f.puts "# DO NOT EDIT - This file is automatically generated"
|
229
|
+
f.puts "# Make changes to Manifest.txt and/or Rakefile and regenerate"
|
225
230
|
f.write This.platform_gemspec.to_ruby
|
226
231
|
end
|
227
232
|
end
|
@@ -234,7 +239,7 @@ CLOBBER << FileList["**/*.rbc"]
|
|
234
239
|
|
235
240
|
# The standard gem packaging task, everyone has it.
|
236
241
|
require 'rubygems/package_task'
|
237
|
-
Gem::PackageTask.new( This.platform_gemspec ) do
|
242
|
+
::Gem::PackageTask.new( This.platform_gemspec ) do
|
238
243
|
# nothing
|
239
244
|
end
|
240
245
|
|
data/tasks/this.rb
CHANGED
@@ -25,7 +25,7 @@ class ThisProject
|
|
25
25
|
#
|
26
26
|
# Yields self
|
27
27
|
def initialize(&block)
|
28
|
-
@exclude_from_manifest = %r/\.(git|DS_Store)|^(doc|coverage|pkg|tmp
|
28
|
+
@exclude_from_manifest = %r/\.(git|DS_Store)|^(doc|coverage|pkg|tmp|Gemfile(\.lock)?)|^[^\/]+\.gemspec|\.(swp|jar|bundle|so|rvmrc)$|~$/
|
29
29
|
@gemspecs = Hash.new
|
30
30
|
yield self if block_given?
|
31
31
|
end
|
@@ -132,6 +132,7 @@ class ThisProject
|
|
132
132
|
|
133
133
|
spec.summary = summary
|
134
134
|
spec.description = description
|
135
|
+
spec.license = license
|
135
136
|
|
136
137
|
spec.files = manifest
|
137
138
|
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
@@ -176,7 +177,7 @@ class ThisProject
|
|
176
177
|
if RUBY_VERSION < "1.9.0"
|
177
178
|
platform_gemspec.add_development_dependency( 'rcov', '~> 1.0.0' )
|
178
179
|
else
|
179
|
-
platform_gemspec.add_development_dependency( 'simplecov', '~> 0.
|
180
|
+
platform_gemspec.add_development_dependency( 'simplecov', '~> 0.8.2' )
|
180
181
|
end
|
181
182
|
end
|
182
183
|
|
@@ -195,11 +196,15 @@ class ThisProject
|
|
195
196
|
description_section.first
|
196
197
|
end
|
197
198
|
|
198
|
-
# Internal: Return the full description text from the
|
199
|
+
# Internal: Return the full description text from the README
|
199
200
|
def description
|
200
201
|
description_section.join(" ").tr("\n", ' ').gsub(/[{}]/,'').gsub(/\[[^\]]+\]/,'') # strip rdoc
|
201
202
|
end
|
202
203
|
|
204
|
+
def license
|
205
|
+
"ISC"
|
206
|
+
end
|
207
|
+
|
203
208
|
# Internal: The path to the gemspec file
|
204
209
|
def gemspec_file
|
205
210
|
project_path( "#{ name }.gemspec" )
|
metadata
CHANGED
@@ -1,97 +1,86 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hitimes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.2
|
6
5
|
platform: java
|
7
6
|
authors:
|
8
7
|
- Jeremy Hinegardner
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-07-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
version_requirements: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
|
-
- -
|
17
|
+
- - ~>
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: 10.0
|
21
|
-
none: false
|
19
|
+
version: '10.0'
|
22
20
|
requirement: !ruby/object:Gem::Requirement
|
23
21
|
requirements:
|
24
|
-
- -
|
22
|
+
- - ~>
|
25
23
|
- !ruby/object:Gem::Version
|
26
|
-
version: 10.0
|
27
|
-
none: false
|
24
|
+
version: '10.0'
|
28
25
|
prerelease: false
|
29
26
|
type: :development
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
28
|
+
name: minitest
|
32
29
|
version_requirements: !ruby/object:Gem::Requirement
|
33
30
|
requirements:
|
34
|
-
- -
|
31
|
+
- - ~>
|
35
32
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
37
|
-
none: false
|
33
|
+
version: '5.3'
|
38
34
|
requirement: !ruby/object:Gem::Requirement
|
39
35
|
requirements:
|
40
|
-
- -
|
36
|
+
- - ~>
|
41
37
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
43
|
-
none: false
|
38
|
+
version: '5.3'
|
44
39
|
prerelease: false
|
45
40
|
type: :development
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rdoc
|
48
43
|
version_requirements: !ruby/object:Gem::Requirement
|
49
44
|
requirements:
|
50
|
-
- -
|
45
|
+
- - ~>
|
51
46
|
- !ruby/object:Gem::Version
|
52
|
-
version: '4.
|
53
|
-
none: false
|
47
|
+
version: '4.1'
|
54
48
|
requirement: !ruby/object:Gem::Requirement
|
55
49
|
requirements:
|
56
|
-
- -
|
50
|
+
- - ~>
|
57
51
|
- !ruby/object:Gem::Version
|
58
|
-
version: '4.
|
59
|
-
none: false
|
52
|
+
version: '4.1'
|
60
53
|
prerelease: false
|
61
54
|
type: :development
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: json
|
64
57
|
version_requirements: !ruby/object:Gem::Requirement
|
65
58
|
requirements:
|
66
|
-
- -
|
59
|
+
- - ~>
|
67
60
|
- !ruby/object:Gem::Version
|
68
61
|
version: 1.7.7
|
69
|
-
none: false
|
70
62
|
requirement: !ruby/object:Gem::Requirement
|
71
63
|
requirements:
|
72
|
-
- -
|
64
|
+
- - ~>
|
73
65
|
- !ruby/object:Gem::Version
|
74
66
|
version: 1.7.7
|
75
|
-
none: false
|
76
67
|
prerelease: false
|
77
68
|
type: :development
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rake-compiler
|
80
71
|
version_requirements: !ruby/object:Gem::Requirement
|
81
72
|
requirements:
|
82
|
-
- -
|
73
|
+
- - ~>
|
83
74
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.
|
85
|
-
none: false
|
75
|
+
version: '0.9'
|
86
76
|
requirement: !ruby/object:Gem::Requirement
|
87
77
|
requirements:
|
88
|
-
- -
|
78
|
+
- - ~>
|
89
79
|
- !ruby/object:Gem::Version
|
90
|
-
version: 0.
|
91
|
-
none: false
|
80
|
+
version: '0.9'
|
92
81
|
prerelease: false
|
93
82
|
type: :development
|
94
|
-
description:
|
83
|
+
description: 'Hitimes is a fast, high resolution timer library for recording performance
|
95
84
|
metrics. It uses the appropriate low method calls for each system to get the highest
|
96
85
|
granularity time increments possible. It currently supports any of the following
|
97
86
|
systems: * any system with the POSIX call `clock_gettime()` * Mac OS X * Windows
|
@@ -106,6 +95,7 @@ extra_rdoc_files:
|
|
106
95
|
- Manifest.txt
|
107
96
|
- README.md
|
108
97
|
files:
|
98
|
+
- .travis.yml
|
109
99
|
- CONTRIBUTING.md
|
110
100
|
- HISTORY.md
|
111
101
|
- LICENSE
|
@@ -152,34 +142,32 @@ files:
|
|
152
142
|
- tasks/this.rb
|
153
143
|
- lib/hitimes/hitimes.jar
|
154
144
|
homepage: http://github.com/copiousfreetime/hitimes
|
155
|
-
licenses:
|
145
|
+
licenses:
|
146
|
+
- ISC
|
147
|
+
metadata: {}
|
156
148
|
post_install_message:
|
157
149
|
rdoc_options:
|
158
|
-
-
|
150
|
+
- --main
|
159
151
|
- README.md
|
160
|
-
-
|
152
|
+
- --markup
|
161
153
|
- tomdoc
|
162
154
|
require_paths:
|
163
155
|
- lib
|
164
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
165
157
|
requirements:
|
166
|
-
- -
|
158
|
+
- - '>='
|
167
159
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
169
|
-
MA==
|
170
|
-
none: false
|
160
|
+
version: '0'
|
171
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
162
|
requirements:
|
173
|
-
- -
|
163
|
+
- - '>='
|
174
164
|
- !ruby/object:Gem::Version
|
175
|
-
version:
|
176
|
-
MA==
|
177
|
-
none: false
|
165
|
+
version: '0'
|
178
166
|
requirements: []
|
179
167
|
rubyforge_project:
|
180
|
-
rubygems_version: 1.
|
168
|
+
rubygems_version: 2.1.9
|
181
169
|
signing_key:
|
182
|
-
specification_version:
|
170
|
+
specification_version: 4
|
183
171
|
summary: Hitimes is a fast, high resolution timer library for recording performance metrics. It uses the appropriate low method calls for each system to get the highest granularity time increments possible.
|
184
172
|
test_files:
|
185
173
|
- spec/hitimes_spec.rb
|